From dd7595a3475407a7fa96a97393bae8c5220e8762 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Wed, 4 Jan 2012 18:41:13 +1000 Subject: Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje. Note that embryo wont be used, but I'm not sure yet if you can build edje without it. --- libraries/ecore/src/Makefile.am | 26 + libraries/ecore/src/Makefile.in | 818 ++++ libraries/ecore/src/bin/Makefile.am | 51 + libraries/ecore/src/bin/Makefile.in | 808 ++++ libraries/ecore/src/bin/ecore_config.c | 324 ++ libraries/ecore/src/bin/ecore_test.c | 109 + libraries/ecore/src/examples/Makefile.am | 111 + libraries/ecore/src/examples/Makefile.in | 1192 ++++++ .../ecore/src/examples/ecore_animator_example.c | 116 + libraries/ecore/src/examples/ecore_client_bench.c | 77 + .../ecore/src/examples/ecore_con_client_example.c | 90 + .../src/examples/ecore_con_client_simple_example.c | 124 + .../ecore/src/examples/ecore_con_lookup_example.c | 38 + .../ecore/src/examples/ecore_con_server_example.c | 81 + .../src/examples/ecore_con_server_http_example.c | 135 + .../src/examples/ecore_con_server_simple_example.c | 131 + .../src/examples/ecore_con_url_cookies_example.c | 119 + .../src/examples/ecore_con_url_download_example.c | 110 + .../src/examples/ecore_con_url_headers_example.c | 104 + .../ecore/src/examples/ecore_evas_basics_example.c | 91 + .../src/examples/ecore_evas_buffer_example_01.c | 121 + .../src/examples/ecore_evas_buffer_example_02.c | 126 + .../ecore/src/examples/ecore_evas_callbacks.c | 127 + .../ecore/src/examples/ecore_evas_ews_example.c | 253 ++ .../ecore/src/examples/ecore_evas_object_example.c | 52 + .../src/examples/ecore_evas_window_sizes_example.c | 204 + libraries/ecore/src/examples/ecore_event_example.c | 86 + .../ecore/src/examples/ecore_fd_handler_example.c | 86 + .../src/examples/ecore_fd_handler_gnutls_example.c | 195 + .../src/examples/ecore_file_download_example.c | 86 + libraries/ecore/src/examples/ecore_idler_example.c | 112 + libraries/ecore/src/examples/ecore_job_example.c | 48 + .../src/examples/ecore_pipe_gstreamer_example.c | 180 + .../ecore/src/examples/ecore_pipe_simple_example.c | 66 + .../ecore/src/examples/ecore_poller_example.c | 47 + libraries/ecore/src/examples/ecore_server_bench.c | 62 + .../ecore/src/examples/ecore_thread_example.c | 394 ++ .../src/examples/ecore_time_functions_example.c | 32 + libraries/ecore/src/examples/ecore_timer_example.c | 184 + libraries/ecore/src/examples/red.png | Bin 0 -> 225 bytes libraries/ecore/src/lib/Makefile.am | 71 + libraries/ecore/src/lib/Makefile.in | 820 ++++ libraries/ecore/src/lib/ecore/Ecore.h | 2346 +++++++++++ libraries/ecore/src/lib/ecore/Ecore_Getopt.h | 419 ++ libraries/ecore/src/lib/ecore/Makefile.am | 60 + libraries/ecore/src/lib/ecore/Makefile.in | 853 ++++ libraries/ecore/src/lib/ecore/ecore.c | 731 ++++ libraries/ecore/src/lib/ecore/ecore_anim.c | 479 +++ libraries/ecore/src/lib/ecore/ecore_app.c | 95 + libraries/ecore/src/lib/ecore/ecore_events.c | 790 ++++ libraries/ecore/src/lib/ecore/ecore_exe.c | 1880 +++++++++ libraries/ecore/src/lib/ecore/ecore_exe_ps3.c | 20 + libraries/ecore/src/lib/ecore/ecore_exe_win32.c | 1055 +++++ libraries/ecore/src/lib/ecore/ecore_exe_wince.c | 21 + libraries/ecore/src/lib/ecore/ecore_getopt.c | 1908 +++++++++ libraries/ecore/src/lib/ecore/ecore_glib.c | 338 ++ libraries/ecore/src/lib/ecore/ecore_idle_enterer.c | 207 + libraries/ecore/src/lib/ecore/ecore_idle_exiter.c | 176 + libraries/ecore/src/lib/ecore/ecore_idler.c | 158 + libraries/ecore/src/lib/ecore/ecore_job.c | 122 + libraries/ecore/src/lib/ecore/ecore_main.c | 2020 +++++++++ libraries/ecore/src/lib/ecore/ecore_pipe.c | 682 ++++ libraries/ecore/src/lib/ecore/ecore_poll.c | 440 ++ libraries/ecore/src/lib/ecore/ecore_private.h | 353 ++ libraries/ecore/src/lib/ecore/ecore_signal.c | 565 +++ libraries/ecore/src/lib/ecore/ecore_thread.c | 1666 ++++++++ libraries/ecore/src/lib/ecore/ecore_throttle.c | 99 + libraries/ecore/src/lib/ecore/ecore_time.c | 184 + libraries/ecore/src/lib/ecore/ecore_timer.c | 800 ++++ libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa.h | 147 + .../ecore/src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h | 285 ++ libraries/ecore/src/lib/ecore_cocoa/Makefile.am | 29 + libraries/ecore/src/lib/ecore_cocoa/Makefile.in | 823 ++++ libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa.m | 283 ++ .../src/lib/ecore_cocoa/ecore_cocoa_private.h | 11 + .../ecore/src/lib/ecore_cocoa/ecore_cocoa_window.m | 163 + libraries/ecore/src/lib/ecore_con/Ecore_Con.h | 1801 ++++++++ libraries/ecore/src/lib/ecore_con/Makefile.am | 45 + libraries/ecore/src/lib/ecore_con/Makefile.in | 909 +++++ libraries/ecore/src/lib/ecore_con/ecore_con.c | 2600 ++++++++++++ .../ecore/src/lib/ecore_con/ecore_con_alloc.c | 99 + libraries/ecore/src/lib/ecore_con/ecore_con_ares.c | 628 +++ libraries/ecore/src/lib/ecore_con/ecore_con_info.c | 450 ++ .../ecore/src/lib/ecore_con/ecore_con_local.c | 317 ++ .../src/lib/ecore_con/ecore_con_local_win32.c | 769 ++++ .../ecore/src/lib/ecore_con/ecore_con_private.h | 321 ++ libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c | 1777 ++++++++ libraries/ecore/src/lib/ecore_con/ecore_con_url.c | 1572 +++++++ .../ecore/src/lib/ecore_config/Ecore_Config.h | 312 ++ libraries/ecore/src/lib/ecore_config/Makefile.am | 62 + libraries/ecore/src/lib/ecore_config/Makefile.in | 855 ++++ .../ecore/src/lib/ecore_config/ecore_config.c | 1870 +++++++++ .../ecore/src/lib/ecore_config/ecore_config_db.c | 296 ++ .../src/lib/ecore_config/ecore_config_extra.c | 803 ++++ .../ecore/src/lib/ecore_config/ecore_config_ipc.h | 50 + .../src/lib/ecore_config/ecore_config_ipc_ecore.c | 384 ++ .../src/lib/ecore_config/ecore_config_ipc_main.c | 275 ++ .../src/lib/ecore_config/ecore_config_private.h | 70 + .../src/lib/ecore_config/ecore_config_storage.c | 176 + .../ecore/src/lib/ecore_config/ecore_config_util.c | 129 + .../ecore/src/lib/ecore_config/ecore_config_util.h | 14 + .../ecore/src/lib/ecore_directfb/Ecore_DirectFB.h | 181 + libraries/ecore/src/lib/ecore_directfb/Makefile.am | 31 + libraries/ecore/src/lib/ecore_directfb/Makefile.in | 822 ++++ .../ecore/src/lib/ecore_directfb/ecore_directfb.c | 757 ++++ .../src/lib/ecore_directfb/ecore_directfb_keys.h | 184 + .../lib/ecore_directfb/ecore_directfb_private.h | 52 + libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h | 1660 ++++++++ libraries/ecore/src/lib/ecore_evas/Makefile.am | 131 + libraries/ecore/src/lib/ecore_evas/Makefile.in | 921 +++++ libraries/ecore/src/lib/ecore_evas/ecore_evas.c | 2588 ++++++++++++ .../ecore/src/lib/ecore_evas/ecore_evas_buffer.c | 827 ++++ .../ecore/src/lib/ecore_evas/ecore_evas_cocoa.c | 574 +++ .../ecore/src/lib/ecore_evas/ecore_evas_directfb.c | 596 +++ .../ecore/src/lib/ecore_evas/ecore_evas_ews.c | 1454 +++++++ libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c | 659 +++ .../ecore/src/lib/ecore_evas/ecore_evas_private.h | 433 ++ .../ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c | 476 +++ .../ecore/src/lib/ecore_evas/ecore_evas_sdl.c | 542 +++ .../ecore/src/lib/ecore_evas/ecore_evas_util.c | 437 ++ .../ecore/src/lib/ecore_evas/ecore_evas_win32.c | 1451 +++++++ .../ecore/src/lib/ecore_evas/ecore_evas_wince.c | 985 +++++ libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c | 4289 ++++++++++++++++++++ libraries/ecore/src/lib/ecore_fb/Ecore_Fb.h | 100 + libraries/ecore/src/lib/ecore_fb/Makefile.am | 34 + libraries/ecore/src/lib/ecore_fb/Makefile.in | 831 ++++ libraries/ecore/src/lib/ecore_fb/ecore_fb.c | 114 + .../ecore/src/lib/ecore_fb/ecore_fb_keytable.h | 129 + libraries/ecore/src/lib/ecore_fb/ecore_fb_li.c | 706 ++++ .../ecore/src/lib/ecore_fb/ecore_fb_private.h | 91 + libraries/ecore/src/lib/ecore_fb/ecore_fb_ts.c | 355 ++ libraries/ecore/src/lib/ecore_fb/ecore_fb_vt.c | 322 ++ libraries/ecore/src/lib/ecore_file/Ecore_File.h | 190 + libraries/ecore/src/lib/ecore_file/Makefile.am | 41 + libraries/ecore/src/lib/ecore_file/Makefile.in | 837 ++++ libraries/ecore/src/lib/ecore_file/ecore_file.c | 1110 +++++ .../ecore/src/lib/ecore_file/ecore_file_download.c | 440 ++ .../ecore/src/lib/ecore_file/ecore_file_monitor.c | 180 + .../lib/ecore_file/ecore_file_monitor_inotify.c | 369 ++ .../src/lib/ecore_file/ecore_file_monitor_poll.c | 339 ++ .../src/lib/ecore_file/ecore_file_monitor_win32.c | 310 ++ .../ecore/src/lib/ecore_file/ecore_file_path.c | 184 + .../ecore/src/lib/ecore_file/ecore_file_private.h | 129 + libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h | 418 ++ libraries/ecore/src/lib/ecore_imf/Makefile.am | 28 + libraries/ecore/src/lib/ecore_imf/Makefile.in | 822 ++++ libraries/ecore/src/lib/ecore_imf/ecore_imf.c | 73 + .../ecore/src/lib/ecore_imf/ecore_imf_context.c | 1237 ++++++ .../ecore/src/lib/ecore_imf/ecore_imf_module.c | 212 + .../ecore/src/lib/ecore_imf/ecore_imf_private.h | 72 + .../ecore/src/lib/ecore_imf_evas/Ecore_IMF_Evas.h | 50 + libraries/ecore/src/lib/ecore_imf_evas/Makefile.am | 22 + libraries/ecore/src/lib/ecore_imf_evas/Makefile.in | 815 ++++ .../ecore/src/lib/ecore_imf_evas/ecore_imf_evas.c | 259 ++ libraries/ecore/src/lib/ecore_input/Ecore_Input.h | 220 + libraries/ecore/src/lib/ecore_input/Makefile.am | 24 + libraries/ecore/src/lib/ecore_input/Makefile.in | 816 ++++ libraries/ecore/src/lib/ecore_input/ecore_input.c | 120 + .../src/lib/ecore_input/ecore_input_private.h | 37 + .../src/lib/ecore_input_evas/Ecore_Input_Evas.h | 64 + .../ecore/src/lib/ecore_input_evas/Makefile.am | 29 + .../ecore/src/lib/ecore_input_evas/Makefile.in | 822 ++++ .../src/lib/ecore_input_evas/ecore_input_evas.c | 412 ++ .../ecore_input_evas/ecore_input_evas_private.h | 37 + libraries/ecore/src/lib/ecore_ipc/Ecore_Ipc.h | 325 ++ libraries/ecore/src/lib/ecore_ipc/Makefile.am | 29 + libraries/ecore/src/lib/ecore_ipc/Makefile.in | 822 ++++ libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c | 1591 ++++++++ .../ecore/src/lib/ecore_ipc/ecore_ipc_private.h | 104 + .../ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h | 124 + .../src/lib/ecore_psl1ght/Ecore_Psl1ght_Keys.h | 78 + libraries/ecore/src/lib/ecore_psl1ght/Makefile.am | 30 + libraries/ecore/src/lib/ecore_psl1ght/Makefile.in | 826 ++++ .../ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c | 804 ++++ .../src/lib/ecore_psl1ght/ecore_psl1ght_private.h | 36 + libraries/ecore/src/lib/ecore_psl1ght/moveutil.c | 245 ++ libraries/ecore/src/lib/ecore_psl1ght/spursutil.c | 62 + libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl.h | 114 + libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl_Keys.h | 266 ++ libraries/ecore/src/lib/ecore_sdl/Makefile.am | 29 + libraries/ecore/src/lib/ecore_sdl/Makefile.in | 822 ++++ libraries/ecore/src/lib/ecore_sdl/ecore_sdl.c | 335 ++ .../ecore/src/lib/ecore_sdl/ecore_sdl_private.h | 36 + libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h | 529 +++ libraries/ecore/src/lib/ecore_win32/Makefile.am | 42 + libraries/ecore/src/lib/ecore_win32/Makefile.in | 887 ++++ libraries/ecore/src/lib/ecore_win32/ecore_win32.c | 788 ++++ .../ecore/src/lib/ecore_win32/ecore_win32_cursor.c | 306 ++ .../ecore/src/lib/ecore_win32/ecore_win32_dnd.c | 221 + .../ecore_win32/ecore_win32_dnd_data_object.cpp | 209 + .../lib/ecore_win32/ecore_win32_dnd_data_object.h | 49 + .../ecore_win32/ecore_win32_dnd_drop_source.cpp | 92 + .../lib/ecore_win32/ecore_win32_dnd_drop_source.h | 36 + .../ecore_win32/ecore_win32_dnd_drop_target.cpp | 232 ++ .../lib/ecore_win32/ecore_win32_dnd_drop_target.h | 47 + .../ecore_win32/ecore_win32_dnd_enumformatetc.cpp | 157 + .../ecore_win32/ecore_win32_dnd_enumformatetc.h | 50 + .../ecore/src/lib/ecore_win32/ecore_win32_event.c | 1231 ++++++ .../src/lib/ecore_win32/ecore_win32_private.h | 169 + .../ecore/src/lib/ecore_win32/ecore_win32_window.c | 1519 +++++++ libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h | 310 ++ libraries/ecore/src/lib/ecore_wince/Makefile.am | 35 + libraries/ecore/src/lib/ecore_wince/Makefile.in | 829 ++++ libraries/ecore/src/lib/ecore_wince/ecore_wince.c | 400 ++ .../ecore/src/lib/ecore_wince/ecore_wince_event.c | 1074 +++++ .../src/lib/ecore_wince/ecore_wince_private.h | 85 + .../ecore/src/lib/ecore_wince/ecore_wince_window.c | 775 ++++ libraries/ecore/src/lib/ecore_x/Ecore_X.h | 3622 +++++++++++++++++ libraries/ecore/src/lib/ecore_x/Ecore_X_Atoms.h | 255 ++ libraries/ecore/src/lib/ecore_x/Ecore_X_Cursor.h | 87 + libraries/ecore/src/lib/ecore_x/Makefile.am | 30 + libraries/ecore/src/lib/ecore_x/Makefile.in | 934 +++++ .../ecore/src/lib/ecore_x/ecore_x_atoms_decl.h | 281 ++ libraries/ecore/src/lib/ecore_x/xcb/Makefile.am | 99 + libraries/ecore/src/lib/ecore_x/xcb/Makefile.in | 891 ++++ libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb.c | 1470 +++++++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_atoms.c | 408 ++ .../src/lib/ecore_x/xcb/ecore_xcb_composite.c | 289 ++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_cursor.c | 400 ++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_damage.c | 155 + .../ecore/src/lib/ecore_x/xcb/ecore_xcb_dnd.c | 689 ++++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_dpms.c | 318 ++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_drawable.c | 123 + libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_e.c | 1071 +++++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c | 109 + .../ecore/src/lib/ecore_x/xcb/ecore_xcb_events.c | 2805 +++++++++++++ .../src/lib/ecore_x/xcb/ecore_xcb_extensions.c | 148 + libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gc.c | 173 + .../ecore/src/lib/ecore_x/xcb/ecore_xcb_gesture.c | 203 + .../ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c | 1568 +++++++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_image.c | 740 ++++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_input.c | 274 ++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_keymap.c | 482 +++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_mwm.c | 104 + .../ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c | 1525 +++++++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_pixmap.c | 128 + .../ecore/src/lib/ecore_x/xcb/ecore_xcb_private.h | 451 ++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_randr.c | 3474 ++++++++++++++++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_region.c | 159 + .../ecore/src/lib/ecore_x/xcb/ecore_xcb_render.c | 225 + .../src/lib/ecore_x/xcb/ecore_xcb_screensaver.c | 338 ++ .../src/lib/ecore_x/xcb/ecore_xcb_selection.c | 1039 +++++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_shape.c | 50 + .../ecore/src/lib/ecore_x/xcb/ecore_xcb_sync.c | 338 ++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_textlist.c | 509 +++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_vsync.c | 375 ++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_window.c | 2233 ++++++++++ .../src/lib/ecore_x/xcb/ecore_xcb_window_prop.c | 720 ++++ .../src/lib/ecore_x/xcb/ecore_xcb_window_shadow.c | 408 ++ .../src/lib/ecore_x/xcb/ecore_xcb_window_shape.c | 790 ++++ .../src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c | 116 + .../ecore/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c | 750 ++++ .../ecore/src/lib/ecore_x/xcb/ecore_xcb_xinerama.c | 139 + .../ecore/src/lib/ecore_x/xcb/ecore_xcb_xtest.c | 215 + libraries/ecore/src/lib/ecore_x/xlib/Makefile.am | 94 + libraries/ecore/src/lib/ecore_x/xlib/Makefile.in | 874 ++++ libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c | 2098 ++++++++++ .../ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c | 352 ++ .../ecore/src/lib/ecore_x/xlib/ecore_x_composite.c | 176 + .../ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c | 246 ++ .../ecore/src/lib/ecore_x/xlib/ecore_x_damage.c | 71 + libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c | 706 ++++ .../ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c | 247 ++ .../ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c | 118 + libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c | 1060 +++++ .../ecore/src/lib/ecore_x/xlib/ecore_x_error.c | 111 + .../ecore/src/lib/ecore_x/xlib/ecore_x_events.c | 2486 ++++++++++++ .../ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c | 364 ++ libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c | 171 + .../ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c | 136 + .../ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c | 1214 ++++++ .../ecore/src/lib/ecore_x/xlib/ecore_x_image.c | 598 +++ libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c | 106 + .../ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c | 2003 +++++++++ .../ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c | 121 + .../ecore/src/lib/ecore_x/xlib/ecore_x_private.h | 385 ++ .../ecore/src/lib/ecore_x/xlib/ecore_x_randr.c | 102 + .../ecore/src/lib/ecore_x/xlib/ecore_x_randr.h | 7 + .../ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c | 332 ++ .../ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c | 2199 ++++++++++ .../src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c | 457 +++ .../ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c | 63 + .../ecore/src/lib/ecore_x/xlib/ecore_x_region.c | 158 + .../src/lib/ecore_x/xlib/ecore_x_screensaver.c | 173 + .../ecore/src/lib/ecore_x/xlib/ecore_x_selection.c | 1001 +++++ .../ecore/src/lib/ecore_x/xlib/ecore_x_sync.c | 159 + .../ecore/src/lib/ecore_x/xlib/ecore_x_test.c | 155 + .../ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c | 351 ++ .../ecore/src/lib/ecore_x/xlib/ecore_x_window.c | 1723 ++++++++ .../src/lib/ecore_x/xlib/ecore_x_window_prop.c | 750 ++++ .../src/lib/ecore_x/xlib/ecore_x_window_shape.c | 658 +++ libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c | 283 ++ .../ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c | 91 + libraries/ecore/src/modules/Makefile.am | 3 + libraries/ecore/src/modules/Makefile.in | 795 ++++ libraries/ecore/src/modules/immodules/Makefile.am | 7 + libraries/ecore/src/modules/immodules/Makefile.in | 796 ++++ .../ecore/src/modules/immodules/xim/Makefile.am | 29 + .../ecore/src/modules/immodules/xim/Makefile.in | 808 ++++ .../src/modules/immodules/xim/ecore_imf_xim.c | 1273 ++++++ libraries/ecore/src/tests/Makefile.am | 37 + libraries/ecore/src/tests/Makefile.in | 767 ++++ libraries/ecore/src/tests/ecore_suite.c | 103 + libraries/ecore/src/tests/ecore_suite.h | 11 + libraries/ecore/src/tests/ecore_test_ecore.c | 367 ++ libraries/ecore/src/tests/ecore_test_ecore_con.c | 258 ++ libraries/ecore/src/tests/ecore_test_ecore_x.c | 56 + libraries/ecore/src/util/Makefile.am | 17 + libraries/ecore/src/util/Makefile.in | 734 ++++ libraries/ecore/src/util/makekeys.c | 326 ++ libraries/ecore/src/util/mkks.sh | 10 + 311 files changed, 155505 insertions(+) create mode 100644 libraries/ecore/src/Makefile.am create mode 100644 libraries/ecore/src/Makefile.in create mode 100644 libraries/ecore/src/bin/Makefile.am create mode 100644 libraries/ecore/src/bin/Makefile.in create mode 100644 libraries/ecore/src/bin/ecore_config.c create mode 100644 libraries/ecore/src/bin/ecore_test.c create mode 100644 libraries/ecore/src/examples/Makefile.am create mode 100644 libraries/ecore/src/examples/Makefile.in create mode 100644 libraries/ecore/src/examples/ecore_animator_example.c create mode 100644 libraries/ecore/src/examples/ecore_client_bench.c create mode 100644 libraries/ecore/src/examples/ecore_con_client_example.c create mode 100644 libraries/ecore/src/examples/ecore_con_client_simple_example.c create mode 100644 libraries/ecore/src/examples/ecore_con_lookup_example.c create mode 100644 libraries/ecore/src/examples/ecore_con_server_example.c create mode 100644 libraries/ecore/src/examples/ecore_con_server_http_example.c create mode 100644 libraries/ecore/src/examples/ecore_con_server_simple_example.c create mode 100644 libraries/ecore/src/examples/ecore_con_url_cookies_example.c create mode 100644 libraries/ecore/src/examples/ecore_con_url_download_example.c create mode 100644 libraries/ecore/src/examples/ecore_con_url_headers_example.c create mode 100644 libraries/ecore/src/examples/ecore_evas_basics_example.c create mode 100644 libraries/ecore/src/examples/ecore_evas_buffer_example_01.c create mode 100644 libraries/ecore/src/examples/ecore_evas_buffer_example_02.c create mode 100644 libraries/ecore/src/examples/ecore_evas_callbacks.c create mode 100644 libraries/ecore/src/examples/ecore_evas_ews_example.c create mode 100644 libraries/ecore/src/examples/ecore_evas_object_example.c create mode 100644 libraries/ecore/src/examples/ecore_evas_window_sizes_example.c create mode 100644 libraries/ecore/src/examples/ecore_event_example.c create mode 100644 libraries/ecore/src/examples/ecore_fd_handler_example.c create mode 100644 libraries/ecore/src/examples/ecore_fd_handler_gnutls_example.c create mode 100644 libraries/ecore/src/examples/ecore_file_download_example.c create mode 100644 libraries/ecore/src/examples/ecore_idler_example.c create mode 100644 libraries/ecore/src/examples/ecore_job_example.c create mode 100644 libraries/ecore/src/examples/ecore_pipe_gstreamer_example.c create mode 100644 libraries/ecore/src/examples/ecore_pipe_simple_example.c create mode 100644 libraries/ecore/src/examples/ecore_poller_example.c create mode 100644 libraries/ecore/src/examples/ecore_server_bench.c create mode 100644 libraries/ecore/src/examples/ecore_thread_example.c create mode 100644 libraries/ecore/src/examples/ecore_time_functions_example.c create mode 100644 libraries/ecore/src/examples/ecore_timer_example.c create mode 100644 libraries/ecore/src/examples/red.png create mode 100644 libraries/ecore/src/lib/Makefile.am create mode 100644 libraries/ecore/src/lib/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore/Ecore.h create mode 100644 libraries/ecore/src/lib/ecore/Ecore_Getopt.h create mode 100644 libraries/ecore/src/lib/ecore/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore/ecore.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_anim.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_app.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_events.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_exe.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_exe_ps3.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_exe_win32.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_exe_wince.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_getopt.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_glib.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_idle_enterer.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_idle_exiter.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_idler.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_job.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_main.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_pipe.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_poll.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_private.h create mode 100644 libraries/ecore/src/lib/ecore/ecore_signal.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_thread.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_throttle.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_time.c create mode 100644 libraries/ecore/src/lib/ecore/ecore_timer.c create mode 100644 libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa.h create mode 100644 libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h create mode 100644 libraries/ecore/src/lib/ecore_cocoa/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_cocoa/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa.m create mode 100644 libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa_private.h create mode 100644 libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa_window.m create mode 100644 libraries/ecore/src/lib/ecore_con/Ecore_Con.h create mode 100644 libraries/ecore/src/lib/ecore_con/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_con/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_con/ecore_con.c create mode 100644 libraries/ecore/src/lib/ecore_con/ecore_con_alloc.c create mode 100644 libraries/ecore/src/lib/ecore_con/ecore_con_ares.c create mode 100644 libraries/ecore/src/lib/ecore_con/ecore_con_info.c create mode 100644 libraries/ecore/src/lib/ecore_con/ecore_con_local.c create mode 100644 libraries/ecore/src/lib/ecore_con/ecore_con_local_win32.c create mode 100644 libraries/ecore/src/lib/ecore_con/ecore_con_private.h create mode 100644 libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c create mode 100644 libraries/ecore/src/lib/ecore_con/ecore_con_url.c create mode 100644 libraries/ecore/src/lib/ecore_config/Ecore_Config.h create mode 100644 libraries/ecore/src/lib/ecore_config/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_config/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_config/ecore_config.c create mode 100644 libraries/ecore/src/lib/ecore_config/ecore_config_db.c create mode 100644 libraries/ecore/src/lib/ecore_config/ecore_config_extra.c create mode 100644 libraries/ecore/src/lib/ecore_config/ecore_config_ipc.h create mode 100644 libraries/ecore/src/lib/ecore_config/ecore_config_ipc_ecore.c create mode 100644 libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c create mode 100644 libraries/ecore/src/lib/ecore_config/ecore_config_private.h create mode 100644 libraries/ecore/src/lib/ecore_config/ecore_config_storage.c create mode 100644 libraries/ecore/src/lib/ecore_config/ecore_config_util.c create mode 100644 libraries/ecore/src/lib/ecore_config/ecore_config_util.h create mode 100644 libraries/ecore/src/lib/ecore_directfb/Ecore_DirectFB.h create mode 100644 libraries/ecore/src/lib/ecore_directfb/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_directfb/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_directfb/ecore_directfb.c create mode 100644 libraries/ecore/src/lib/ecore_directfb/ecore_directfb_keys.h create mode 100644 libraries/ecore/src/lib/ecore_directfb/ecore_directfb_private.h create mode 100644 libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h create mode 100644 libraries/ecore/src/lib/ecore_evas/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_evas/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas.c create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c create mode 100644 libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c create mode 100644 libraries/ecore/src/lib/ecore_fb/Ecore_Fb.h create mode 100644 libraries/ecore/src/lib/ecore_fb/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_fb/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_fb/ecore_fb.c create mode 100644 libraries/ecore/src/lib/ecore_fb/ecore_fb_keytable.h create mode 100644 libraries/ecore/src/lib/ecore_fb/ecore_fb_li.c create mode 100644 libraries/ecore/src/lib/ecore_fb/ecore_fb_private.h create mode 100644 libraries/ecore/src/lib/ecore_fb/ecore_fb_ts.c create mode 100644 libraries/ecore/src/lib/ecore_fb/ecore_fb_vt.c create mode 100644 libraries/ecore/src/lib/ecore_file/Ecore_File.h create mode 100644 libraries/ecore/src/lib/ecore_file/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_file/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_file/ecore_file.c create mode 100644 libraries/ecore/src/lib/ecore_file/ecore_file_download.c create mode 100644 libraries/ecore/src/lib/ecore_file/ecore_file_monitor.c create mode 100644 libraries/ecore/src/lib/ecore_file/ecore_file_monitor_inotify.c create mode 100644 libraries/ecore/src/lib/ecore_file/ecore_file_monitor_poll.c create mode 100644 libraries/ecore/src/lib/ecore_file/ecore_file_monitor_win32.c create mode 100644 libraries/ecore/src/lib/ecore_file/ecore_file_path.c create mode 100644 libraries/ecore/src/lib/ecore_file/ecore_file_private.h create mode 100644 libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h create mode 100644 libraries/ecore/src/lib/ecore_imf/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_imf/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_imf/ecore_imf.c create mode 100644 libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c create mode 100644 libraries/ecore/src/lib/ecore_imf/ecore_imf_module.c create mode 100644 libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h create mode 100644 libraries/ecore/src/lib/ecore_imf_evas/Ecore_IMF_Evas.h create mode 100644 libraries/ecore/src/lib/ecore_imf_evas/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_imf_evas/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_imf_evas/ecore_imf_evas.c create mode 100644 libraries/ecore/src/lib/ecore_input/Ecore_Input.h create mode 100644 libraries/ecore/src/lib/ecore_input/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_input/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_input/ecore_input.c create mode 100644 libraries/ecore/src/lib/ecore_input/ecore_input_private.h create mode 100644 libraries/ecore/src/lib/ecore_input_evas/Ecore_Input_Evas.h create mode 100644 libraries/ecore/src/lib/ecore_input_evas/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_input_evas/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas.c create mode 100644 libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas_private.h create mode 100644 libraries/ecore/src/lib/ecore_ipc/Ecore_Ipc.h create mode 100644 libraries/ecore/src/lib/ecore_ipc/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_ipc/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c create mode 100644 libraries/ecore/src/lib/ecore_ipc/ecore_ipc_private.h create mode 100644 libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h create mode 100644 libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght_Keys.h create mode 100644 libraries/ecore/src/lib/ecore_psl1ght/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_psl1ght/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c create mode 100644 libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght_private.h create mode 100644 libraries/ecore/src/lib/ecore_psl1ght/moveutil.c create mode 100644 libraries/ecore/src/lib/ecore_psl1ght/spursutil.c create mode 100644 libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl.h create mode 100644 libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl_Keys.h create mode 100644 libraries/ecore/src/lib/ecore_sdl/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_sdl/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_sdl/ecore_sdl.c create mode 100644 libraries/ecore/src/lib/ecore_sdl/ecore_sdl_private.h create mode 100644 libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h create mode 100644 libraries/ecore/src/lib/ecore_win32/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_win32/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_win32/ecore_win32.c create mode 100644 libraries/ecore/src/lib/ecore_win32/ecore_win32_cursor.c create mode 100755 libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd.c create mode 100644 libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.cpp create mode 100644 libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.h create mode 100644 libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.cpp create mode 100644 libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.h create mode 100644 libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.cpp create mode 100644 libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.h create mode 100644 libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.cpp create mode 100644 libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.h create mode 100644 libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c create mode 100644 libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h create mode 100644 libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c create mode 100644 libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h create mode 100644 libraries/ecore/src/lib/ecore_wince/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_wince/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_wince/ecore_wince.c create mode 100644 libraries/ecore/src/lib/ecore_wince/ecore_wince_event.c create mode 100644 libraries/ecore/src/lib/ecore_wince/ecore_wince_private.h create mode 100644 libraries/ecore/src/lib/ecore_wince/ecore_wince_window.c create mode 100644 libraries/ecore/src/lib/ecore_x/Ecore_X.h create mode 100644 libraries/ecore/src/lib/ecore_x/Ecore_X_Atoms.h create mode 100644 libraries/ecore/src/lib/ecore_x/Ecore_X_Cursor.h create mode 100644 libraries/ecore/src/lib/ecore_x/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_x/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_x/ecore_x_atoms_decl.h create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_atoms.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_composite.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_cursor.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_damage.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dnd.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dpms.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_drawable.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_e.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_events.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_extensions.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gc.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gesture.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_image.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_input.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_keymap.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_mwm.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_pixmap.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_private.h create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_randr.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_region.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_render.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_selection.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_shape.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_sync.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_textlist.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_vsync.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_shadow.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_shape.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xinerama.c create mode 100644 libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xtest.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/Makefile.am create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/Makefile.in create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_image.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_private.h create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.h create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_region.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_screensaver.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_sync.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c create mode 100644 libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c create mode 100644 libraries/ecore/src/modules/Makefile.am create mode 100644 libraries/ecore/src/modules/Makefile.in create mode 100644 libraries/ecore/src/modules/immodules/Makefile.am create mode 100644 libraries/ecore/src/modules/immodules/Makefile.in create mode 100644 libraries/ecore/src/modules/immodules/xim/Makefile.am create mode 100644 libraries/ecore/src/modules/immodules/xim/Makefile.in create mode 100644 libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c create mode 100644 libraries/ecore/src/tests/Makefile.am create mode 100644 libraries/ecore/src/tests/Makefile.in create mode 100644 libraries/ecore/src/tests/ecore_suite.c create mode 100644 libraries/ecore/src/tests/ecore_suite.h create mode 100644 libraries/ecore/src/tests/ecore_test_ecore.c create mode 100644 libraries/ecore/src/tests/ecore_test_ecore_con.c create mode 100644 libraries/ecore/src/tests/ecore_test_ecore_x.c create mode 100644 libraries/ecore/src/util/Makefile.am create mode 100644 libraries/ecore/src/util/Makefile.in create mode 100644 libraries/ecore/src/util/makekeys.c create mode 100755 libraries/ecore/src/util/mkks.sh (limited to 'libraries/ecore/src') diff --git a/libraries/ecore/src/Makefile.am b/libraries/ecore/src/Makefile.am new file mode 100644 index 0000000..b8dab4f --- /dev/null +++ b/libraries/ecore/src/Makefile.am @@ -0,0 +1,26 @@ +MAINTAINERCLEANFILES = Makefile.in + +SUBDIRS = lib bin tests examples modules + +if BUILD_ECORE_X_XCB + MAINTAINERCLEANFILES += ecore_xcb_keysym_table.h ecore_xcb_keysym_table_h + CLEANFILES = ecore_xcb_keysym_table.h ecore_xcb_keysym_table_h + + SUBDIRS += util + + BUILT_SOURCES=ecore_xcb_keysym_table.h + + # + # Building ecore_xcb_keysym_table.h requires the makekeys utility + # + + ecore_xcb_keysym_table.h: $(KEYSYMDEFS) $(top_builddir)/src/util/makekeys$(EXEEXT) + $(top_builddir)/src/util/makekeys $(KEYSYMDEFS) > ecore_xcb_keysym_table_h + mv -f ecore_xcb_keysym_table_h ./lib/ecore_x/xcb/$@ + + $(top_builddir)/src/util/makekeys$(EXEEXT): force + cd util && $(MAKE) + + force: + +endif diff --git a/libraries/ecore/src/Makefile.in b/libraries/ecore/src/Makefile.in new file mode 100644 index 0000000..29b69db --- /dev/null +++ b/libraries/ecore/src/Makefile.in @@ -0,0 +1,818 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@BUILD_ECORE_X_XCB_TRUE@am__append_1 = ecore_xcb_keysym_table.h ecore_xcb_keysym_table_h +@BUILD_ECORE_X_XCB_TRUE@am__append_2 = util +subdir = src +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = lib bin tests examples modules util +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in $(am__append_1) +SUBDIRS = lib bin tests examples modules $(am__append_2) +@BUILD_ECORE_X_XCB_TRUE@CLEANFILES = ecore_xcb_keysym_table.h ecore_xcb_keysym_table_h +@BUILD_ECORE_X_XCB_TRUE@BUILT_SOURCES = ecore_xcb_keysym_table.h +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \ + ctags-recursive install install-am install-strip \ + tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + + +@BUILD_ECORE_X_XCB_TRUE@ # +@BUILD_ECORE_X_XCB_TRUE@ # Building ecore_xcb_keysym_table.h requires the makekeys utility +@BUILD_ECORE_X_XCB_TRUE@ # + +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_keysym_table.h: $(KEYSYMDEFS) $(top_builddir)/src/util/makekeys$(EXEEXT) +@BUILD_ECORE_X_XCB_TRUE@ $(top_builddir)/src/util/makekeys $(KEYSYMDEFS) > ecore_xcb_keysym_table_h +@BUILD_ECORE_X_XCB_TRUE@ mv -f ecore_xcb_keysym_table_h ./lib/ecore_x/xcb/$@ + +@BUILD_ECORE_X_XCB_TRUE@ $(top_builddir)/src/util/makekeys$(EXEEXT): force +@BUILD_ECORE_X_XCB_TRUE@ cd util && $(MAKE) + +@BUILD_ECORE_X_XCB_TRUE@ force: + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/bin/Makefile.am b/libraries/ecore/src/bin/Makefile.am new file mode 100644 index 0000000..79110e4 --- /dev/null +++ b/libraries/ecore/src/bin/Makefile.am @@ -0,0 +1,51 @@ +MAINTAINERCLEANFILES = Makefile.in + +if BUILD_ECORE_CONFIG +ECORE_CONFIG_PROG = ecore_config +ECORE_CONFIG_LIB = $(top_builddir)/src/lib/ecore_config/libecore_config.la +else +ECORE_CONFIG_PROG = +ECORE_CONFIG_LIB = +endif + +if EFL_ENABLE_TESTS +ECORE_TEST_PROG = ecore_test +endif + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_config \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_config \ +-DPACKAGE_BIN_DIR=\"$(bindir)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@EINA_CFLAGS@ @EVAS_CFLAGS@ + +bin_PROGRAMS = $(ECORE_CONFIG_PROG) $(ECORE_TEST_PROG) + +ecore_config_SOURCES = \ +ecore_config.c + +ecore_config_LDADD = \ +$(ECORE_CONFIG_LIB) \ +$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la \ +$(top_builddir)/src/lib/ecore_con/libecore_con.la \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EINA_LIBS@ @EVAS_LIBS@ + +ecore_config_DEPENDENCIES = \ +$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la \ +$(top_builddir)/src/lib/ecore_con/libecore_con.la \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(ECORE_CONFIG_LIB) + +ecore_test_SOURCES = \ +ecore_test.c + +ecore_test_LDADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EINA_LIBS@ @EVAS_LIBS@ + +ecore_test_DEPENDENCIES = \ +$(top_builddir)/src/lib/ecore/libecore.la diff --git a/libraries/ecore/src/bin/Makefile.in b/libraries/ecore/src/bin/Makefile.in new file mode 100644 index 0000000..387db21 --- /dev/null +++ b/libraries/ecore/src/bin/Makefile.in @@ -0,0 +1,808 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) +subdir = src/bin +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@BUILD_ECORE_CONFIG_TRUE@am__EXEEXT_1 = ecore_config$(EXEEXT) +@EFL_ENABLE_TESTS_TRUE@am__EXEEXT_2 = ecore_test$(EXEEXT) +am__installdirs = "$(DESTDIR)$(bindir)" +PROGRAMS = $(bin_PROGRAMS) +am_ecore_config_OBJECTS = ecore_config.$(OBJEXT) +ecore_config_OBJECTS = $(am_ecore_config_OBJECTS) +@BUILD_ECORE_CONFIG_TRUE@am__DEPENDENCIES_1 = $(top_builddir)/src/lib/ecore_config/libecore_config.la +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +am_ecore_test_OBJECTS = ecore_test.$(OBJEXT) +ecore_test_OBJECTS = $(am_ecore_test_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(ecore_config_SOURCES) $(ecore_test_SOURCES) +DIST_SOURCES = $(ecore_config_SOURCES) $(ecore_test_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +@BUILD_ECORE_CONFIG_FALSE@ECORE_CONFIG_PROG = +@BUILD_ECORE_CONFIG_TRUE@ECORE_CONFIG_PROG = ecore_config +@BUILD_ECORE_CONFIG_FALSE@ECORE_CONFIG_LIB = +@BUILD_ECORE_CONFIG_TRUE@ECORE_CONFIG_LIB = $(top_builddir)/src/lib/ecore_config/libecore_config.la +@EFL_ENABLE_TESTS_TRUE@ECORE_TEST_PROG = ecore_test +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_config \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_config \ +-DPACKAGE_BIN_DIR=\"$(bindir)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@EINA_CFLAGS@ @EVAS_CFLAGS@ + +ecore_config_SOURCES = \ +ecore_config.c + +ecore_config_LDADD = \ +$(ECORE_CONFIG_LIB) \ +$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la \ +$(top_builddir)/src/lib/ecore_con/libecore_con.la \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EINA_LIBS@ @EVAS_LIBS@ + +ecore_config_DEPENDENCIES = \ +$(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la \ +$(top_builddir)/src/lib/ecore_con/libecore_con.la \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(ECORE_CONFIG_LIB) + +ecore_test_SOURCES = \ +ecore_test.c + +ecore_test_LDADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EINA_LIBS@ @EVAS_LIBS@ + +ecore_test_DEPENDENCIES = \ +$(top_builddir)/src/lib/ecore/libecore.la + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/bin/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/bin/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-binPROGRAMS: $(bin_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-binPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(bindir)" && rm -f $$files + +clean-binPROGRAMS: + @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +ecore_config$(EXEEXT): $(ecore_config_OBJECTS) $(ecore_config_DEPENDENCIES) + @rm -f ecore_config$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_config_OBJECTS) $(ecore_config_LDADD) $(LIBS) +ecore_test$(EXEEXT): $(ecore_test_OBJECTS) $(ecore_test_DEPENDENCIES) + @rm -f ecore_test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_test_OBJECTS) $(ecore_test_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_test.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-binPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-binPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ + clean-generic clean-libtool ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-binPROGRAMS install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-binPROGRAMS + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/bin/ecore_config.c b/libraries/ecore/src/bin/ecore_config.c new file mode 100644 index 0000000..b4973d9 --- /dev/null +++ b/libraries/ecore/src/bin/ecore_config.c @@ -0,0 +1,324 @@ +#include "config.h" +#include "Ecore.h" + +#include +#include +#include + +#ifdef BUILD_ECORE_CONFIG +#include +#include +#include +#include "Ecore_Config.h" +#include "ecore_config_private.h" + +// strcmp for paths - for sorting folders before files +static int +pathcmp(const char *s1, const char *s2) +{ + char *s1d, *s2d; + + // strip common part of paths + while(*s1 && *s2 && *s1 == *s2) + { + s1++; + s2++; + } + + // handle /foo/bar/baz <> /foo/bar_baz properly + if (*s1 == '/' && *s2 != '/') return -1; + if (*s1 != '/' && *s2 == '/') return 1; + + // skip leading / + if (*s1 == '/') s1++; + if (*s2 == '/') s2++; + + // order folders before files + s1d = strchr(s1, '/'); + s2d = strchr(s2, '/'); + if (s1d && !s2d) return -1; + if (!s1d && s2d) return 1; + + return strcmp(s1, s2); +} + +static int +del(const char *key) +{ + Ecore_Config_Prop *e; + e = ecore_config_get(key); + if(!e) return -1; + + ecore_config_dst(e); + return 0; +} + +static int +get(const char *key) +{ + Ecore_Config_Prop *e; + char *temp = NULL; + + if (!(e = ecore_config_get(key))) + { + EINA_LOG_ERR("No such property"); + return -1; + } + + printf("%-10s", ecore_config_type_get(e)); + + switch (e->type) + { + case ECORE_CONFIG_NIL: + printf("\n"); + break; + case ECORE_CONFIG_INT: + printf("%ld\n", ecore_config_int_get(key)); + break; + case ECORE_CONFIG_BLN: + printf("%d\n", ecore_config_boolean_get(key)); + break; + case ECORE_CONFIG_FLT: + printf("%lf\n", ecore_config_float_get(key)); + break; + case ECORE_CONFIG_STR: + temp = ecore_config_string_get(key); + break; + case ECORE_CONFIG_RGB: + temp = ecore_config_argbstr_get(key); + break; + case ECORE_CONFIG_THM: + temp = ecore_config_theme_get(key); + break; + default: + EINA_LOG_ERR("Property has unrecognized type"); + return -1; + } + if(temp) + { + printf("\"%s\"\n", temp); + free(temp); + } + return 0; +} + +static int +list(const char *file) +{ + Ecore_Config_Prop *e; + Eina_List *keys = NULL; + char *key; + + e = __ecore_config_bundle_local->data; + + do + { + // don't show system settings + if( !(e->flags & ECORE_CONFIG_FLAG_SYSTEM) ) + keys = eina_list_append(keys, e->key); + } + while((e = e->next)); + keys = eina_list_sort(keys, -1, EINA_COMPARE_CB(pathcmp)); + + EINA_LIST_FREE(keys, key) + { + printf("%-28s\t", key); + get(key); + } + + return 0; +} + +static void +usage_and_exit(const char *prog, int ret, const char *msg) +{ + if (msg) fprintf(stderr, "%s\n\n", msg); + fprintf(stderr, "Usage: %s \n", prog); + fprintf(stderr, "Modify ecore_config files\n\n"); + fprintf(stderr, "Options:\n"); + fprintf(stderr, " -c, --file=FILE config file\n"); + fprintf(stderr, " -k, --key=KEY must be given for all commands except -a\n\n"); + fprintf(stderr, "Commands:\n"); + fprintf(stderr, " -a, --list get all keys\n"); + fprintf(stderr, " -g, --get get key\n"); + fprintf(stderr, " -d, --del delete key\n"); + fprintf(stderr, " -b, --bool=VALUE set boolean\n"); + fprintf(stderr, " -f, --float=VALUE set float\n"); + fprintf(stderr, " -i, --int=VALUE set integer\n"); + fprintf(stderr, " -r, --rgb=VALUE set RGBA\n"); + fprintf(stderr, " -s, --string=VALUE set string\n"); + fprintf(stderr, " -t, --theme=VALUE set theme\n\n"); + exit(ret); +} + +int +main(int argc, char * const argv[]) +{ + char *prog, *file, *key; + void *value = (void *)NULL; + char cmd = 's'; + int type = -1; + int ret = 0; + long i; + float f; + + file = key = prog = NULL; + eina_init(); + prog = strdup(argv[0]); + + if(argc < 4) + usage_and_exit(prog, 2, NULL); + + while(1) + { + static struct option long_options[] = { + {"file", 1, 0, 'c'}, + {"list", 0, 0, 'a'}, + {"get", 0, 0, 'g'}, + {"del", 0, 0, 'd'}, + {"bool", 1, 0, 'b'}, + {"float", 1, 0, 'f'}, + {"int", 1, 0, 'i'}, + {"rgb", 1, 0, 'r'}, + {"string", 1, 0, 's'}, + {"theme", 1, 0, 't'}, + {"key", 1, 0, 'k'}, + {0, 0, 0, 0} + }; + + ret = getopt_long(argc, argv, "c:agdb:f:i:r:s:t:k:", long_options, NULL); + if(ret == -1) + break; + + switch(ret) + { + case 'k': + key = strdup(optarg); + break; + case 'n': + if(value) + usage_and_exit(prog, 2, "too many commands"); + type = ECORE_CONFIG_NIL; + value = NULL; + break; + case 'b': + if(value) + usage_and_exit(prog, 2, "too many commands"); + type = ECORE_CONFIG_BLN; + i = atoi(optarg); + value = &i; + break; + case 'i': + if(value) + usage_and_exit(prog, 2, "too many commands"); + type = ECORE_CONFIG_INT; + i = atoi(optarg); + value = &i; + break; + case 'f': + if(value) + usage_and_exit(prog, 2, "too many commands"); + type = ECORE_CONFIG_FLT; + f = atof(optarg); + value = &f; + break; + case 'r': + if(value) + usage_and_exit(prog, 2, "too many commands"); + type = ECORE_CONFIG_RGB; + i = (long) strtoul( (*optarg == '#') ? (optarg + 1) : optarg, NULL, 16 ); + value = &i; + break; + case 's': + if(value) + usage_and_exit(prog, 2, "too many commands"); + type = ECORE_CONFIG_STR; + value = strdup(optarg); + break; + case 't': + if(value) + usage_and_exit(prog, 2, "too many commands"); + type = ECORE_CONFIG_THM; + value = strdup(optarg); + break; + case 'c': + if(file) + free(file); + file = strdup(optarg); + break; + case '?': + case ':': + return 1; + default: + cmd = ret; + break; + } + } + + if(cmd == 's' && type == -1) + usage_and_exit(prog, 2, "You need to specify a command!"); + + if(cmd != 'a' && !key) + usage_and_exit(prog, 2, "You need to specify key!"); + + if(ecore_config_init("econfig") != ECORE_CONFIG_ERR_SUCC) + { + EINA_LOG_ERR("Couldn't init ecore_config!"); + return 1; + } + + // Load configuration from file + ecore_config_file_load(file); + + ret = 0; + + // Execute command + switch (cmd) + { + case 's': + if (ecore_config_typed_set(key, value, type) != ECORE_CONFIG_ERR_SUCC) + { + fprintf(stderr, "Set failed for %s", key); + ret = 1; + } else { + ecore_config_file_save(file); + } + get(key); // display value after setting it + break; + case 'd': + if(del(key)) + { + fprintf(stderr, "Delete failed for %s", key); + ret = 1; + } else { + ecore_config_file_save(file); + } + break; + case 'g': + if (get(key)) ret = 1; + break; + case 'a': + if (list(file)) ret = 1; + break; + default: + EINA_LOG_ERR("Unhandled command '%c'", cmd); + } + + ecore_config_shutdown(); + + if(type == ECORE_CONFIG_STR || type == ECORE_CONFIG_THM) + free(value); + + if(file) + free(file); + eina_shutdown(); + return ret; +} +#else +int +main(int argc, const char **argv) +{ + printf("Ecore_config module not compiled. This program is empty.\n"); + return -1; +} +#endif diff --git a/libraries/ecore/src/bin/ecore_test.c b/libraries/ecore/src/bin/ecore_test.c new file mode 100644 index 0000000..851b2dd --- /dev/null +++ b/libraries/ecore/src/bin/ecore_test.c @@ -0,0 +1,109 @@ +#include "config.h" + +#include +#include +#include + +const char *called = NULL; + +static const char *idler_str = "idler"; +static const char *idle_enterer_str = "idler_enterer"; +static const char *idle_exiter_str = "idler_exiter"; +static const char *timer1_str = "timer 1"; +static const char *timer2_str = "timer 2"; +static const char *pipe_read_str = "pipe read"; + +int count; +Ecore_Pipe *the_pipe; + +Eina_Bool timer_one(void *data __UNUSED__) +{ + fprintf(stderr, "timer 1\n"); + assert(called == pipe_read_str); + called = timer1_str; + ecore_pipe_write(the_pipe, "b", 1); + + count++; + if (count == 10) + { + ecore_main_loop_quit(); + return EINA_FALSE; + } + + return EINA_TRUE; +} + +Eina_Bool timer_two(void *data __UNUSED__) +{ + fprintf(stderr, "timer 2\n"); + assert(called == timer1_str); + called = timer2_str; + + return EINA_TRUE; +} + +Eina_Bool idle_enterer_one(void *data __UNUSED__) +{ + fprintf(stderr, "idle enterer!\n"); + switch (count) + { + default: + assert(called == timer2_str); + break; + case 1: + assert(called == timer1_str); + break; + case 0: + assert(called == NULL); + } + called = idle_enterer_str; + return EINA_TRUE; +} + +Eina_Bool idler_one(void *data __UNUSED__) +{ + fprintf(stderr, "idler!\n"); + assert(called == idle_enterer_str); + called = idler_str; + if (count == 0) + ecore_timer_add(0.0, timer_two, NULL); + return EINA_TRUE; +} + +Eina_Bool idle_exiter_one(void *data __UNUSED__) +{ + fprintf(stderr, "idle exiter!\n"); + assert(called == idler_str); + called = idle_exiter_str; + return EINA_TRUE; +} + +void pipe_read(void *data __UNUSED__, void *buffer __UNUSED__, unsigned int nbyte __UNUSED__) +{ + fprintf(stderr, "pipe read\n"); + assert(called == idle_exiter_str); + called = pipe_read_str; +} + +int main(int argc __UNUSED__, char **argv __UNUSED__) +{ + assert(1 == ecore_init()); + + the_pipe = ecore_pipe_add(&pipe_read, NULL); + assert(the_pipe != NULL); + assert(EINA_TRUE == ecore_pipe_write(the_pipe, "a", 1)); + + assert(NULL != ecore_timer_add(0.0, timer_one, NULL)); + + assert(NULL != ecore_idle_enterer_add(&idle_enterer_one, NULL)); + assert(NULL != ecore_idler_add(&idler_one, NULL)); + assert(NULL != ecore_idle_exiter_add(&idle_exiter_one, NULL)); + + ecore_main_loop_begin(); + + /* glib main loop exits on an idle enterer */ + assert(called == idle_enterer_str); + + assert(0 == ecore_shutdown()); + return 0; +} diff --git a/libraries/ecore/src/examples/Makefile.am b/libraries/ecore/src/examples/Makefile.am new file mode 100644 index 0000000..63748a5 --- /dev/null +++ b/libraries/ecore/src/examples/Makefile.am @@ -0,0 +1,111 @@ +MAINTAINERCLEANFILES = Makefile.in + +pkglibdir = $(datadir)/$(PACKAGE)/examples + +filesdir = $(datadir)/$(PACKAGE)/examples +files_DATA = + +AM_CPPFLAGS = \ +-I. \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_evas \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_srcdir)/src/lib/ecore_con \ +-DPACKAGE_EXAMPLES_DIR=\"$(datadir)/$(PACKAGE)/examples\" \ +@GLIB_CFLAGS@ @EVIL_CFLAGS@ @EVAS_CFLAGS@ @EINA_CFLAGS@ @WIN32_CPPFLAGS@ @EFL_ECORE_BUILD@ + +ECOREBASELDADD = \ + $(top_builddir)/src/lib/ecore/libecore.la \ + $(top_builddir)/src/lib/ecore_evas/libecore_evas.la \ + @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @EVAS_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ @rt_libs@ -lm + + +LDADD = \ + $(ECOREBASELDADD) + +SRCS = \ + ecore_animator_example.c \ + ecore_fd_handler_example.c \ + ecore_poller_example.c \ + ecore_event_example.c \ + ecore_idler_example.c \ + ecore_timer_example.c \ + ecore_time_functions_example.c \ + ecore_job_example.c \ + ecore_con_lookup_example.c \ + ecore_con_url_headers_example.c \ + ecore_con_url_download_example.c \ + ecore_con_url_cookies_example.c \ + ecore_con_server_simple_example.c \ + ecore_con_server_http_example.c \ + ecore_con_client_simple_example.c \ + ecore_client_bench.c \ + ecore_server_bench.c \ + ecore_con_client_example.c \ + ecore_con_server_example.c \ + ecore_fd_handler_gnutls_example.c \ + ecore_file_download_example.c \ + ecore_pipe_simple_example.c \ + ecore_pipe_gstreamer_example.c \ + ecore_thread_example.c \ + ecore_evas_callbacks.c \ + ecore_evas_window_sizes_example.c \ + ecore_evas_object_example.c \ + ecore_evas_basics_example.c \ + ecore_evas_buffer_example_01.c \ + ecore_evas_buffer_example_02.c \ + ecore_evas_ews_example.c + +EXTRA_DIST = $(SRCS) \ + $(srcdir)/red.png + +pkglib_PROGRAMS = + +if EFL_INSTALL_EXAMPLES +files_DATA += $(SRCS) \ + $(srcdir)/red.png +endif + +if EFL_BUILD_EXAMPLES +pkglib_PROGRAMS += \ + ecore_animator_example \ + ecore_fd_handler_example \ + ecore_poller_example \ + ecore_event_example \ + ecore_idler_example \ + ecore_job_example \ + ecore_timer_example \ + ecore_time_functions_example \ + ecore_pipe_simple_example \ + ecore_con_lookup_example \ + ecore_con_url_headers_example \ + ecore_con_url_download_example \ + ecore_con_url_cookies_example \ + ecore_con_server_simple_example \ + ecore_con_server_http_example \ + ecore_con_client_simple_example \ + ecore_thread_example \ + ecore_evas_callbacks \ + ecore_evas_window_sizes_example \ + ecore_evas_object_example \ + ecore_evas_basics_example \ + ecore_evas_buffer_example_01 \ + ecore_evas_buffer_example_02 \ + ecore_evas_ews_example \ + ecore_client_bench \ + ecore_server_bench + +ecore_con_lookup_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_con_url_headers_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_con_url_download_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_con_url_cookies_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_con_server_simple_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_con_server_http_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_con_client_simple_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_evas_window_sizes_example_LDADD = $(ECOREBASELDADD) @EVAS_LIBS@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la +ecore_evas_buffer_example_01_LDADD = $(ECOREBASELDADD) @EVAS_LIBS@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la +ecore_evas_buffer_example_02_LDADD = $(ECOREBASELDADD) @EVAS_LIBS@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la +ecore_client_bench_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_server_bench_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la + +endif diff --git a/libraries/ecore/src/examples/Makefile.in b/libraries/ecore/src/examples/Makefile.in new file mode 100644 index 0000000..dc38e0d --- /dev/null +++ b/libraries/ecore/src/examples/Makefile.in @@ -0,0 +1,1192 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +pkglib_PROGRAMS = $(am__EXEEXT_1) +@EFL_INSTALL_EXAMPLES_TRUE@am__append_1 = $(SRCS) \ +@EFL_INSTALL_EXAMPLES_TRUE@ $(srcdir)/red.png + +@EFL_BUILD_EXAMPLES_TRUE@am__append_2 = \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_animator_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_fd_handler_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_poller_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_event_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_idler_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_job_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_timer_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_time_functions_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_pipe_simple_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_con_lookup_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_con_url_headers_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_con_url_download_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_con_url_cookies_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_con_server_simple_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_con_server_http_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_con_client_simple_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_thread_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_callbacks \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_window_sizes_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_object_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_basics_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_buffer_example_01 \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_buffer_example_02 \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_ews_example \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_client_bench \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_server_bench + +subdir = src/examples +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +@EFL_BUILD_EXAMPLES_TRUE@am__EXEEXT_1 = \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_animator_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_fd_handler_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_poller_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_event_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_idler_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_job_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_timer_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_time_functions_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_pipe_simple_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_con_lookup_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_con_url_headers_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_con_url_download_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_con_url_cookies_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_con_server_simple_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_con_server_http_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_con_client_simple_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_thread_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_callbacks$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_window_sizes_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_object_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_basics_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_buffer_example_01$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_buffer_example_02$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_evas_ews_example$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_client_bench$(EXEEXT) \ +@EFL_BUILD_EXAMPLES_TRUE@ ecore_server_bench$(EXEEXT) +am__installdirs = "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(filesdir)" +PROGRAMS = $(pkglib_PROGRAMS) +ecore_animator_example_SOURCES = ecore_animator_example.c +ecore_animator_example_OBJECTS = ecore_animator_example.$(OBJEXT) +ecore_animator_example_LDADD = $(LDADD) +am__DEPENDENCIES_1 = $(top_builddir)/src/lib/ecore/libecore.la \ + $(top_builddir)/src/lib/ecore_evas/libecore_evas.la +ecore_animator_example_DEPENDENCIES = $(am__DEPENDENCIES_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +ecore_client_bench_SOURCES = ecore_client_bench.c +ecore_client_bench_OBJECTS = ecore_client_bench.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@ecore_client_bench_DEPENDENCIES = \ +@EFL_BUILD_EXAMPLES_TRUE@ $(am__DEPENDENCIES_1) \ +@EFL_BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_con_client_simple_example_SOURCES = \ + ecore_con_client_simple_example.c +ecore_con_client_simple_example_OBJECTS = \ + ecore_con_client_simple_example.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@ecore_con_client_simple_example_DEPENDENCIES = \ +@EFL_BUILD_EXAMPLES_TRUE@ $(am__DEPENDENCIES_1) \ +@EFL_BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_con_lookup_example_SOURCES = ecore_con_lookup_example.c +ecore_con_lookup_example_OBJECTS = ecore_con_lookup_example.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@ecore_con_lookup_example_DEPENDENCIES = \ +@EFL_BUILD_EXAMPLES_TRUE@ $(am__DEPENDENCIES_1) \ +@EFL_BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_con_server_http_example_SOURCES = \ + ecore_con_server_http_example.c +ecore_con_server_http_example_OBJECTS = \ + ecore_con_server_http_example.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@ecore_con_server_http_example_DEPENDENCIES = \ +@EFL_BUILD_EXAMPLES_TRUE@ $(am__DEPENDENCIES_1) \ +@EFL_BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_con_server_simple_example_SOURCES = \ + ecore_con_server_simple_example.c +ecore_con_server_simple_example_OBJECTS = \ + ecore_con_server_simple_example.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@ecore_con_server_simple_example_DEPENDENCIES = \ +@EFL_BUILD_EXAMPLES_TRUE@ $(am__DEPENDENCIES_1) \ +@EFL_BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_con_url_cookies_example_SOURCES = \ + ecore_con_url_cookies_example.c +ecore_con_url_cookies_example_OBJECTS = \ + ecore_con_url_cookies_example.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@ecore_con_url_cookies_example_DEPENDENCIES = \ +@EFL_BUILD_EXAMPLES_TRUE@ $(am__DEPENDENCIES_1) \ +@EFL_BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_con_url_download_example_SOURCES = \ + ecore_con_url_download_example.c +ecore_con_url_download_example_OBJECTS = \ + ecore_con_url_download_example.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@ecore_con_url_download_example_DEPENDENCIES = \ +@EFL_BUILD_EXAMPLES_TRUE@ $(am__DEPENDENCIES_1) \ +@EFL_BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_con_url_headers_example_SOURCES = \ + ecore_con_url_headers_example.c +ecore_con_url_headers_example_OBJECTS = \ + ecore_con_url_headers_example.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@ecore_con_url_headers_example_DEPENDENCIES = \ +@EFL_BUILD_EXAMPLES_TRUE@ $(am__DEPENDENCIES_1) \ +@EFL_BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_evas_basics_example_SOURCES = ecore_evas_basics_example.c +ecore_evas_basics_example_OBJECTS = \ + ecore_evas_basics_example.$(OBJEXT) +ecore_evas_basics_example_LDADD = $(LDADD) +ecore_evas_basics_example_DEPENDENCIES = $(am__DEPENDENCIES_1) +ecore_evas_buffer_example_01_SOURCES = ecore_evas_buffer_example_01.c +ecore_evas_buffer_example_01_OBJECTS = \ + ecore_evas_buffer_example_01.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@ecore_evas_buffer_example_01_DEPENDENCIES = \ +@EFL_BUILD_EXAMPLES_TRUE@ $(am__DEPENDENCIES_1) \ +@EFL_BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la +ecore_evas_buffer_example_02_SOURCES = ecore_evas_buffer_example_02.c +ecore_evas_buffer_example_02_OBJECTS = \ + ecore_evas_buffer_example_02.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@ecore_evas_buffer_example_02_DEPENDENCIES = \ +@EFL_BUILD_EXAMPLES_TRUE@ $(am__DEPENDENCIES_1) \ +@EFL_BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la +ecore_evas_callbacks_SOURCES = ecore_evas_callbacks.c +ecore_evas_callbacks_OBJECTS = ecore_evas_callbacks.$(OBJEXT) +ecore_evas_callbacks_LDADD = $(LDADD) +ecore_evas_callbacks_DEPENDENCIES = $(am__DEPENDENCIES_1) +ecore_evas_ews_example_SOURCES = ecore_evas_ews_example.c +ecore_evas_ews_example_OBJECTS = ecore_evas_ews_example.$(OBJEXT) +ecore_evas_ews_example_LDADD = $(LDADD) +ecore_evas_ews_example_DEPENDENCIES = $(am__DEPENDENCIES_1) +ecore_evas_object_example_SOURCES = ecore_evas_object_example.c +ecore_evas_object_example_OBJECTS = \ + ecore_evas_object_example.$(OBJEXT) +ecore_evas_object_example_LDADD = $(LDADD) +ecore_evas_object_example_DEPENDENCIES = $(am__DEPENDENCIES_1) +ecore_evas_window_sizes_example_SOURCES = \ + ecore_evas_window_sizes_example.c +ecore_evas_window_sizes_example_OBJECTS = \ + ecore_evas_window_sizes_example.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@ecore_evas_window_sizes_example_DEPENDENCIES = \ +@EFL_BUILD_EXAMPLES_TRUE@ $(am__DEPENDENCIES_1) \ +@EFL_BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la +ecore_event_example_SOURCES = ecore_event_example.c +ecore_event_example_OBJECTS = ecore_event_example.$(OBJEXT) +ecore_event_example_LDADD = $(LDADD) +ecore_event_example_DEPENDENCIES = $(am__DEPENDENCIES_1) +ecore_fd_handler_example_SOURCES = ecore_fd_handler_example.c +ecore_fd_handler_example_OBJECTS = ecore_fd_handler_example.$(OBJEXT) +ecore_fd_handler_example_LDADD = $(LDADD) +ecore_fd_handler_example_DEPENDENCIES = $(am__DEPENDENCIES_1) +ecore_idler_example_SOURCES = ecore_idler_example.c +ecore_idler_example_OBJECTS = ecore_idler_example.$(OBJEXT) +ecore_idler_example_LDADD = $(LDADD) +ecore_idler_example_DEPENDENCIES = $(am__DEPENDENCIES_1) +ecore_job_example_SOURCES = ecore_job_example.c +ecore_job_example_OBJECTS = ecore_job_example.$(OBJEXT) +ecore_job_example_LDADD = $(LDADD) +ecore_job_example_DEPENDENCIES = $(am__DEPENDENCIES_1) +ecore_pipe_simple_example_SOURCES = ecore_pipe_simple_example.c +ecore_pipe_simple_example_OBJECTS = \ + ecore_pipe_simple_example.$(OBJEXT) +ecore_pipe_simple_example_LDADD = $(LDADD) +ecore_pipe_simple_example_DEPENDENCIES = $(am__DEPENDENCIES_1) +ecore_poller_example_SOURCES = ecore_poller_example.c +ecore_poller_example_OBJECTS = ecore_poller_example.$(OBJEXT) +ecore_poller_example_LDADD = $(LDADD) +ecore_poller_example_DEPENDENCIES = $(am__DEPENDENCIES_1) +ecore_server_bench_SOURCES = ecore_server_bench.c +ecore_server_bench_OBJECTS = ecore_server_bench.$(OBJEXT) +@EFL_BUILD_EXAMPLES_TRUE@ecore_server_bench_DEPENDENCIES = \ +@EFL_BUILD_EXAMPLES_TRUE@ $(am__DEPENDENCIES_1) \ +@EFL_BUILD_EXAMPLES_TRUE@ $(top_builddir)/src/lib/ecore_con/libecore_con.la +ecore_thread_example_SOURCES = ecore_thread_example.c +ecore_thread_example_OBJECTS = ecore_thread_example.$(OBJEXT) +ecore_thread_example_LDADD = $(LDADD) +ecore_thread_example_DEPENDENCIES = $(am__DEPENDENCIES_1) +ecore_time_functions_example_SOURCES = ecore_time_functions_example.c +ecore_time_functions_example_OBJECTS = \ + ecore_time_functions_example.$(OBJEXT) +ecore_time_functions_example_LDADD = $(LDADD) +ecore_time_functions_example_DEPENDENCIES = $(am__DEPENDENCIES_1) +ecore_timer_example_SOURCES = ecore_timer_example.c +ecore_timer_example_OBJECTS = ecore_timer_example.$(OBJEXT) +ecore_timer_example_LDADD = $(LDADD) +ecore_timer_example_DEPENDENCIES = $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = ecore_animator_example.c ecore_client_bench.c \ + ecore_con_client_simple_example.c ecore_con_lookup_example.c \ + ecore_con_server_http_example.c \ + ecore_con_server_simple_example.c \ + ecore_con_url_cookies_example.c \ + ecore_con_url_download_example.c \ + ecore_con_url_headers_example.c ecore_evas_basics_example.c \ + ecore_evas_buffer_example_01.c ecore_evas_buffer_example_02.c \ + ecore_evas_callbacks.c ecore_evas_ews_example.c \ + ecore_evas_object_example.c ecore_evas_window_sizes_example.c \ + ecore_event_example.c ecore_fd_handler_example.c \ + ecore_idler_example.c ecore_job_example.c \ + ecore_pipe_simple_example.c ecore_poller_example.c \ + ecore_server_bench.c ecore_thread_example.c \ + ecore_time_functions_example.c ecore_timer_example.c +DIST_SOURCES = ecore_animator_example.c ecore_client_bench.c \ + ecore_con_client_simple_example.c ecore_con_lookup_example.c \ + ecore_con_server_http_example.c \ + ecore_con_server_simple_example.c \ + ecore_con_url_cookies_example.c \ + ecore_con_url_download_example.c \ + ecore_con_url_headers_example.c ecore_evas_basics_example.c \ + ecore_evas_buffer_example_01.c ecore_evas_buffer_example_02.c \ + ecore_evas_callbacks.c ecore_evas_ews_example.c \ + ecore_evas_object_example.c ecore_evas_window_sizes_example.c \ + ecore_event_example.c ecore_fd_handler_example.c \ + ecore_idler_example.c ecore_job_example.c \ + ecore_pipe_simple_example.c ecore_poller_example.c \ + ecore_server_bench.c ecore_thread_example.c \ + ecore_time_functions_example.c ecore_timer_example.c +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +DATA = $(files_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +pkglibdir = $(datadir)/$(PACKAGE)/examples +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +filesdir = $(datadir)/$(PACKAGE)/examples +files_DATA = $(am__append_1) +AM_CPPFLAGS = \ +-I. \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_evas \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_srcdir)/src/lib/ecore_con \ +-DPACKAGE_EXAMPLES_DIR=\"$(datadir)/$(PACKAGE)/examples\" \ +@GLIB_CFLAGS@ @EVIL_CFLAGS@ @EVAS_CFLAGS@ @EINA_CFLAGS@ @WIN32_CPPFLAGS@ @EFL_ECORE_BUILD@ + +ECOREBASELDADD = \ + $(top_builddir)/src/lib/ecore/libecore.la \ + $(top_builddir)/src/lib/ecore_evas/libecore_evas.la \ + @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @EVAS_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ @rt_libs@ -lm + +LDADD = \ + $(ECOREBASELDADD) + +SRCS = \ + ecore_animator_example.c \ + ecore_fd_handler_example.c \ + ecore_poller_example.c \ + ecore_event_example.c \ + ecore_idler_example.c \ + ecore_timer_example.c \ + ecore_time_functions_example.c \ + ecore_job_example.c \ + ecore_con_lookup_example.c \ + ecore_con_url_headers_example.c \ + ecore_con_url_download_example.c \ + ecore_con_url_cookies_example.c \ + ecore_con_server_simple_example.c \ + ecore_con_server_http_example.c \ + ecore_con_client_simple_example.c \ + ecore_client_bench.c \ + ecore_server_bench.c \ + ecore_con_client_example.c \ + ecore_con_server_example.c \ + ecore_fd_handler_gnutls_example.c \ + ecore_file_download_example.c \ + ecore_pipe_simple_example.c \ + ecore_pipe_gstreamer_example.c \ + ecore_thread_example.c \ + ecore_evas_callbacks.c \ + ecore_evas_window_sizes_example.c \ + ecore_evas_object_example.c \ + ecore_evas_basics_example.c \ + ecore_evas_buffer_example_01.c \ + ecore_evas_buffer_example_02.c \ + ecore_evas_ews_example.c + +EXTRA_DIST = $(SRCS) \ + $(srcdir)/red.png + +@EFL_BUILD_EXAMPLES_TRUE@ecore_con_lookup_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +@EFL_BUILD_EXAMPLES_TRUE@ecore_con_url_headers_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +@EFL_BUILD_EXAMPLES_TRUE@ecore_con_url_download_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +@EFL_BUILD_EXAMPLES_TRUE@ecore_con_url_cookies_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +@EFL_BUILD_EXAMPLES_TRUE@ecore_con_server_simple_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +@EFL_BUILD_EXAMPLES_TRUE@ecore_con_server_http_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +@EFL_BUILD_EXAMPLES_TRUE@ecore_con_client_simple_example_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +@EFL_BUILD_EXAMPLES_TRUE@ecore_evas_window_sizes_example_LDADD = $(ECOREBASELDADD) @EVAS_LIBS@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la +@EFL_BUILD_EXAMPLES_TRUE@ecore_evas_buffer_example_01_LDADD = $(ECOREBASELDADD) @EVAS_LIBS@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la +@EFL_BUILD_EXAMPLES_TRUE@ecore_evas_buffer_example_02_LDADD = $(ECOREBASELDADD) @EVAS_LIBS@ $(top_builddir)/src/lib/ecore_evas/libecore_evas.la +@EFL_BUILD_EXAMPLES_TRUE@ecore_client_bench_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +@EFL_BUILD_EXAMPLES_TRUE@ecore_server_bench_LDADD = $(ECOREBASELDADD) $(top_builddir)/src/lib/ecore_con/libecore_con.la +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/examples/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/examples/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pkglibPROGRAMS: $(pkglib_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(pkglibdir)" || $(MKDIR_P) "$(DESTDIR)$(pkglibdir)" + @list='$(pkglib_PROGRAMS)'; test -n "$(pkglibdir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(pkglibdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(pkglibdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-pkglibPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(pkglib_PROGRAMS)'; test -n "$(pkglibdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(pkglibdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pkglibdir)" && rm -f $$files + +clean-pkglibPROGRAMS: + @list='$(pkglib_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +ecore_animator_example$(EXEEXT): $(ecore_animator_example_OBJECTS) $(ecore_animator_example_DEPENDENCIES) + @rm -f ecore_animator_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_animator_example_OBJECTS) $(ecore_animator_example_LDADD) $(LIBS) +ecore_client_bench$(EXEEXT): $(ecore_client_bench_OBJECTS) $(ecore_client_bench_DEPENDENCIES) + @rm -f ecore_client_bench$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_client_bench_OBJECTS) $(ecore_client_bench_LDADD) $(LIBS) +ecore_con_client_simple_example$(EXEEXT): $(ecore_con_client_simple_example_OBJECTS) $(ecore_con_client_simple_example_DEPENDENCIES) + @rm -f ecore_con_client_simple_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_con_client_simple_example_OBJECTS) $(ecore_con_client_simple_example_LDADD) $(LIBS) +ecore_con_lookup_example$(EXEEXT): $(ecore_con_lookup_example_OBJECTS) $(ecore_con_lookup_example_DEPENDENCIES) + @rm -f ecore_con_lookup_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_con_lookup_example_OBJECTS) $(ecore_con_lookup_example_LDADD) $(LIBS) +ecore_con_server_http_example$(EXEEXT): $(ecore_con_server_http_example_OBJECTS) $(ecore_con_server_http_example_DEPENDENCIES) + @rm -f ecore_con_server_http_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_con_server_http_example_OBJECTS) $(ecore_con_server_http_example_LDADD) $(LIBS) +ecore_con_server_simple_example$(EXEEXT): $(ecore_con_server_simple_example_OBJECTS) $(ecore_con_server_simple_example_DEPENDENCIES) + @rm -f ecore_con_server_simple_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_con_server_simple_example_OBJECTS) $(ecore_con_server_simple_example_LDADD) $(LIBS) +ecore_con_url_cookies_example$(EXEEXT): $(ecore_con_url_cookies_example_OBJECTS) $(ecore_con_url_cookies_example_DEPENDENCIES) + @rm -f ecore_con_url_cookies_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_con_url_cookies_example_OBJECTS) $(ecore_con_url_cookies_example_LDADD) $(LIBS) +ecore_con_url_download_example$(EXEEXT): $(ecore_con_url_download_example_OBJECTS) $(ecore_con_url_download_example_DEPENDENCIES) + @rm -f ecore_con_url_download_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_con_url_download_example_OBJECTS) $(ecore_con_url_download_example_LDADD) $(LIBS) +ecore_con_url_headers_example$(EXEEXT): $(ecore_con_url_headers_example_OBJECTS) $(ecore_con_url_headers_example_DEPENDENCIES) + @rm -f ecore_con_url_headers_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_con_url_headers_example_OBJECTS) $(ecore_con_url_headers_example_LDADD) $(LIBS) +ecore_evas_basics_example$(EXEEXT): $(ecore_evas_basics_example_OBJECTS) $(ecore_evas_basics_example_DEPENDENCIES) + @rm -f ecore_evas_basics_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_evas_basics_example_OBJECTS) $(ecore_evas_basics_example_LDADD) $(LIBS) +ecore_evas_buffer_example_01$(EXEEXT): $(ecore_evas_buffer_example_01_OBJECTS) $(ecore_evas_buffer_example_01_DEPENDENCIES) + @rm -f ecore_evas_buffer_example_01$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_evas_buffer_example_01_OBJECTS) $(ecore_evas_buffer_example_01_LDADD) $(LIBS) +ecore_evas_buffer_example_02$(EXEEXT): $(ecore_evas_buffer_example_02_OBJECTS) $(ecore_evas_buffer_example_02_DEPENDENCIES) + @rm -f ecore_evas_buffer_example_02$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_evas_buffer_example_02_OBJECTS) $(ecore_evas_buffer_example_02_LDADD) $(LIBS) +ecore_evas_callbacks$(EXEEXT): $(ecore_evas_callbacks_OBJECTS) $(ecore_evas_callbacks_DEPENDENCIES) + @rm -f ecore_evas_callbacks$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_evas_callbacks_OBJECTS) $(ecore_evas_callbacks_LDADD) $(LIBS) +ecore_evas_ews_example$(EXEEXT): $(ecore_evas_ews_example_OBJECTS) $(ecore_evas_ews_example_DEPENDENCIES) + @rm -f ecore_evas_ews_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_evas_ews_example_OBJECTS) $(ecore_evas_ews_example_LDADD) $(LIBS) +ecore_evas_object_example$(EXEEXT): $(ecore_evas_object_example_OBJECTS) $(ecore_evas_object_example_DEPENDENCIES) + @rm -f ecore_evas_object_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_evas_object_example_OBJECTS) $(ecore_evas_object_example_LDADD) $(LIBS) +ecore_evas_window_sizes_example$(EXEEXT): $(ecore_evas_window_sizes_example_OBJECTS) $(ecore_evas_window_sizes_example_DEPENDENCIES) + @rm -f ecore_evas_window_sizes_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_evas_window_sizes_example_OBJECTS) $(ecore_evas_window_sizes_example_LDADD) $(LIBS) +ecore_event_example$(EXEEXT): $(ecore_event_example_OBJECTS) $(ecore_event_example_DEPENDENCIES) + @rm -f ecore_event_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_event_example_OBJECTS) $(ecore_event_example_LDADD) $(LIBS) +ecore_fd_handler_example$(EXEEXT): $(ecore_fd_handler_example_OBJECTS) $(ecore_fd_handler_example_DEPENDENCIES) + @rm -f ecore_fd_handler_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_fd_handler_example_OBJECTS) $(ecore_fd_handler_example_LDADD) $(LIBS) +ecore_idler_example$(EXEEXT): $(ecore_idler_example_OBJECTS) $(ecore_idler_example_DEPENDENCIES) + @rm -f ecore_idler_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_idler_example_OBJECTS) $(ecore_idler_example_LDADD) $(LIBS) +ecore_job_example$(EXEEXT): $(ecore_job_example_OBJECTS) $(ecore_job_example_DEPENDENCIES) + @rm -f ecore_job_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_job_example_OBJECTS) $(ecore_job_example_LDADD) $(LIBS) +ecore_pipe_simple_example$(EXEEXT): $(ecore_pipe_simple_example_OBJECTS) $(ecore_pipe_simple_example_DEPENDENCIES) + @rm -f ecore_pipe_simple_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_pipe_simple_example_OBJECTS) $(ecore_pipe_simple_example_LDADD) $(LIBS) +ecore_poller_example$(EXEEXT): $(ecore_poller_example_OBJECTS) $(ecore_poller_example_DEPENDENCIES) + @rm -f ecore_poller_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_poller_example_OBJECTS) $(ecore_poller_example_LDADD) $(LIBS) +ecore_server_bench$(EXEEXT): $(ecore_server_bench_OBJECTS) $(ecore_server_bench_DEPENDENCIES) + @rm -f ecore_server_bench$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_server_bench_OBJECTS) $(ecore_server_bench_LDADD) $(LIBS) +ecore_thread_example$(EXEEXT): $(ecore_thread_example_OBJECTS) $(ecore_thread_example_DEPENDENCIES) + @rm -f ecore_thread_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_thread_example_OBJECTS) $(ecore_thread_example_LDADD) $(LIBS) +ecore_time_functions_example$(EXEEXT): $(ecore_time_functions_example_OBJECTS) $(ecore_time_functions_example_DEPENDENCIES) + @rm -f ecore_time_functions_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_time_functions_example_OBJECTS) $(ecore_time_functions_example_LDADD) $(LIBS) +ecore_timer_example$(EXEEXT): $(ecore_timer_example_OBJECTS) $(ecore_timer_example_DEPENDENCIES) + @rm -f ecore_timer_example$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_timer_example_OBJECTS) $(ecore_timer_example_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_animator_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_client_bench.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_con_client_simple_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_con_lookup_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_con_server_http_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_con_server_simple_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_con_url_cookies_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_con_url_download_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_con_url_headers_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_basics_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_buffer_example_01.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_buffer_example_02.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_callbacks.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_ews_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_object_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_window_sizes_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_event_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_fd_handler_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_idler_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_job_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_pipe_simple_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_poller_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_server_bench.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_thread_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_time_functions_example.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_timer_example.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-filesDATA: $(files_DATA) + @$(NORMAL_INSTALL) + test -z "$(filesdir)" || $(MKDIR_P) "$(DESTDIR)$(filesdir)" + @list='$(files_DATA)'; test -n "$(filesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(filesdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(filesdir)" || exit $$?; \ + done + +uninstall-filesDATA: + @$(NORMAL_UNINSTALL) + @list='$(files_DATA)'; test -n "$(filesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(filesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(filesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(pkglibdir)" "$(DESTDIR)$(filesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pkglibPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-filesDATA + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-pkglibPROGRAMS + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-filesDATA uninstall-pkglibPROGRAMS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pkglibPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-filesDATA \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-pkglibPROGRAMS \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-filesDATA \ + uninstall-pkglibPROGRAMS + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/examples/ecore_animator_example.c b/libraries/ecore/src/examples/ecore_animator_example.c new file mode 100644 index 0000000..6352f20 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_animator_example.c @@ -0,0 +1,116 @@ +//Compile with: +//gcc -g -Wall `pkg-config --cflags --libs ecore-evas` -o ecore_animator_example ecore_animator_example.c + +#include +#include + +static Eina_Bool _advance_frame(void *data, double pos); +static Eina_Bool _advance_frame2(void *data, double pos); +static Eina_Bool _advance_frame3(void *data); +static Eina_Bool _start_second_anim(void *data); +static Eina_Bool _freeze_third_anim(void *data); +static Eina_Bool _thaw_third_anim(void *data); + +int +main (int argc, char *argv[]) +{ + Evas_Object *rect, *bg, *rect2; + Ecore_Evas *ee; + Evas *evas; + Ecore_Animator *anim; + + ecore_evas_init(); + + ee = ecore_evas_new(NULL, 0, 0, 300, 400, NULL); + ecore_evas_show(ee); + evas = ecore_evas_get(ee); + + bg = evas_object_rectangle_add(evas); + evas_object_resize(bg, 300, 400); + evas_object_show(bg); + + rect = evas_object_rectangle_add(evas); + evas_object_color_set(rect, 0, 0, 255, 255); + evas_object_resize(rect, 50, 50); + evas_object_show(rect); + + rect2 = evas_object_rectangle_add(evas); + evas_object_color_set(rect2, 0, 55, 0, 255); + evas_object_resize(rect2, 50, 50); + evas_object_show(rect2); + + ecore_animator_frametime_set(1./50); + ecore_animator_timeline_add(5, _advance_frame, rect); + + anim = ecore_animator_add(_advance_frame3, rect2); + + ecore_timer_add(10, _start_second_anim, rect); + ecore_timer_add(5, _freeze_third_anim, anim); + ecore_timer_add(10, _thaw_third_anim, anim); + ecore_main_loop_begin(); + + evas_object_del(rect); + ecore_evas_free(ee); + ecore_animator_del(anim); + ecore_evas_shutdown(); + + return 0; +} + +static Eina_Bool +_advance_frame(void *data, double pos) +{ + double frame = pos; + frame = ecore_animator_pos_map(pos, ECORE_POS_MAP_SPRING, 1.2, 15); + + evas_object_resize(data, 50 * (1 + frame), 50 * (1 + frame)); + evas_object_move(data, 100 * frame, 100 * frame); + evas_object_color_set(data, 255 * frame, 0, 255 * (1 - frame), 255); + return EINA_TRUE; +} + +static Eina_Bool +_start_second_anim(void *data) +{ + ecore_animator_frametime_set(1./10); + ecore_animator_timeline_add(20, _advance_frame2, data); + return EINA_FALSE; +} + +static Eina_Bool +_advance_frame2(void *data, double pos) +{ + double frame = pos; + frame = ecore_animator_pos_map(pos, ECORE_POS_MAP_BOUNCE, 1.2, 50); + + evas_object_resize(data, 100 - (50 * frame), 100 - (50 * frame)); + evas_object_move(data, 100 * (1 - frame), 100 * (1 - frame)); + evas_object_color_set(data, 255 * (1 - frame), 0, 255 * frame, 255); + return EINA_TRUE; +} + +static Eina_Bool +_advance_frame3(void *data) +{ + static int x = 0; + + if(x >= 250) + x = 0; + evas_object_move(data, ++x, 350); + + return EINA_TRUE; +} + +static Eina_Bool +_freeze_third_anim(void *data) +{ + ecore_animator_freeze(data); + return EINA_FALSE; +} + +static Eina_Bool +_thaw_third_anim(void *data) +{ + ecore_animator_thaw(data); + return EINA_FALSE; +} diff --git a/libraries/ecore/src/examples/ecore_client_bench.c b/libraries/ecore/src/examples/ecore_client_bench.c new file mode 100644 index 0000000..2a58dcf --- /dev/null +++ b/libraries/ecore/src/examples/ecore_client_bench.c @@ -0,0 +1,77 @@ +#include +#include +#include + +/* Ecore_Con client example + * 2010 Mike Blumenkrantz + */ + +#define NUM_CLIENTS 30000 + +static Eina_Counter *counter; +static int add = 0; +static int del = 0; + +Eina_Bool +_add(void *data, int type, Ecore_Con_Event_Server_Add *ev) +{ + ++add; + printf("Connection #%i!\n", add); + if (add == NUM_CLIENTS) + ecore_main_loop_quit(); + + return ECORE_CALLBACK_RENEW; +} + +Eina_Bool +_del(void *data, int type, Ecore_Con_Event_Server_Add *ev) +{ + ++del; + printf("Connection lost! #%i!\n", del); + + return ECORE_CALLBACK_RENEW; +} + +static void +_spawn(void *data) +{ + int x; + + for (x = 0; x < NUM_CLIENTS; x++) + { +// printf("Creating connection %i\n", x); + if (!ecore_con_server_connect(ECORE_CON_REMOTE_NODELAY, "127.0.0.1", 8080, NULL)) + { + printf("CRITICAL ERROR!\n" + "Could not create connection #%i!\n", x); + exit(1); + } + } + printf("***Job done***\n"); +} + +int main(void) +{ + double done; + eina_init(); + ecore_init(); + ecore_con_init(); + + eina_log_domain_level_set("ecore_con", EINA_LOG_LEVEL_ERR); + eina_log_domain_level_set("eina", EINA_LOG_LEVEL_ERR); + counter = eina_counter_new("client"); + eina_counter_start(counter); + done = ecore_time_get(); + + ecore_job_add(_spawn, NULL); + +/* set event handler for server connect */ + ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_add, NULL); + ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_del, NULL); + +/* start client */ + ecore_main_loop_begin(); + eina_counter_stop(counter, 1); + printf("\nTime elapsed for %i connections: %f seconds\n%s", NUM_CLIENTS, ecore_time_get() - done, eina_counter_dump(counter)); + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_con_client_example.c b/libraries/ecore/src/examples/ecore_con_client_example.c new file mode 100644 index 0000000..2f656c7 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_con_client_example.c @@ -0,0 +1,90 @@ +#include +#include +#include + +/* Ecore_Con client example + * 2010 Mike Blumenkrantz + */ + +/* comment if not using gnutls */ +static void +tls_log_func(int level, const char *str) +{ + fprintf(stderr, "|<%d>| %s", level, str); +} + +Eina_Bool +_add(void *data, int type, Ecore_Con_Event_Server_Add *ev) +{ + printf("Server with ip %s connected!\n", ecore_con_server_ip_get(ev->server)); + ecore_con_server_send(ev->server, "hello!", 6); + ecore_con_server_flush(ev->server); + + return ECORE_CALLBACK_RENEW; +} + + +Eina_Bool +_del(void *data, int type, Ecore_Con_Event_Server_Del *ev) +{ + printf("Lost server with ip %s!\n", ecore_con_server_ip_get(ev->server)); + ecore_main_loop_quit(); + return ECORE_CALLBACK_RENEW; +} + +Eina_Bool +_data(void *data, int type, Ecore_Con_Event_Server_Data *ev) +{ + char fmt[128]; + + snprintf(fmt, sizeof(fmt), + "Received %i bytes from server:\n" + ">>>>>\n" + "%%.%is\n" + ">>>>>\n", + ev->size, ev->size); + + printf(fmt, ev->data); + return ECORE_CALLBACK_RENEW; +} +int main() +{ + Ecore_Con_Server *svr; + Eina_Iterator *it; + const char *ca; + + eina_init(); + ecore_init(); + ecore_con_init(); + +/* comment if not using gnutls */ + gnutls_global_set_log_level(9); + gnutls_global_set_log_function(tls_log_func); + + if (!(it = eina_file_ls("/etc/ssl/certs"))) + exit(1); + + if (!(svr = ecore_con_server_connect(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_MIXED, "www.verisign.com", 443, NULL))) + exit(1); + + /* add all the CAs */ + EINA_ITERATOR_FOREACH(it, ca) + { + if (!ecore_con_ssl_server_cafile_add(svr, ca)) + printf("Could not load CA: %s!\n", ca); + eina_stringshare_del(ca); + } + + eina_iterator_free(it); + ecore_con_ssl_server_verify(svr); + +/* set event handler for server connect */ + ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_add, NULL); +/* set event handler for server disconnect */ + ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb)_del, NULL); +/* set event handler for receiving server data */ + ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, (Ecore_Event_Handler_Cb)_data, NULL); + +/* start client */ + ecore_main_loop_begin(); +} diff --git a/libraries/ecore/src/examples/ecore_con_client_simple_example.c b/libraries/ecore/src/examples/ecore_con_client_simple_example.c new file mode 100644 index 0000000..f6eb257 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_con_client_simple_example.c @@ -0,0 +1,124 @@ +#include +#include +#include + +#ifdef HAVE_CONFIG_H +# include "config.h" +#else +# define __UNUSED__ +#endif + +struct _Server { + int sdata; +}; + +Eina_Bool +_add(void *data __UNUSED__, int type __UNUSED__, Ecore_Con_Event_Server_Add *ev) +{ + char welcome[] = "hello! - sent from the client"; + struct _Server *server = malloc(sizeof(*server)); + server->sdata = 0; + + ecore_con_server_data_set(ev->server, server); + printf("Server with ip %s, name %s, port %d, connected = %d!\n", + ecore_con_server_ip_get(ev->server), + ecore_con_server_name_get(ev->server), + ecore_con_server_port_get(ev->server), + ecore_con_server_connected_get(ev->server)); + ecore_con_server_send(ev->server, welcome, sizeof(welcome)); + ecore_con_server_flush(ev->server); + + return ECORE_CALLBACK_RENEW; +} + + +Eina_Bool +_del(void *data __UNUSED__, int type __UNUSED__, Ecore_Con_Event_Server_Del *ev) +{ + if (!ev->server) + { + printf("Failed to establish connection to the server.\nExiting.\n"); + ecore_main_loop_quit(); + return ECORE_CALLBACK_RENEW; + } + + struct _Server *server = ecore_con_server_data_get(ev->server); + + printf("Lost server with ip %s!\n", ecore_con_server_ip_get(ev->server)); + + if (server) + { + printf("Total data received from this server: %d\n", server->sdata); + free(server); + } + + ecore_con_server_del(ev->server); + + ecore_main_loop_quit(); + return ECORE_CALLBACK_RENEW; +} + +Eina_Bool +_data(void *data __UNUSED__, int type __UNUSED__, Ecore_Con_Event_Server_Data *ev) +{ + char fmt[128]; + struct _Server *server = ecore_con_server_data_get(ev->server); + + snprintf(fmt, sizeof(fmt), + "Received %i bytes from server:\n" + ">>>>>\n" + "%%.%is\n" + ">>>>>\n", + ev->size, ev->size); + + printf(fmt, ev->data); + + server->sdata += ev->size; + return ECORE_CALLBACK_RENEW; +} + +int main(int argc, const char *argv[]) +{ + Ecore_Con_Server *svr; + const char *address; + int port = 8080; + + if (argc < 2) + { + printf("wrong usage. Command syntax is:\n"); + printf("\tecore_con_client_simple_example
[port]\n"); + exit (1); + } + + address = argv[1]; + + if (argc > 2) + port = atoi(argv[2]); + + eina_init(); + ecore_init(); + ecore_con_init(); + + if (!(svr = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, address, port, NULL))) + { + printf("could not connect to the server: %s, port %d.\n", + address, port); + exit(2); + } + + /* set event handler for server connect */ + ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, (Ecore_Event_Handler_Cb)_add, NULL); + /* set event handler for server disconnect */ + ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, (Ecore_Event_Handler_Cb)_del, NULL); + /* set event handler for receiving server data */ + ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, (Ecore_Event_Handler_Cb)_data, NULL); + + /* start client */ + ecore_main_loop_begin(); + + ecore_con_init(); + ecore_init(); + eina_init(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_con_lookup_example.c b/libraries/ecore/src/examples/ecore_con_lookup_example.c new file mode 100644 index 0000000..3a3d024 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_con_lookup_example.c @@ -0,0 +1,38 @@ +#include +#include +#include + +static void +_lookup_done_cb(const char *canonname, const char *ip, struct sockaddr *addr, int addrlen, void *data) +{ + printf("canonname = %s\n", canonname); + printf("ip = %s\n", ip); + printf("addr = %p\n", addr); + printf("addrlen = %d\n", addrlen); +} + +int main(int argc, const char *argv[]) +{ + if (argc < 2) + { + printf("need one parameter:
\n"); + return -1; + } + + ecore_init(); + ecore_con_init(); + + if (!ecore_con_lookup(argv[1], _lookup_done_cb, NULL)) + { + printf("error when trying to start lookup for %s\n", argv[1]); + goto end; + } + + ecore_main_loop_begin(); + +end: + ecore_con_shutdown(); + ecore_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_con_server_example.c b/libraries/ecore/src/examples/ecore_con_server_example.c new file mode 100644 index 0000000..5423eb1 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_con_server_example.c @@ -0,0 +1,81 @@ +#include +#include +#include + +/* Ecore_Con server example + * 2010 Mike Blumenkrantz + */ + +/* comment if not using gnutls */ +static void +tls_log_func(int level, const char *str) +{ + fprintf(stderr, "|<%d>| %s", level, str); +} + +Eina_Bool +_add(void *data, int type, Ecore_Con_Event_Client_Add *ev) +{ + printf("Client with ip %s connected!\n", ecore_con_client_ip_get(ev->client)); + ecore_con_client_send(ev->client, "hello!", 6); +// ecore_con_client_flush(ev->client); + ecore_con_client_timeout_set(ev->client, 5); + + return ECORE_CALLBACK_RENEW; +} + + +Eina_Bool +_del(void *data, int type, Ecore_Con_Event_Client_Del *ev) +{ + printf("Lost client with ip %s!\n", ecore_con_client_ip_get(ev->client)); + ecore_main_loop_quit(); + return ECORE_CALLBACK_RENEW; +} + +Eina_Bool +_data(void *data, int type, Ecore_Con_Event_Client_Data *ev) +{ + char fmt[128]; + + snprintf(fmt, sizeof(fmt), + "Received %i bytes from client:\n" + ">>>>>\n" + "%%.%is\n" + ">>>>>\n", + ev->size, ev->size); + + printf(fmt, ev->data); + return ECORE_CALLBACK_RENEW; +} +int main() +{ + Ecore_Con_Server *svr; + eina_init(); + ecore_init(); + ecore_con_init(); + +/* comment if not using gnutls */ + gnutls_global_set_log_level(9); + gnutls_global_set_log_function(tls_log_func); + + +/* to use a PEM certificate with TLS and SSL3, uncomment the lines below */ + if (!(svr = ecore_con_server_add(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_TLS | ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT, "127.0.0.1", 8080, NULL))) + +/* to use simple tcp with ssl/tls, use this line */ +// if (!ecore_con_server_add(ECORE_CON_REMOTE_TCP | ECORE_CON_USE_SSL3, "127.0.0.1", 8080, NULL)) + exit(1); + + ecore_con_ssl_server_cert_add(svr, "server.pem"); + ecore_con_ssl_server_privkey_add(svr, "server.pem"); +/* set event handler for client connect */ + ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb)_add, NULL); +/* set event handler for client disconnect */ + ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb)_del, NULL); +/* set event handler for receiving client data */ + ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb)_data, NULL); + +/* start server */ + ecore_main_loop_begin(); +} diff --git a/libraries/ecore/src/examples/ecore_con_server_http_example.c b/libraries/ecore/src/examples/ecore_con_server_http_example.c new file mode 100644 index 0000000..d3fdeee --- /dev/null +++ b/libraries/ecore/src/examples/ecore_con_server_http_example.c @@ -0,0 +1,135 @@ +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +# include "config.h" +#else +# define __UNUSED__ +#endif + +static const char response_template[] = +"HTTP/1.0 200 OK\r\n" +"Server: Ecore_Con custom server\r\n" +"Content-Length: %zd\r\n" +"Content-Type: text/html; charset=UTF-8\r\n" +"Set-Cookie: MYCOOKIE=1; path=/; expires=%s\r\n" +"Set-Cookie: SESSIONCOOKIE=1; path=/\r\n" +"\r\n" +"%s"; + +struct _Client { + int sdata; +}; + +Eina_Bool +_add(void *data __UNUSED__, int type __UNUSED__, Ecore_Con_Event_Client_Add *ev) +{ + struct _Client *client = malloc(sizeof(*client)); + client->sdata = 0; + static char buf[4096]; + char welcome[] = "Welcome to Ecore_Con server!"; + time_t t; + + printf("Client with ip %s, port %d, connected = %d!\n", + ecore_con_client_ip_get(ev->client), + ecore_con_client_port_get(ev->client), + ecore_con_client_connected_get(ev->client)); + + ecore_con_client_data_set(ev->client, client); + + t = time(NULL); + t += 60 * 60 * 24; + snprintf(buf, sizeof(buf), response_template, sizeof(welcome) - 1, ctime(&t), welcome); + + ecore_con_client_send(ev->client, buf, strlen(buf)); + ecore_con_client_flush(ev->client); + + + return ECORE_CALLBACK_RENEW; +} + + +Eina_Bool +_del(void *data __UNUSED__, int type __UNUSED__, Ecore_Con_Event_Client_Del *ev) +{ + struct _Client *client; + + if (!ev->client) + return ECORE_CALLBACK_RENEW; + + client = ecore_con_client_data_get(ev->client); + + printf("Lost client with ip %s!\n", ecore_con_client_ip_get(ev->client)); + printf("Total data received from this client: %d\n", client->sdata); + printf("Client was connected for %0.3f seconds.\n", + ecore_con_client_uptime_get(ev->client)); + + if (client) + free(client); + + ecore_con_client_del(ev->client); + + return ECORE_CALLBACK_RENEW; +} + +Eina_Bool +_data(void *data __UNUSED__, int type __UNUSED__, Ecore_Con_Event_Client_Data *ev) +{ + char fmt[128]; + struct _Client *client = ecore_con_client_data_get(ev->client); + + snprintf(fmt, sizeof(fmt), + "\nReceived %i bytes from client %s port %d:\n" + ">>>>>\n" + "%%.%is\n" + ">>>>>\n\n", + ev->size, ecore_con_client_ip_get(ev->client), + ecore_con_client_port_get(ev->client), ev->size); + + printf(fmt, ev->data); + + client->sdata += ev->size; + + return ECORE_CALLBACK_RENEW; +} + +int main(void) +{ + Ecore_Con_Server *svr; + Ecore_Con_Client *cl; + const Eina_List *clients, *l; + + eina_init(); + ecore_init(); + ecore_con_init(); + + if (!(svr = ecore_con_server_add(ECORE_CON_REMOTE_TCP, "127.0.0.1", 8080, NULL))) + exit(1); + + ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb)_add, NULL); + ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb)_del, NULL); + ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb)_data, NULL); + ecore_con_server_client_limit_set(svr, 3, 0); + + ecore_main_loop_begin(); + + clients = ecore_con_server_clients_get(svr); + printf("Clients still connected to this server when exiting: %d\n", + eina_list_count(clients)); + EINA_LIST_FOREACH(clients, l, cl) + { + printf("%s\n", ecore_con_client_ip_get(cl)); + free(ecore_con_client_data_get(cl)); + } + + printf("Server was up for %0.3f seconds\n", + ecore_con_server_uptime_get(svr)); + + ecore_con_shutdown(); + ecore_shutdown(); + eina_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_con_server_simple_example.c b/libraries/ecore/src/examples/ecore_con_server_simple_example.c new file mode 100644 index 0000000..e466ed4 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_con_server_simple_example.c @@ -0,0 +1,131 @@ +#include +#include +#include + +#ifdef HAVE_CONFIG_H +# include "config.h" +#else +# define __UNUSED__ +#endif + +struct _Client { + int sdata; +}; + +Eina_Bool +_add(void *data __UNUSED__, int type __UNUSED__, Ecore_Con_Event_Client_Add *ev) +{ + char welcome[] = "hello! - sent from the server"; + Ecore_Con_Server *srv; + Ecore_Con_Client *cl; + const Eina_List *clients, *l; + + struct _Client *client = malloc(sizeof(*client)); + client->sdata = 0; + + printf("Client with ip %s, port %d, connected = %d!\n", + ecore_con_client_ip_get(ev->client), + ecore_con_client_port_get(ev->client), + ecore_con_client_connected_get(ev->client)); + + ecore_con_client_send(ev->client, welcome, sizeof(welcome)); + ecore_con_client_flush(ev->client); + + ecore_con_client_timeout_set(ev->client, 6); + + ecore_con_client_data_set(ev->client, client); + + srv = ecore_con_client_server_get(ev->client); + printf("Clients connected to this server:\n"); + clients = ecore_con_server_clients_get(srv); + EINA_LIST_FOREACH(clients, l, cl) + printf("%s\n", ecore_con_client_ip_get(cl)); + + return ECORE_CALLBACK_RENEW; +} + + +Eina_Bool +_del(void *data __UNUSED__, int type __UNUSED__, Ecore_Con_Event_Client_Del *ev) +{ + struct _Client *client; + + if (!ev->client) + return ECORE_CALLBACK_RENEW; + + client = ecore_con_client_data_get(ev->client); + + printf("Lost client with ip %s!\n", ecore_con_client_ip_get(ev->client)); + printf("Total data received from this client: %d\n", client->sdata); + printf("Client was connected for %0.3f seconds.\n", + ecore_con_client_uptime_get(ev->client)); + + if (client) + free(client); + + ecore_con_client_del(ev->client); + + return ECORE_CALLBACK_RENEW; +} + +Eina_Bool +_data(void *data __UNUSED__, int type __UNUSED__, Ecore_Con_Event_Client_Data *ev) +{ + char fmt[128]; + struct _Client *client = ecore_con_client_data_get(ev->client); + + snprintf(fmt, sizeof(fmt), + "Received %i bytes from client %s port %d:\n" + ">>>>>\n" + "%%.%is\n" + ">>>>>\n", + ev->size, ecore_con_client_ip_get(ev->client), + ecore_con_client_port_get(ev->client), ev->size); + + printf(fmt, ev->data); + + client->sdata += ev->size; + + return ECORE_CALLBACK_RENEW; +} + +int main(void) +{ + Ecore_Con_Server *svr; + Ecore_Con_Client *cl; + const Eina_List *clients, *l; + + eina_init(); + ecore_init(); + ecore_con_init(); + + if (!(svr = ecore_con_server_add(ECORE_CON_REMOTE_TCP, "127.0.0.1", 8080, NULL))) + exit(1); + + ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb)_add, NULL); + ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb)_del, NULL); + ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb)_data, NULL); + + ecore_con_server_timeout_set(svr, 10); + ecore_con_server_client_limit_set(svr, 3, 0); + + ecore_main_loop_begin(); + + clients = ecore_con_server_clients_get(svr); + printf("Clients connected to this server when exiting: %d\n", + eina_list_count(clients)); + EINA_LIST_FOREACH(clients, l, cl) + { + printf("%s\n", ecore_con_client_ip_get(cl)); + free(ecore_con_client_data_get(cl)); + } + + printf("Server was up for %0.3f seconds\n", + ecore_con_server_uptime_get(svr)); + + ecore_con_shutdown(); + ecore_shutdown(); + eina_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_con_url_cookies_example.c b/libraries/ecore/src/examples/ecore_con_url_cookies_example.c new file mode 100644 index 0000000..64f37d2 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_con_url_cookies_example.c @@ -0,0 +1,119 @@ +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +# include "config.h" +#else +# define __UNUSED__ +#endif + +#define COOKIEJAR "cookies.jar" + +static Eina_Bool +_url_data_cb(void *data __UNUSED__, int type __UNUSED__, void *event_info) +{ + Ecore_Con_Event_Url_Data *url_data = event_info; + int i; + + printf("\nData received from server:\n>>>>>\n"); + for (i = 0; i < url_data->size; i++) + printf("%c", url_data->data[i]); + printf("\n>>>>>>\n\n"); + + return EINA_TRUE; +} + +static Eina_Bool +_url_complete_cb(void *data __UNUSED__, int type __UNUSED__, void *event_info) +{ + Ecore_Con_Event_Url_Complete *url_complete = event_info; + const Eina_List *headers, *l; + char *str; + + printf("\n"); + printf("download completed with status code: %d\n", url_complete->status); + + headers = ecore_con_url_response_headers_get(url_complete->url_con); + + printf("response headers:\n"); + EINA_LIST_FOREACH(headers, l, str) + printf("header: %s", str); + + ecore_con_url_cookies_jar_write(url_complete->url_con); + + ecore_main_loop_quit(); + + return EINA_TRUE; +} + +int main(int argc, const char *argv[]) +{ + Ecore_Con_Url *ec_url = NULL; + char cmd = '\0'; + Eina_Bool r; + + if (argc < 2) + { + printf("need at least one parameter: [command]\n"); + return -1; + } + + if (argc > 2) + cmd = argv[2][0]; + + ecore_init(); + ecore_con_init(); + ecore_con_url_init(); + + ec_url = ecore_con_url_new(argv[1]); + if (!ec_url) + { + printf("error when creating ecore con url object.\n"); + goto end; + } + + ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, _url_data_cb, NULL); + ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _url_complete_cb, NULL); + + ecore_con_url_additional_header_add(ec_url, "User-Agent", "Ecore_Con client"); + + ecore_con_url_cookies_init(ec_url); + if (cmd != 'c' && cmd != 's') + ecore_con_url_cookies_file_add(ec_url, COOKIEJAR); + ecore_con_url_cookies_jar_file_set(ec_url, COOKIEJAR); + + switch (cmd) + { + case 'c': // clear + printf("Cleaning previously set cookies.\n"); + ecore_con_url_cookies_clear(ec_url); + break; + case 's': // clear session + printf("Cleaning previously set session cookies.\n"); + ecore_con_url_cookies_session_clear(ec_url); + break; + case 'i': // ignore session + printf("Ignoring old session cookies.\n"); + ecore_con_url_cookies_ignore_old_session_set(ec_url, EINA_TRUE); + } + + r = ecore_con_url_get(ec_url); + if (!r) + { + printf("could not realize request.\n"); + goto free_ec_url; + } + + ecore_main_loop_begin(); + +free_ec_url: + ecore_con_url_free(ec_url); +end: + ecore_con_url_shutdown(); + ecore_con_shutdown(); + ecore_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_con_url_download_example.c b/libraries/ecore/src/examples/ecore_con_url_download_example.c new file mode 100644 index 0000000..0cb81e1 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_con_url_download_example.c @@ -0,0 +1,110 @@ +#include +#include +#include +#include +#include +#include + +struct _request { + long size; +}; + +static Eina_Bool +_url_progress_cb(void *data, int type, void *event_info) +{ + Ecore_Con_Event_Url_Progress *url_progress = event_info; + float percent; + + if (url_progress->down.total > 0) + { + struct _request *req = ecore_con_url_data_get(url_progress->url_con); + req->size = url_progress->down.now; + + percent = (url_progress->down.now / url_progress->down.total) * 100; + printf("Total of download complete: %0.1f (%0.0f)%%\n", + percent, url_progress->down.now); + } + + return EINA_TRUE; +} + +static Eina_Bool +_url_complete_cb(void *data, int type, void *event_info) +{ + Ecore_Con_Event_Url_Complete *url_complete = event_info; + + struct _request *req = ecore_con_url_data_get(url_complete->url_con); + int nbytes = ecore_con_url_received_bytes_get(url_complete->url_con); + + printf("\n"); + printf("download completed with status code: %d\n", url_complete->status); + printf("Total size of downloaded file: %ld bytes\n", req->size); + printf("Total size of downloaded file: %ld bytes " + "(from received_bytes_get)\n", nbytes); + ecore_main_loop_quit(); + + return EINA_TRUE; +} + +int main(int argc, const char *argv[]) +{ + Ecore_Con_Url *ec_url = NULL; + struct _request *req; + int fd; + const char *filename = "downloadedfile.dat"; + + if (argc < 2) + { + printf("need one parameter: \n"); + return -1; + } + + fd = open(filename, O_CREAT|O_WRONLY|O_TRUNC, 0644); + + if (fd == -1) + { + printf("error: could not open file for writing: \"%s\"\n", + filename); + return -1; + } + + ecore_init(); + ecore_con_init(); + ecore_con_url_init(); + + ec_url = ecore_con_url_new(argv[1]); + if (!ec_url) + { + printf("error when creating ecore con url object.\n"); + goto end; + } + + req = malloc(sizeof(*req)); + req->size = 0; + ecore_con_url_data_set(ec_url, req); + + ecore_con_url_fd_set(ec_url, fd); + + ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _url_progress_cb, NULL); + ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _url_complete_cb, NULL); + + if (!ecore_con_url_get(ec_url)) + { + printf("could not realize request.\n"); + goto free_ec_url; + } + + ecore_main_loop_begin(); + +free_ec_url: + free(req); + ecore_con_url_free(ec_url); +end: + + close(fd); + ecore_con_url_shutdown(); + ecore_con_shutdown(); + ecore_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_con_url_headers_example.c b/libraries/ecore/src/examples/ecore_con_url_headers_example.c new file mode 100644 index 0000000..262823b --- /dev/null +++ b/libraries/ecore/src/examples/ecore_con_url_headers_example.c @@ -0,0 +1,104 @@ +#include +#include +#include +#include + +static Eina_Bool +_url_data_cb(void *data, int type, void *event_info) +{ + Ecore_Con_Event_Url_Data *url_data = event_info; + int i; + + for (i = 0; i < url_data->size; i++) + printf("%c", url_data->data[i]); + + return EINA_TRUE; +} + +static Eina_Bool +_url_complete_cb(void *data, int type, void *event_info) +{ + Ecore_Con_Event_Url_Complete *url_complete = event_info; + const Eina_List *headers, *l; + char *str; + + printf("\n"); + printf("download completed with status code: %d\n", url_complete->status); + + headers = ecore_con_url_response_headers_get(url_complete->url_con); + + EINA_LIST_FOREACH(headers, l, str) + printf("header: %s\n", str); + + ecore_main_loop_quit(); + + return EINA_TRUE; +} + +int main(int argc, const char *argv[]) +{ + Ecore_Con_Url *ec_url = NULL; + const char *type; + Eina_Bool r; + + if (argc < 3) + { + printf("need at least two parameters: < POST|GET > \n"); + return -1; + } + + type = argv[1]; + + if (strcmp(type, "POST") && (strcmp(type, "GET"))) + { + printf("only POST or GET are supported by this example.\n"); + return -1; + } + + ecore_init(); + ecore_con_init(); + ecore_con_url_init(); + + // check if requests are being pipelined, and set them if not: + if (!ecore_con_url_pipeline_get()) + ecore_con_url_pipeline_set(EINA_TRUE); + + ec_url = ecore_con_url_custom_new(argv[2], type); + if (!ec_url) + { + printf("error when creating ecore con url object.\n"); + goto end; + } + + ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, _url_data_cb, NULL); + ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _url_complete_cb, NULL); + + ecore_con_url_additional_header_add(ec_url, "User-Agent", "blablabla"); + ecore_con_url_verbose_set(ec_url, EINA_TRUE); + + ecore_con_url_httpauth_set(ec_url, "user", "password", EINA_FALSE); + + ecore_con_url_time(ec_url, ECORE_CON_URL_TIME_IFMODSINCE, 0); + + if (!strcmp(type, "GET")) + r = ecore_con_url_get(ec_url); + else + r = ecore_con_url_post(ec_url, NULL, 0, NULL); + + if (!r) + { + printf("could not realize request.\n"); + goto free_ec_url; + } + + ecore_main_loop_begin(); + +free_ec_url: + ecore_con_url_free(ec_url); +end: + ecore_con_url_shutdown(); + ecore_con_shutdown(); + ecore_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_evas_basics_example.c b/libraries/ecore/src/examples/ecore_evas_basics_example.c new file mode 100644 index 0000000..5f0231f --- /dev/null +++ b/libraries/ecore/src/examples/ecore_evas_basics_example.c @@ -0,0 +1,91 @@ +/** + * Ecore example illustrating the basics of ecore evas usage. + * + * You'll need at least one Evas engine built for it (excluding the + * buffer one). See stdout/stderr for output. + * + * @verbatim + * gcc -o ecore_evas_basics_example ecore_evas_basics_example.c `pkg-config --libs --cflags ecore-evas` + * @endverbatim + */ + +#include +#include +#include + +static Eina_Bool +_stdin_cb(void *data, Ecore_Fd_Handler *handler) +{ + Eina_List *l; + Ecore_Evas *ee; + char c; + + scanf("%c", &c); + if (c == 'h') + EINA_LIST_FOREACH(ecore_evas_ecore_evas_list_get(), l, ee) + ecore_evas_hide(ee); + else if (c == 's') + EINA_LIST_FOREACH(ecore_evas_ecore_evas_list_get(), l, ee) + ecore_evas_show(ee); + + return ECORE_CALLBACK_RENEW; +} + +static void +_on_delete(Ecore_Evas *ee) +{ + free(ecore_evas_data_get(ee, "key")); + ecore_main_loop_quit(); +} + +int +main(void) +{ + Ecore_Evas *ee; + Evas *canvas; + Evas_Object *bg; + Eina_List *engines, *l; + char *data; + + if(ecore_evas_init() <= 0) + return 1; + + engines = ecore_evas_engines_get(); + printf("Available engines:\n"); + EINA_LIST_FOREACH(engines, l, data) + printf("%s\n", data); + ecore_evas_engines_free(engines); + + ee = ecore_evas_new(NULL, 0, 0, 200, 200, NULL); + ecore_evas_title_set(ee, "Ecore Evas basics Example"); + ecore_evas_show(ee); + + data = malloc(sizeof(char) * 6); + sprintf(data, "%s", "hello"); + ecore_evas_data_set(ee, "key", data); + ecore_evas_callback_delete_request_set(ee, _on_delete); + + printf("Using %s engine!\n", ecore_evas_engine_name_get(ee)); + + canvas = ecore_evas_get(ee); + if(ecore_evas_ecore_evas_get(canvas) == ee) + printf("Everything is sane!\n"); + + bg = evas_object_rectangle_add(canvas); + evas_object_color_set(bg, 0, 0, 255, 255); + evas_object_resize(bg, 200, 200); + evas_object_show(bg); + ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE); + + ecore_main_fd_handler_add(STDIN_FILENO, + ECORE_FD_READ | ECORE_FD_ERROR, + _stdin_cb, + NULL, NULL, NULL); + + ecore_main_loop_begin(); + + ecore_evas_free(ee); + ecore_evas_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_evas_buffer_example_01.c b/libraries/ecore/src/examples/ecore_evas_buffer_example_01.c new file mode 100644 index 0000000..af05530 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_evas_buffer_example_01.c @@ -0,0 +1,121 @@ +/** + * Simple Ecore_Evas example on the Evas buffer engine wrapper + * functions. + * + * You must have Evas compiled with the buffer engine. + * + * Compile with: + * + * @verbatim + * gcc -o evas-buffer-simple evas-buffer-simple.c `pkg-config --libs --cflags evas evas-software-buffer` + * @endverbatim + * + */ + +#ifdef HAVE_CONFIG_H + +#include "config.h" +#else +#define __UNUSED__ +#endif + +#include +#include + +#define WIDTH (320) +#define HEIGHT (240) + +static Ecore_Evas *ee; + +/* support function to save scene as PPM image */ +static void +_scene_save(Evas *canvas, + const char *dest) +{ + const unsigned int *pixels, *pixels_end; + int width, height; + FILE *f; + + evas_output_size_get(canvas, &width, &height); + + f = fopen(dest, "wb+"); + if (!f) + { + fprintf(stderr, "ERROR: could not open for writing '%s': %s\n", + dest, strerror(errno)); + return; + } + + pixels = ecore_evas_buffer_pixels_get(ee); + pixels_end = pixels + (width * height); + + /* PPM P6 format is dead simple to write: */ + fprintf(f, "P6\n%d %d\n255\n", width, height); + for (; pixels < pixels_end; pixels++) + { + int r, g, b; + + r = ((*pixels) & 0xff0000) >> 16; + g = ((*pixels) & 0x00ff00) >> 8; + b = (*pixels) & 0x0000ff; + + fprintf(f, "%c%c%c", r, g, b); + } + + fclose(f); + printf("Saved scene as '%s'\n", dest); +} + +int +main(void) +{ + Evas *canvas; + Evas_Object *bg, *r1, *r2, *r3; + + ecore_evas_init(); + + ee = ecore_evas_buffer_new(WIDTH, HEIGHT); + if (!ee) goto error; + + canvas = ecore_evas_get(ee); + + bg = evas_object_rectangle_add(canvas); + evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */ + evas_object_move(bg, 0, 0); /* at origin */ + evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */ + evas_object_show(bg); + + r1 = evas_object_rectangle_add(canvas); + evas_object_color_set(r1, 255, 0, 0, 255); /* 100% opaque red */ + evas_object_move(r1, 10, 10); + evas_object_resize(r1, 100, 100); + evas_object_show(r1); + + r2 = evas_object_rectangle_add(canvas); + evas_object_color_set(r2, 0, 128, 0, 128); /* 50% opaque green */ + evas_object_move(r2, 10, 10); + evas_object_resize(r2, 50, 50); + evas_object_show(r2); + + r3 = evas_object_rectangle_add(canvas); + evas_object_color_set(r3, 0, 128, 0, 255); /* 100% opaque dark green */ + evas_object_move(r3, 60, 60); + evas_object_resize(r3, 50, 50); + evas_object_show(r3); + + ecore_evas_manual_render(ee); + _scene_save(canvas, "/tmp/evas-buffer-simple-render.ppm"); + + ecore_evas_free(ee); + ecore_evas_shutdown(); + + return 0; + +error: + fprintf(stderr, "You got to have at least one Evas engine built" + " and linked up to ecore-evas for this example to run" + " properly.\n"); + ecore_evas_shutdown(); + return -1; +} + diff --git a/libraries/ecore/src/examples/ecore_evas_buffer_example_02.c b/libraries/ecore/src/examples/ecore_evas_buffer_example_02.c new file mode 100644 index 0000000..29b7b3d --- /dev/null +++ b/libraries/ecore/src/examples/ecore_evas_buffer_example_02.c @@ -0,0 +1,126 @@ +/** + * Simple Ecore_Evas example on the Evas buffer engine wrapper + * functions. + * + * You must have Evas compiled with the buffer engine. + * + * Compile with: + * + * @verbatim + * gcc -o evas-buffer-simple evas-buffer-simple.c `pkg-config --libs --cflags evas evas-software-buffer` + * @endverbatim + * + */ + +#ifdef HAVE_CONFIG_H + +#include "config.h" +#else +#define __UNUSED__ +#define PACKAGE_EXAMPLES_DIR "." +#endif + +#include +#include +#include + +#define WIDTH (320) +#define HEIGHT (240) + +static Ecore_Evas *ee; +static const char *border_img_path = PACKAGE_EXAMPLES_DIR "/red.png"; + +static void +_on_destroy(Ecore_Evas *ee __UNUSED__) +{ + ecore_main_loop_quit(); +} + +int +main(void) +{ + Evas *canvas, *sub_canvas; + Evas_Object *bg, *r1, *r2, *r3; /* "sub" canvas objects */ + Evas_Object *border, *img; /* canvas objects */ + Ecore_Evas *sub_ee; + + ecore_evas_init(); + + /* this will give you a window with an Evas canvas under the first + * engine available */ + ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); + if (!ee) goto error; + + ecore_evas_size_min_set(ee, WIDTH, HEIGHT); + ecore_evas_size_max_set(ee, WIDTH, HEIGHT); + + ecore_evas_callback_delete_request_set(ee, _on_destroy); + ecore_evas_title_set(ee, "Ecore_Evas buffer (image) example"); + ecore_evas_show(ee); + + canvas = ecore_evas_get(ee); + + bg = evas_object_rectangle_add(canvas); + evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */ + evas_object_move(bg, 0, 0); /* at origin */ + evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */ + evas_object_show(bg); + + /* this is a border around the image containing a scene of another + * canvas */ + border = evas_object_image_filled_add(canvas); + evas_object_image_file_set(border, border_img_path, NULL); + evas_object_image_border_set(border, 3, 3, 3, 3); + evas_object_image_border_center_fill_set(border, EVAS_BORDER_FILL_NONE); + + evas_object_move(border, WIDTH / 6, HEIGHT / 6); + evas_object_resize(border, (2 * WIDTH) / 3, (2 * HEIGHT) / 3); + evas_object_show(border); + + img = ecore_evas_object_image_new(ee); + evas_object_image_filled_set(img, EINA_TRUE); + evas_object_image_size_set( + img, ((2 * WIDTH) / 3) - 6, ((2 * HEIGHT) / 3) - 6); + sub_ee = ecore_evas_object_ecore_evas_get(img); + sub_canvas = ecore_evas_object_evas_get(img); + + evas_object_move(img, (WIDTH / 6) + 3, (HEIGHT / 6) + 3); + + /* apply the same size on both! */ + evas_object_resize(img, ((2 * WIDTH) / 3) - 6, ((2 * HEIGHT) / 3) - 6); + ecore_evas_resize(sub_ee, ((2 * WIDTH) / 3) - 6, ((2 * HEIGHT) / 3) - 6); + + r1 = evas_object_rectangle_add(sub_canvas); + evas_object_color_set(r1, 255, 0, 0, 255); /* 100% opaque red */ + evas_object_move(r1, 10, 10); + evas_object_resize(r1, 100, 100); + evas_object_show(r1); + + r2 = evas_object_rectangle_add(sub_canvas); + evas_object_color_set(r2, 0, 128, 0, 128); /* 50% opaque green */ + evas_object_move(r2, 10, 10); + evas_object_resize(r2, 50, 50); + evas_object_show(r2); + + r3 = evas_object_rectangle_add(sub_canvas); + evas_object_color_set(r3, 0, 128, 0, 255); /* 100% opaque dark green */ + evas_object_move(r3, 60, 60); + evas_object_resize(r3, 50, 50); + evas_object_show(r3); + + evas_object_show(img); + ecore_main_loop_begin(); + + ecore_evas_free(ee); + ecore_evas_shutdown(); + + return 0; + +error: + fprintf(stderr, "You got to have at least one Evas engine built" + " and linked up to ecore-evas for this example to run" + " properly.\n"); + ecore_evas_shutdown(); + return -1; +} + diff --git a/libraries/ecore/src/examples/ecore_evas_callbacks.c b/libraries/ecore/src/examples/ecore_evas_callbacks.c new file mode 100644 index 0000000..31b724d --- /dev/null +++ b/libraries/ecore/src/examples/ecore_evas_callbacks.c @@ -0,0 +1,127 @@ +/** + * Ecore example illustrating ecore evas callbacks. + * + * You'll need at least one Evas engine built for it (excluding the + * buffer one). See stdout/stderr for output. + * + * @verbatim + * gcc -o ecore_evas_callbacks ecore_evas_callbacks.c `pkg-config --libs --cflags ecore-evas` + * @endverbatim + */ + +#include +#include + +static void +_destroy(Ecore_Evas *ee) +{ + printf("destroy\n"); + ecore_main_loop_quit(); +} + +static void +_delete(Ecore_Evas *ee) +{ + printf("delete\n"); + ecore_main_loop_quit(); +} + +static void +_focus_in(Ecore_Evas *ee) +{ + printf("focus_in\n"); +} + +static void +_focus_out(Ecore_Evas *ee) +{ + printf("focus_out\n"); +} + +static void +_hide(Ecore_Evas *ee) +{ + printf("hide\n"); +} + +static void +_mouse_in(Ecore_Evas *ee) +{ + printf("mouse_in\n"); +} + +static void +_show(Ecore_Evas *ee) +{ + printf("show\n"); +} + +static void +_mouse_out(Ecore_Evas *ee) +{ + printf("mouse_out\n"); +} + +static void +_move(Ecore_Evas *ee) +{ + printf("move\n"); +} + +static void +_post_render(Ecore_Evas *ee) +{ + printf("post_render\n"); +} + +static void +_pre_free(Ecore_Evas *ee) +{ + printf("pre_free\n"); +} + +static void +_pre_render(Ecore_Evas *ee) +{ + printf("pre_render\n"); +} + +static void +_resize(Ecore_Evas *ee) +{ + printf("resize\n"); +} + +int +main(void) +{ + Ecore_Evas *ee; + + ecore_evas_init(); + + ee = ecore_evas_new(NULL, 0, 0, 200, 100, NULL); + ecore_evas_title_set(ee, "Ecore Evas Callbacks Example"); + ecore_evas_show(ee); + + //callbacks + ecore_evas_callback_delete_request_set(ee, _delete); + ecore_evas_callback_destroy_set(ee, _destroy); + ecore_evas_callback_focus_in_set(ee, _focus_in); + ecore_evas_callback_focus_out_set(ee, _focus_out); + ecore_evas_callback_hide_set(ee, _hide); + ecore_evas_callback_mouse_in_set(ee, _mouse_in); + ecore_evas_callback_mouse_out_set(ee, _mouse_out); + ecore_evas_callback_move_set(ee, _move); + ecore_evas_callback_post_render_set(ee, _post_render); + ecore_evas_callback_pre_free_set(ee, _pre_free); + ecore_evas_callback_pre_render_set(ee, _pre_render); + ecore_evas_callback_resize_set(ee, _resize); + ecore_evas_callback_show_set (ee, _show); + + ecore_main_loop_begin(); + + ecore_evas_free(ee); + ecore_evas_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_evas_ews_example.c b/libraries/ecore/src/examples/ecore_evas_ews_example.c new file mode 100644 index 0000000..9be725a --- /dev/null +++ b/libraries/ecore/src/examples/ecore_evas_ews_example.c @@ -0,0 +1,253 @@ +/** + * Ecore example illustrating the ews of ecore evas usage. + * + * You'll need at least one Evas engine built for it (excluding the + * buffer one). See stdout/stderr for output. + * + * @verbatim + * gcc -o ecore_evas_ews_example ecore_evas_ews_example.c `pkg-config --libs --cflags ecore-evas` + * @endverbatim + */ + +#include +#include +#include +#include +#include + +static Eina_Bool +_wm_win_add(void *data, int type, void *event_info) +{ + Ecore_Evas *ee = event_info; + printf("WM: new window=%p\n", ee); + return EINA_TRUE; +} + +static Eina_Bool +_wm_win_move(void *data, int type, void *event_info) +{ + Ecore_Evas *ee = event_info; + int x, y; + ecore_evas_geometry_get(ee, &x, &y, NULL, NULL); + printf("WM: window=%p moved to %d,%d\n", ee, x, y); + return EINA_TRUE; +} + +static Eina_Bool +_wm_win_resize(void *data, int type, void *event_info) +{ + Ecore_Evas *ee = event_info; + int w, h; + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + printf("WM: window=%p resized to %dx%d\n", ee, w, h); + return EINA_TRUE; +} + +static Eina_Bool +_wm_win_show(void *data, int type, void *event_info) +{ + Ecore_Evas *ee = event_info; + printf("WM: show window=%p\n", ee); + return EINA_TRUE; +} + +static void +optional_ews_window_manager_setup(void) +{ + ecore_event_handler_add(ECORE_EVAS_EWS_EVENT_ADD, _wm_win_add, NULL); + ecore_event_handler_add(ECORE_EVAS_EWS_EVENT_MOVE, _wm_win_move, NULL); + ecore_event_handler_add(ECORE_EVAS_EWS_EVENT_RESIZE, _wm_win_resize, NULL); + ecore_event_handler_add(ECORE_EVAS_EWS_EVENT_SHOW, _wm_win_show, NULL); + + /* one may use any known unique identifier, like an app function pointer */ + ecore_evas_ews_manager_set(optional_ews_window_manager_setup); +} + +static void +optional_ews_setup(void) +{ + Evas_Object *bg; + Evas *e; + + ecore_evas_ews_setup(0, 0, 800, 600); /* "screen" size */ + e = ecore_evas_ews_evas_get(); /* forces "screen" to be allocated */ + + bg = evas_object_rectangle_add(e); + evas_object_color_set(bg, 128, 32, 32, 255); + ecore_evas_ews_background_set(bg); +} + +static Eina_Bool +_stdin_cb(void *data, Ecore_Fd_Handler *handler) +{ + const Eina_List *l; + Ecore_Evas *ee; + char c = getchar(); + + if (c == EOF) + { + ecore_main_loop_quit(); + return EINA_FALSE; + } + + switch (c) { + case 'h': + printf("hide all windows\n"); + EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) + ecore_evas_hide(ee); + break; + case 's': + printf("show all windows\n"); + EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) + ecore_evas_show(ee); + break; + case 'l': + printf("move all windows left\n"); + EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) + { + int x, y; + ecore_evas_geometry_get(ee, &x, &y, NULL, NULL); + ecore_evas_move(ee, x - 10, y); + } + break; + case 'r': + printf("move all windows right\n"); + EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) + { + int x, y; + ecore_evas_geometry_get(ee, &x, &y, NULL, NULL); + ecore_evas_move(ee, x + 10, y); + } + break; + case 't': + printf("move all windows top\n"); + EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) + { + int x, y; + ecore_evas_geometry_get(ee, &x, &y, NULL, NULL); + ecore_evas_move(ee, x, y - 10); + } + break; + case 'b': + printf("move all windows bottom\n"); + EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) + { + int x, y; + ecore_evas_geometry_get(ee, &x, &y, NULL, NULL); + ecore_evas_move(ee, x, y + 10); + } + break; + case 'S': + printf("make all windows smaller\n"); + EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) + { + int w, h; + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + ecore_evas_resize(ee, w - 10, h - 10); + } + break; + case 'B': + printf("make all windows bigger\n"); + EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) + { + int w, h; + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + ecore_evas_resize(ee, w + 10, h + 10); + } + break; + case 'm': + printf("make all windows unmaximized\n"); + EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) + ecore_evas_maximized_set(ee, EINA_FALSE); + break; + case 'M': + printf("make all windows maximized\n"); + EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) + ecore_evas_maximized_set(ee, EINA_TRUE); + break; + case 'i': + printf("make all windows uniconified\n"); + EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) + ecore_evas_iconified_set(ee, EINA_FALSE); + break; + case 'I': + printf("make all windows iconified\n"); + EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) + ecore_evas_iconified_set(ee, EINA_TRUE); + break; + case 'f': + printf("make all windows unfullscreen\n"); + EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) + ecore_evas_fullscreen_set(ee, EINA_FALSE); + break; + case 'F': + printf("make all windows fullscreen\n"); + EINA_LIST_FOREACH(ecore_evas_ews_children_get(), l, ee) + ecore_evas_fullscreen_set(ee, EINA_TRUE); + break; + case 'q': + printf("quit\n"); + ecore_main_loop_quit(); + break; + default: + if (!isspace(c)) + printf("Unknown command: %c\n", c); + } + return ECORE_CALLBACK_RENEW; +} + +static void +_on_delete(Ecore_Evas *ee) +{ + free(ecore_evas_data_get(ee, "key")); + ecore_main_loop_quit(); +} + +int +main(void) +{ + Ecore_Evas *ee; + Evas *canvas; + Evas_Object *bg; + + if (ecore_evas_init() <= 0) + return 1; + + optional_ews_setup(); + optional_ews_window_manager_setup(); + + /* everything should look similar to ecore_evas_basic_example */ + ee = ecore_evas_ews_new(0, 0, 200, 200); + ecore_evas_title_set(ee, "Ecore Evas EWS Example"); + ecore_evas_show(ee); + + ecore_evas_data_set(ee, "key", strdup("hello")); + ecore_evas_callback_delete_request_set(ee, _on_delete); + + printf("Using %s engine!\n", ecore_evas_engine_name_get(ee)); + + canvas = ecore_evas_get(ee); + if(ecore_evas_ecore_evas_get(canvas) == ee) + printf("Everything is sane!\n"); + + bg = evas_object_rectangle_add(canvas); + evas_object_color_set(bg, 0, 0, 255, 255); + evas_object_resize(bg, 200, 200); + evas_object_show(bg); + ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE); + + /* moving the window should move it in the screen */ + ecore_evas_move(ee, 50, 50); + + ecore_main_fd_handler_add(STDIN_FILENO, + ECORE_FD_READ | ECORE_FD_ERROR, + _stdin_cb, + NULL, NULL, NULL); + + ecore_main_loop_begin(); + + ecore_evas_free(ee); + ecore_evas_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_evas_object_example.c b/libraries/ecore/src/examples/ecore_evas_object_example.c new file mode 100644 index 0000000..33da234 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_evas_object_example.c @@ -0,0 +1,52 @@ +/** + * Ecore example illustrating ecore evas object usage. + * + * You'll need at least one Evas engine built for it (excluding the + * buffer one). See stdout/stderr for output. + * + * @verbatim + * gcc -o ecore_evas_object_example ecore_evas_object_example.c `pkg-config --libs --cflags ecore-evas` + * @endverbatim + */ + +#include +#include + +int +main(void) +{ + Ecore_Evas *ee; + Evas_Object *bg, *cursor, *obj; + int layer, x, y; + + ecore_evas_init(); + + ee = ecore_evas_new(NULL, 0, 0, 200, 200, NULL); + ecore_evas_title_set(ee, "Ecore Evas Object Example"); + ecore_evas_show(ee); + + bg = evas_object_rectangle_add(ecore_evas_get(ee)); + evas_object_color_set(bg, 0, 0, 255, 255); + evas_object_resize(bg, 200, 200); + evas_object_show(bg); + ecore_evas_object_associate(ee, bg, ECORE_EVAS_OBJECT_ASSOCIATE_BASE); + + if(bg == ecore_evas_object_associate_get(ee)) + printf("Association worked!\n"); + + cursor = evas_object_rectangle_add(ecore_evas_get(ee)); + evas_object_color_set(cursor, 0, 255, 0, 255); + evas_object_resize(cursor, 5, 10); + ecore_evas_object_cursor_set(ee, cursor, 0, 1, 1); + + ecore_evas_cursor_get(ee, &obj, &layer, &x, &y); + if(obj == cursor && layer == 0 && x == 1 && y == 1) + printf("Set cursor worked!\n"); + + ecore_main_loop_begin(); + + ecore_evas_free(ee); + ecore_evas_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_evas_window_sizes_example.c b/libraries/ecore/src/examples/ecore_evas_window_sizes_example.c new file mode 100644 index 0000000..badfb16 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_evas_window_sizes_example.c @@ -0,0 +1,204 @@ +/** + * Simple @c Ecore_Evas example illustrating how to deal with window + * sizes + * + * You'll need at least one engine built for it (excluding the buffer + * one). See stdout/stderr for output. + * + * @verbatim + * gcc -o evas-smart-object evas-smart-object.c `pkg-config --libs --cflags evas ecore ecore-evas` + * @endverbatim + */ + +#ifdef HAVE_CONFIG_H + +#include "config.h" +#else +#define __UNUSED__ +#endif + +#include +#include + +#define WIDTH (300) +#define HEIGHT (300) + +static Ecore_Evas *ee; +static Evas_Object *text, *bg; +static Eina_Bool min_set = EINA_FALSE; +static Eina_Bool max_set = EINA_FALSE; +static Eina_Bool base_set = EINA_FALSE; +static Eina_Bool step_set = EINA_FALSE; + +static const char commands[] = \ + "commands are:\n" + "\tm - impose a minumum size to the window\n" + "\tx - impose a maximum size to the window\n" + "\tb - impose a base size to the window\n" + "\ts - impose a step size (different than 1 px) to the window\n" + "\th - print help\n"; + +/* to inform current window's size */ +static void +_canvas_resize_cb(Ecore_Evas *ee) +{ + int w, h; + char buf[1024]; + + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + snprintf(buf, sizeof(buf), "%d x %d", w, h); + evas_object_text_text_set(text, buf); + evas_object_move(text, (w - 150) / 2, (h - 50) / 2); + + evas_object_resize(bg, w, h); +} + +static void +_on_destroy(Ecore_Evas *ee __UNUSED__) +{ + ecore_main_loop_quit(); +} + +static void +_on_keydown(void *data __UNUSED__, + Evas *evas __UNUSED__, + Evas_Object *o __UNUSED__, + void *einfo) +{ + Evas_Event_Key_Down *ev = einfo; + + if (strcmp(ev->keyname, "h") == 0) /* print help */ + { + fprintf(stdout, commands); + return; + } + + if (strcmp(ev->keyname, "m") == 0) /* impose a minimum size on the window */ + { + min_set = !min_set; + + if (min_set) + { + ecore_evas_size_min_set(ee, WIDTH / 2, HEIGHT / 2); + fprintf(stdout, "Imposing a minimum size of %d x %d\n", + WIDTH / 2, HEIGHT / 2); + } + else + { + ecore_evas_size_min_set(ee, 0, 0); + fprintf(stdout, "Taking off minimum size restriction from the" + " window\n"); + } + return; + } + + if (strcmp(ev->keyname, "x") == 0) /* impose a maximum size on the window */ + { + max_set = !max_set; + + if (max_set) + { + ecore_evas_size_max_set(ee, WIDTH * 2, HEIGHT * 2); + fprintf(stdout, "Imposing a maximum size of %d x %d\n", + WIDTH * 2, HEIGHT * 2); + } + else + { + ecore_evas_size_max_set(ee, 0, 0); + fprintf(stdout, "Taking off maximum size restriction from the" + " window\n"); + } + return; + } + + if (strcmp(ev->keyname, "b") == 0) /* impose a base size on the window */ + { + base_set = !base_set; + + if (base_set) + { + ecore_evas_size_base_set(ee, WIDTH * 2, HEIGHT * 2); + fprintf(stdout, "Imposing a base size of %d x %d\n", + WIDTH * 2, HEIGHT * 2); + } + else + { + ecore_evas_size_base_set(ee, 0, 0); + fprintf(stdout, "Taking off base size restriction from the" + " window\n"); + } + return; + } + + if (strcmp(ev->keyname, "s") == 0) /* impose a step size on the window */ + { + step_set = !step_set; + + if (step_set) + { + ecore_evas_size_step_set(ee, 40, 40); + fprintf(stdout, "Imposing a step size of %d x %d\n", 40, 40); + } + else + { + ecore_evas_size_step_set(ee, 0, 0); + fprintf(stdout, "Taking off step size restriction from the" + " window\n"); + } + return; + } +} + +int +main(void) +{ + Evas *evas; + + if (!ecore_evas_init()) + return EXIT_FAILURE; + + /* this will give you a window with an Evas canvas under the first + * engine available */ + ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); + if (!ee) goto error; + + ecore_evas_callback_delete_request_set(ee, _on_destroy); + ecore_evas_title_set(ee, "Ecore_Evas window sizes example"); + ecore_evas_callback_resize_set(ee, _canvas_resize_cb); + ecore_evas_show(ee); + + evas = ecore_evas_get(ee); + + bg = evas_object_rectangle_add(evas); + evas_object_color_set(bg, 255, 255, 255, 255); /* white bg */ + evas_object_move(bg, 0, 0); /* at canvas' origin */ + evas_object_resize(bg, WIDTH, HEIGHT); /* covers full canvas */ + evas_object_show(bg); + + evas_object_focus_set(bg, EINA_TRUE); + evas_object_event_callback_add( + bg, EVAS_CALLBACK_KEY_DOWN, _on_keydown, NULL); + + text = evas_object_text_add(evas); + evas_object_color_set(text, 0, 0, 0, 255); + evas_object_resize(text, 150, 50); + evas_object_text_font_set(text, "Sans", 20); + evas_object_show(text); + + _canvas_resize_cb(ee); + fprintf(stdout, commands); + ecore_main_loop_begin(); + + ecore_evas_free(ee); + ecore_evas_shutdown(); + + return 0; + +error: + fprintf(stderr, "You got to have at least one Evas engine built" + " and linked up to ecore-evas for this example to run" + " properly.\n"); + ecore_evas_shutdown(); + return -1; +} + diff --git a/libraries/ecore/src/examples/ecore_event_example.c b/libraries/ecore/src/examples/ecore_event_example.c new file mode 100644 index 0000000..ef3f187 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_event_example.c @@ -0,0 +1,86 @@ +#include +#include + +struct context { // helper struct to give some context to the callbacks + const char *str1, *str2; + Ecore_Event_Handler *handler1; + Ecore_Event_Handler *handler2; +}; + +static _event_type = 0; // a new type of event will be defined and stored here + +static Eina_Bool +_event_handler1_cb(void *data, int type, void *event) +{ + int *number = event; + const char *str = data; + + printf("event_handler1: number=%d, data=\"%s\".\n", *number, str); + + if ((*number % 2) == 0) + return ECORE_CALLBACK_DONE; + + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_event_handler2_cb(void *data, int type, void *event) // event callback +{ + struct context *ctxt = data; + int *number = event; + + printf("event_handler2: number=%d.\n", *number); + + if (*number == 5) + { + const char *old = NULL; + old = ecore_event_handler_data_set(ctxt->handler1, (void *)ctxt->str2); + printf("changed handler1 data from \"%s\" to \"%s\".\n", + old, ctxt->str2); + } + else if (*number >= 10) + { + printf("finish main loop.\n"); + ecore_main_loop_quit(); + } + + return ECORE_CALLBACK_DONE; // same as EINA_FALSE +} + +int main(int argc, char **argv) +{ + struct context ctxt = {0}; + int i; + ctxt.str1 = "dataone"; + ctxt.str2 = "datatwo"; + + if (!ecore_init()) + { + printf("ERROR: Cannot init Ecore!\n"); + return -1; + } + + _event_type = ecore_event_type_new(); + + ctxt.handler1 = ecore_event_handler_add(_event_type, + _event_handler1_cb, + ctxt.str1); + ctxt.handler2 = ecore_event_handler_add(_event_type, + _event_handler2_cb, + &ctxt); + + for (i = 0; i <= 15; i++) + { + int *event_data = malloc(sizeof(*event_data)); + *event_data = i; + ecore_event_add(_event_type, event_data, NULL, NULL); + } + + printf("start the main loop.\n"); + + ecore_main_loop_begin(); + + ecore_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_fd_handler_example.c b/libraries/ecore/src/examples/ecore_fd_handler_example.c new file mode 100644 index 0000000..d80b290 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_fd_handler_example.c @@ -0,0 +1,86 @@ +#include +#include + +struct context { + Ecore_Fd_Handler *handler; + Ecore_Timer *timer; +}; + +static void +_fd_prepare_cb(void *data, Ecore_Fd_Handler *handler) +{ + printf("prepare_cb called.\n"); +} + +static Eina_Bool +_fd_handler_cb(void *data, Ecore_Fd_Handler *handler) +{ + struct context *ctxt = data; + char buf[1024]; + size_t nbytes; + int fd; + + if (ecore_main_fd_handler_active_get(handler, ECORE_FD_ERROR)) + { + printf("An error has occurred. Stop watching this fd and quit.\n"); + ecore_main_loop_quit(); + ctxt->handler = NULL; + return ECORE_CALLBACK_CANCEL; + } + + fd = ecore_main_fd_handler_fd_get(handler); + nbytes = read(fd, buf, sizeof(buf)); + if (nbytes == 0) + { + printf("Nothing to read, exiting...\n"); + ecore_main_loop_quit(); + ctxt->handler = NULL; + return ECORE_CALLBACK_CANCEL; + } + buf[nbytes - 1] = '\0'; + + printf("Read %zd bytes from input: \"%s\"\n", nbytes - 1, buf); + + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_timer_cb(void *data) +{ + printf("Timer expired after 5 seconds...\n"); + + return ECORE_CALLBACK_RENEW; +} + +int main(int argc, char **argv) +{ + struct context ctxt = {0}; + + if (!ecore_init()) + { + printf("ERROR: Cannot init Ecore!\n"); + return -1; + } + + ctxt.handler = ecore_main_fd_handler_add(STDIN_FILENO, + ECORE_FD_READ | ECORE_FD_ERROR, + _fd_handler_cb, + &ctxt, NULL, NULL); + ecore_main_fd_handler_prepare_callback_set(ctxt.handler, _fd_prepare_cb, &ctxt); + ctxt.timer = ecore_timer_add(5, _timer_cb, &ctxt); + + printf("Starting the main loop. Type anything and hit to " + "activate the fd_handler callback, or CTRL+d to shutdown.\n"); + + ecore_main_loop_begin(); + + if (ctxt.handler) + ecore_main_fd_handler_del(ctxt.handler); + + if (ctxt.timer) + ecore_timer_del(ctxt.timer); + + ecore_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_fd_handler_gnutls_example.c b/libraries/ecore/src/examples/ecore_fd_handler_gnutls_example.c new file mode 100644 index 0000000..b67e04e --- /dev/null +++ b/libraries/ecore/src/examples/ecore_fd_handler_gnutls_example.c @@ -0,0 +1,195 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Ecore_Fd_Handler example + * 2010 Mike Blumenkrantz + * compile with gcc $(pkgconfig --cflags --libs gnutls ecore) + */ + + +#define print(...) fprintf(stderr, "line %i: ", __LINE__); fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n") + +static int done = 0; + +static void +tls_log_func (int level, const char *str) +{ + fprintf(stderr, "|<%d>| %s", level, str); +} + +static const char* +SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_description_t status) +{ + switch (status) + { + case GNUTLS_HANDSHAKE_HELLO_REQUEST: + return "Hello request"; + case GNUTLS_HANDSHAKE_CLIENT_HELLO: + return "Client hello"; + case GNUTLS_HANDSHAKE_SERVER_HELLO: + return "Server hello"; + case GNUTLS_HANDSHAKE_CERTIFICATE_PKT: + return "Certificate packet"; + case GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE: + return "Server key exchange"; + case GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST: + return "Certificate request"; + case GNUTLS_HANDSHAKE_SERVER_HELLO_DONE: + return "Server hello done"; + case GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY: + return "Certificate verify"; + case GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE: + return "Client key exchange"; + case GNUTLS_HANDSHAKE_FINISHED: + return "Finished"; + case GNUTLS_HANDSHAKE_SUPPLEMENTAL: + return "Supplemental"; + } + return NULL; +} + +/* Connects to the peer and returns a socket + * descriptor. + */ +static int +tcp_connect (void) +{ + const char *PORT = "443"; + const char *SERVER = "69.58.181.89"; //verisign.com + int err, sd; + int flag = 1, curstate = 0; + struct sockaddr_in sa; + + /* sets some fd options such as nonblock */ + sd = socket (AF_INET, SOCK_STREAM, 0); + fcntl(sd, F_SETFL, O_NONBLOCK); + fcntl(sd, F_SETFD, FD_CLOEXEC); + setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate, sizeof(curstate)); + + setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int)); + + memset (&sa, '\0', sizeof (sa)); + sa.sin_family = AF_INET; + sa.sin_port = htons (atoi (PORT)); + inet_pton (AF_INET, SERVER, &sa.sin_addr); + + /* connects to server + */ + err = connect (sd, (struct sockaddr *) &sa, sizeof (sa)); + if ((err < 0) && (errno != EINPROGRESS)) + { + print("Connect error\n"); + exit (1); + } + + return sd; +} + +/* closes the given socket descriptor. + */ +static void +tcp_close (int sd) +{ + shutdown (sd, SHUT_RDWR); /* no more receptions */ + close (sd); +} + +static Eina_Bool +_process_data(gnutls_session_t client, Ecore_Fd_Handler *fd_handler) +{ + static int ret, lastret; + static unsigned int count = 0; + + if (!done) + { + lastret = ret; + ret = gnutls_handshake (client); + count++; + if (gnutls_record_get_direction(client)) + ecore_main_fd_handler_active_set(fd_handler, ECORE_FD_WRITE); + else + ecore_main_fd_handler_active_set(fd_handler, ECORE_FD_READ); + /* avoid printing messages infinity times */ + if (lastret != ret) + { + print("gnutls returned with: %s - %s", gnutls_strerror_name(ret), gnutls_strerror(ret)); + if ((ret == GNUTLS_E_WARNING_ALERT_RECEIVED) || (ret == GNUTLS_E_FATAL_ALERT_RECEIVED)) + print("Also received alert: %s", gnutls_alert_get_name(gnutls_alert_get(client))); + print("last out: %s", SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_get_last_out(client))); + print("last in: %s", SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_get_last_in(client))); + } + + if (gnutls_error_is_fatal(ret)) + { + print("yarrr this be an error!"); + exit(1); + } + + } + if (ret == GNUTLS_E_SUCCESS) + { + done = 1; + print("Handshake successful in %u handshake calls!", count); + ecore_main_loop_quit(); + } + + return ECORE_CALLBACK_RENEW; +} + +int +main (void) +{ + /* credentials */ + gnutls_anon_client_credentials_t c_anoncred; + gnutls_certificate_credentials_t c_certcred; + + gnutls_session_t client; + int sd; + + /* General init. */ + gnutls_global_init (); + ecore_init(); + gnutls_global_set_log_function (tls_log_func); + gnutls_global_set_log_level (6); + + /* Init client */ + gnutls_anon_allocate_client_credentials (&c_anoncred); + gnutls_certificate_allocate_credentials (&c_certcred); + gnutls_init (&client, GNUTLS_CLIENT); + /* set very specific priorities */ + gnutls_priority_set_direct(client, "NONE:%VERIFY_ALLOW_X509_V1_CA_CRT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+COMP-DEFLATE:+COMP-NULL:+CTYPE-X509:+SHA1:+SHA256:+SHA384:+SHA512:+AES-256-CBC:+AES-128-CBC:+3DES-CBC:+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:+VERS-SSL3.0", NULL); + gnutls_credentials_set (client, GNUTLS_CRD_ANON, c_anoncred); + gnutls_credentials_set (client, GNUTLS_CRD_CERTIFICATE, c_certcred); + gnutls_server_name_set(client, GNUTLS_NAME_DNS, "www.verisign.com", strlen("www.verisign.com")); + + + /* connect to the peer + */ + sd = tcp_connect (); + + /* associate gnutls with socket */ + gnutls_transport_set_ptr (client, (gnutls_transport_ptr_t) sd); + /* add a callback for data being available for send/receive on socket */ + if (!ecore_main_fd_handler_add(sd, ECORE_FD_READ | ECORE_FD_WRITE, (Ecore_Fd_Cb)_process_data, client, NULL, NULL)) + { + print("could not create fd handler!"); + exit(1); + } + /* begin main loop */ + ecore_main_loop_begin(); + + gnutls_bye (client, GNUTLS_SHUT_RDWR); + + gnutls_deinit (client); + + tcp_close (sd); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_file_download_example.c b/libraries/ecore/src/examples/ecore_file_download_example.c new file mode 100644 index 0000000..c03940b --- /dev/null +++ b/libraries/ecore/src/examples/ecore_file_download_example.c @@ -0,0 +1,86 @@ +#include +#include +#include +#include + +/* + * ecore_file_download() example + * + * compile with: + * gcc ecore_file_download_example.c `pkg-config --libs --cflags ecore-file` \ + * -o ecore_file_download_example + * + */ + +#define URL "http://www.kernel.org/pub/linux/kernel/v1.0/linux-1.0.tar.gz" +#define DST "linux-1.0.tar.gz" +#define DST_MIME "[x-gzip]linux-1.0.tar.gz" + + +void +completion_cb(void *data, const char *file, int status) +{ + printf("Done (status: %d)\n", status); + ecore_main_loop_quit(); +} + +int +progress_cb(void *data, const char *file, + long int dltotal, long int dlnow, + long int ultotal, long int ulnow) +{ + printf("Progress: %ld/%ld\n", dlnow, dltotal); + return ECORE_FILE_PROGRESS_CONTINUE; // continue the download +} + + +int main(void) +{ + double start; + Eina_Hash *headers; + + eina_init(); + ecore_init(); + ecore_file_init(); + + if (ecore_file_exists(DST)) + ecore_file_unlink(DST); + + start = ecore_time_get(); + + if (ecore_file_download(URL, DST, completion_cb, progress_cb, NULL, NULL)) + { + printf("Download started successfully:\n URL: %s\n DEST: %s\n", URL, DST); + ecore_main_loop_begin(); + printf("\nTime elapsed: %f seconds\n", ecore_time_get() - start); + printf("Downloaded %lld bytes\n", ecore_file_size(DST)); + } + else + { + printf("Error, can't start download\n"); + goto done; + } + + headers = eina_hash_string_small_new(NULL); + eina_hash_add(headers, "Content-type", "application/x-gzip"); + + if (ecore_file_download_full(URL, DST_MIME, completion_cb, progress_cb, NULL, NULL, headers)) + { + printf("Download started successfully:\n URL: %s\n DEST: %s\n", URL, DST_MIME); + ecore_main_loop_begin(); + printf("\nTime elapsed: %f seconds\n", ecore_time_get() - start); + printf("Downloaded %lld bytes\n", ecore_file_size(DST)); + } + else + { + printf("Error, can't start download\n"); + goto done; + } + +done: + if (headers) eina_hash_free(headers); + ecore_file_shutdown(); + ecore_shutdown(); + eina_shutdown(); + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_idler_example.c b/libraries/ecore/src/examples/ecore_idler_example.c new file mode 100644 index 0000000..d19fce3 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_idler_example.c @@ -0,0 +1,112 @@ +#include +#include + +struct context { // helper struct to give some context to the callbacks + int count; + Ecore_Idle_Enterer *enterer; + Ecore_Idler *idler; + Ecore_Idle_Exiter *exiter; + Ecore_Event_Handler *handler; + Ecore_Timer *timer; +}; + +static _event_type = 0; // a new type of event will be defined and stored here + +static Eina_Bool +_enterer_cb(void *data) // the idle enterer callback +{ + printf("IDLE ENTERER: Ecore entering in idle state.\n"); + + return ECORE_CALLBACK_RENEW; // same as EINA_TRUE +} + +static Eina_Bool +_exiter_cb(void *data) // the idle exiter callback +{ + printf("IDLE EXITER: Ecore exiting idle state.\n"); + + return ECORE_CALLBACK_RENEW; // same as EINA_TRUE +} + +static Eina_Bool +_idler_cb(void *data) // the idler callback - ran while the mainloop is idle +{ + struct context *ctxt = data; + printf("IDLER: executing idler callback while in idle state.\n"); + + ctxt->count++; + + /* each 10 times that the callback gets called, generate an event that + * will wake up the main loop, triggering idle enterers, exiters, etc. */ + if ((ctxt->count % 10) == 0) + ecore_event_add(_event_type, NULL, NULL, NULL); + + return ECORE_CALLBACK_RENEW; // same as EINA_TRUE +} + +static Eina_Bool +_event_handler_cb(void *data, int type, void *event) // event callback +{ + struct context *ctxt = data; + + printf("EVENT: processing callback for the event received.\n"); + + if (ctxt->count > 100) + { + ecore_idle_enterer_del(ctxt->enterer); + ecore_idle_exiter_del(ctxt->exiter); + ecore_idler_del(ctxt->idler); + + ctxt->enterer = NULL; + ctxt->exiter = NULL; + ctxt->idler = NULL; + + if (ctxt->timer) + { + ecore_timer_del(ctxt->timer); + ctxt->timer = NULL; + } + + ecore_main_loop_quit(); + } + + return ECORE_CALLBACK_DONE; // same as EINA_FALSE +} + +static Eina_Bool +_timer_cb(void *data) +{ + struct context *ctxt = data; + printf("TIMER: timer callback called.\n"); + + if (ctxt->timer) + ctxt->timer = NULL; + + return ECORE_CALLBACK_CANCEL; // same as EINA_TRUE +} + +int main(int argc, char **argv) +{ + struct context ctxt = {0}; + + if (!ecore_init()) + { + printf("ERROR: Cannot init Ecore!\n"); + return -1; + } + + _event_type = ecore_event_type_new(); + + ctxt.enterer = ecore_idle_enterer_add(_enterer_cb, &ctxt); + ctxt.exiter = ecore_idle_exiter_add(_exiter_cb, &ctxt); + ctxt.idler = ecore_idler_add(_idler_cb, &ctxt); + ctxt.handler = ecore_event_handler_add(_event_type, + _event_handler_cb, + &ctxt); + ctxt.timer = ecore_timer_add(0.0005, _timer_cb, &ctxt); + + ecore_main_loop_begin(); + ecore_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_job_example.c b/libraries/ecore/src/examples/ecore_job_example.c new file mode 100644 index 0000000..1d28b7b --- /dev/null +++ b/libraries/ecore/src/examples/ecore_job_example.c @@ -0,0 +1,48 @@ +#include +#include + +static void +_job_print_cb(void *data) +{ + char *str = data; + + printf("%s\n", str); +} + +static void +_job_quit_cb(void *data) +{ + ecore_main_loop_quit(); +} + +int main(int argc, char **argv) +{ + Ecore_Job *job1, *job2, *job3, *job_quit; + char *str1 = "Job 1 started."; + char *str2 = "Job 2 started."; + char *str3 = "Job 3 started."; + + if (!ecore_init()) + { + printf("ERROR: Cannot init Ecore!\n"); + return -1; + } + + job1 = ecore_job_add(_job_print_cb, str1); + job2 = ecore_job_add(_job_print_cb, str2); + job3 = ecore_job_add(_job_print_cb, str3); + + job_quit = ecore_job_add(_job_quit_cb, NULL); + printf("Created jobs 1, 2, 3 and quit.\n"); + + if (job2) + { + char *str; + str = ecore_job_del(job2); + job2 = NULL; + printf("Deleted job 2. Its data was: \"%s\"\n", str); + } + + ecore_main_loop_begin(); + ecore_shutdown(); +} diff --git a/libraries/ecore/src/examples/ecore_pipe_gstreamer_example.c b/libraries/ecore/src/examples/ecore_pipe_gstreamer_example.c new file mode 100644 index 0000000..590d957 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_pipe_gstreamer_example.c @@ -0,0 +1,180 @@ +#include +#include + +static int nbr = 0; + +static GstElement *_buid_pipeline (gchar *filename, Ecore_Pipe *pipe); + +static void new_decoded_pad_cb (GstElement *demuxer, + GstPad *new_pad, + gpointer user_data); + +static void handler(void *data, void *buf, unsigned int len) +{ + GstBuffer *buffer = *((GstBuffer **)buf); + + printf ("handler : %p\n", buffer); + printf ("frame : %d %p %lld %p\n", nbr++, data, (long long)GST_BUFFER_DURATION(buffer), buffer); + gst_buffer_unref (buffer); +} + + +static void handoff (GstElement* object, + GstBuffer* arg0, + GstPad* arg1, + gpointer user_data) +{ + Ecore_Pipe *pipe; + + pipe = (Ecore_Pipe *)user_data; + printf ("handoff : %p\n", arg0); + gst_buffer_ref (arg0); + ecore_pipe_write(pipe, &arg0, sizeof(arg0)); +} + +int +main (int argc, char *argv[]) +{ + GstElement *pipeline; + char *filename; + Ecore_Pipe *pipe; + + gst_init (&argc, &argv); + + if (!ecore_init ()) + { + gst_deinit (); + return 0; + } + + pipe = ecore_pipe_add (handler); + if (!pipe) + { + ecore_shutdown (); + gst_deinit (); + return 0; + } + + if (argc < 2) { + g_print ("usage: %s file.avi\n", argv[0]); + ecore_pipe_del (pipe); + ecore_shutdown (); + gst_deinit (); + return 0; + } + filename = argv[1]; + + pipeline = _buid_pipeline (filename, pipe); + if (!pipeline) { + g_print ("Error during the pipeline building\n"); + ecore_pipe_del (pipe); + ecore_shutdown (); + gst_deinit (); + return -1; + } + + gst_element_set_state (pipeline, GST_STATE_PLAYING); + + ecore_main_loop_begin(); + + ecore_pipe_del (pipe); + ecore_shutdown (); + gst_deinit (); + + return 0; +} + +static void +new_decoded_pad_cb (GstElement *demuxer, + GstPad *new_pad, + gpointer user_data) +{ + GstElement *decoder; + GstPad *pad; + GstCaps *caps; + gchar *str; + + caps = gst_pad_get_caps (new_pad); + str = gst_caps_to_string (caps); + + if (g_str_has_prefix (str, "video/")) { + decoder = GST_ELEMENT (user_data); + + pad = gst_element_get_pad (decoder, "sink"); + if (GST_PAD_LINK_FAILED (gst_pad_link (new_pad, pad))) { + g_warning ("Failed to link %s:%s to %s:%s", GST_DEBUG_PAD_NAME (new_pad), + GST_DEBUG_PAD_NAME (pad)); + } + } + g_free (str); + gst_caps_unref (caps); +} + +static GstElement +_buid_pipeline (gchar *filename, Ecore_Pipe *pipe) +{ + GstElement *pipeline; + GstElement *filesrc; + GstElement *demuxer; + GstElement *decoder; + GstElement *sink; + GstStateChangeReturn res; + + pipeline = gst_pipeline_new ("pipeline"); + if (!pipeline) + return NULL; + + filesrc = gst_element_factory_make ("filesrc", "filesrc"); + if (!filesrc) { + printf ("no filesrc"); + goto failure; + } + g_object_set (G_OBJECT (filesrc), "location", filename, NULL); + + demuxer = gst_element_factory_make ("oggdemux", "demuxer"); + if (!demuxer) { + printf ("no demux"); + goto failure; + } + + decoder = gst_element_factory_make ("theoradec", "decoder"); + if (!decoder) { + printf ("no dec"); + goto failure; + } + + g_signal_connect (demuxer, "pad-added", + G_CALLBACK (new_decoded_pad_cb), decoder); + + sink = gst_element_factory_make ("fakesink", "sink"); + if (!sink) { + printf ("no sink"); + goto failure; + } + g_object_set (G_OBJECT (sink), "sync", EINA_TRUE, NULL); + g_object_set (G_OBJECT (sink), "signal-handoffs", EINA_TRUE, NULL); + g_signal_connect (sink, "handoff", + G_CALLBACK (handoff), pipe); + + gst_bin_add_many (GST_BIN (pipeline), + filesrc, demuxer, decoder, sink, NULL); + + if (!gst_element_link (filesrc, demuxer)) + goto failure; + if (!gst_element_link (decoder, sink)) + goto failure; + + res = gst_element_set_state (pipeline, GST_STATE_PAUSED); + if (res == GST_STATE_CHANGE_FAILURE) + goto failure; + + res = gst_element_get_state( pipeline, NULL, NULL, GST_CLOCK_TIME_NONE ); + if (res != GST_STATE_CHANGE_SUCCESS) + goto failure; + + return pipeline; + + failure: + gst_object_unref (GST_OBJECT (pipeline)); + return NULL; +} diff --git a/libraries/ecore/src/examples/ecore_pipe_simple_example.c b/libraries/ecore/src/examples/ecore_pipe_simple_example.c new file mode 100644 index 0000000..02e8bcd --- /dev/null +++ b/libraries/ecore/src/examples/ecore_pipe_simple_example.c @@ -0,0 +1,66 @@ +//Compile with: +//gcc -g -Wall `pkg-config --cflags --libs ecore` -o ecore_pipe_simple_example ecore_pipe_simple_example.c + +#include +#include + +static void +do_lengthy_task(Ecore_Pipe *pipe) +{ + int i, j; + char *buffer; + for (i = 0; i < 20; i++) + { + sleep(1); + buffer = malloc(sizeof(char) * i); + for (j = 0; j < i; j++) + buffer[j] = 'a' + j; + ecore_pipe_write(pipe, buffer, i); + free(buffer); + } + ecore_pipe_write(pipe, "close", 5); +} + +static void +handler(void *data, void *buf, unsigned int len) +{ + char *str = malloc(sizeof(char) * len + 1); + memcpy(str, buf, len); + str[len] = '\0'; + printf("received %d bytes\n", len); + printf("content: %s\n", (const char*)str); + free(str); + if (len && !strncmp(buf, "close", len < 5 ? len : 5)) + { + printf("close requested\n"); + ecore_main_loop_quit(); + } +} + +int +main (int argc, char *argv[]) +{ + Ecore_Pipe *pipe; + pid_t child_pid; + + ecore_init(); + + pipe = ecore_pipe_add(handler, NULL); + + child_pid = fork(); + if(!child_pid) + { + ecore_pipe_read_close(pipe); + do_lengthy_task(pipe); + } + else + { + ecore_pipe_write_close(pipe); + ecore_main_loop_begin(); + } + + ecore_pipe_del(pipe); + ecore_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_poller_example.c b/libraries/ecore/src/examples/ecore_poller_example.c new file mode 100644 index 0000000..a66c069 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_poller_example.c @@ -0,0 +1,47 @@ +#include +#include + +static double _initial_time = 0; + +static Eina_Bool +_poller_print_cb(void *data) +{ + char *str = data; + printf("Ecore Poller '%s' callback called after %0.3f seconds.\n", + str, ecore_time_get() - _initial_time); + + return ECORE_CALLBACK_RENEW; +} + +int main(int argc, char **argv) +{ + double interval = 0.3; // tick each 0.3 seconds + Ecore_Poller *poller1, *poller2; + char *str1 = "poller1"; + char *str2 = "poller2"; + + if (!ecore_init()) + { + printf("ERROR: Cannot init Ecore!\n"); + return -1; + } + + _initial_time = ecore_time_get(); + + ecore_poller_poll_interval_set(ECORE_POLLER_CORE, interval); + + poller1 = ecore_poller_add(ECORE_POLLER_CORE, 4, _poller_print_cb, str1); + poller2 = ecore_poller_add(ECORE_POLLER_CORE, 8, _poller_print_cb, str2); + + ecore_main_loop_begin(); + + printf("changing poller2 interval to 16\n"); + + ecore_poller_poller_interval_set(poller2, 16); + ecore_main_loop_begin(); + + ecore_poller_del(poller1); + ecore_poller_del(poller2); + + ecore_shutdown(); +} diff --git a/libraries/ecore/src/examples/ecore_server_bench.c b/libraries/ecore/src/examples/ecore_server_bench.c new file mode 100644 index 0000000..db0020c --- /dev/null +++ b/libraries/ecore/src/examples/ecore_server_bench.c @@ -0,0 +1,62 @@ +#include +#include +#include + +/* Ecore_Con server example + * 2010 Mike Blumenkrantz + */ + +static Ecore_Con_Server *svr; +static int add; +static int del; + +Eina_Bool +_add(void *data, int type, Ecore_Con_Event_Client_Add *ev) +{ + ++add; +// printf ("%s ", ecore_con_client_ip_get(ev->client)); + printf("Client #%i!\n", add); + return ECORE_CALLBACK_RENEW; +} + +Eina_Bool +_del(void *data, int type, Ecore_Con_Event_Client_Del *ev) +{ + ++del; + printf("Disconnected #%i!\n", del); + if (add == del) + ecore_main_loop_quit(); + return ECORE_CALLBACK_RENEW; +} + +int main(int argc, const char *argv[]) +{ + ecore_init(); + ecore_con_init(); + ecore_app_args_set(argc, argv); + eina_log_domain_level_set("ecore_con", EINA_LOG_LEVEL_ERR); + eina_log_domain_level_set("eina", EINA_LOG_LEVEL_ERR); + + +/* to use a PEM certificate with TLS and SSL3, uncomment the lines below */ +// if (!(svr = ecore_con_server_add(ECORE_CON_REMOTE_NODELAY | ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT, "127.0.0.1", 8080, NULL))) + +/* to use simple tcp with ssl/tls, use this line */ + svr = ecore_con_server_add(ECORE_CON_REMOTE_NODELAY , "127.0.0.1", 8080, NULL); + if (!svr) + exit(1); + + ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb)_add, NULL); + ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb)_del, NULL); + +/* start server */ + ecore_main_loop_begin(); + if (add && del) + { + printf("Restarting server after %i connections\n", add); + add = del = 0; + ecore_con_server_del(svr); + ecore_app_restart(); + } + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_thread_example.c b/libraries/ecore/src/examples/ecore_thread_example.c new file mode 100644 index 0000000..7028b25 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_thread_example.c @@ -0,0 +1,394 @@ +/* + * gcc -o ecore_thread_example ecore_thread_example.c `pkg-config --cflags --libs ecore` + */ +#include +#include +#include +#include +#include + +typedef struct +{ + Ecore_Thread *thread_3; + int msgs_received; + int max_msgs; + Eina_Lock mutex; + Eina_Condition condition; +} App_Data; + +typedef struct +{ + Eina_List *list; +} Thread_Data; + +typedef struct +{ + char *name; + char *base; + Eina_Lock mutex; +} Feedback_Thread_Data; + +typedef struct +{ + int all_done; + Eina_List *list; +} App_Msg; + +static void +_local_data_free(void *data) +{ + Thread_Data *td = data; + char *str; + + EINA_LIST_FREE(td->list, str) + { + printf("Freeing string: %s\n", str); + free(str); + } + free(td); +} + +static void +_short_job(void *data, Ecore_Thread *th) +{ + Thread_Data *td; + int i; + + td = ecore_thread_local_data_find(th, "data"); + if (!td) + { + td = calloc(1, sizeof(Thread_Data)); + if (!td) + { + ecore_thread_cancel(th); + return; + } + ecore_thread_local_data_add(th, "data", td, _local_data_free, + EINA_FALSE); + } + + for (i = 0; i < 10; i++) + { + char buf[200]; + + if (ecore_thread_check(th)) + { + ecore_thread_local_data_del(th, "data"); + break; + } + + snprintf(buf, sizeof(buf), "Thread %p: String number %d", th, i); + td->list = eina_list_append(td->list, strdup(buf)); + sleep(1); + } +} + +static void +_feedback_job(void *data, Ecore_Thread *th) +{ + time_t t; + int i, count; + Feedback_Thread_Data *ftd = NULL; + DIR *dir; + App_Msg *msg; + + count = (int)ecore_thread_global_data_find("count"); + for (i = 0; i < count; i++) + { + char buf[32]; + snprintf(buf, sizeof(buf), "data%d", i); + ftd = ecore_thread_global_data_find(buf); + if (!ftd) + continue; + if (eina_lock_take_try(&ftd->mutex)) + break; + else + ftd = NULL; + } + if (!ftd) + return; + + dir = opendir(ftd->base); + if (!dir) + goto the_end; + + msg = calloc(1, sizeof(App_Msg)); + + t = time(NULL); + while (time(NULL) < t + 2) + { + struct dirent entry, *result; + + if (readdir_r(dir, &entry, &result)) + break; + if (!result) + break; + + if (strlen(result->d_name) >= 10) + msg->list = eina_list_append(msg->list, + strdup(result->d_name)); + } + + closedir(dir); + ecore_thread_feedback(th, msg); + +the_end: + ecore_thread_global_data_del(ftd->name); + free(ftd->name); + free(ftd->base); + eina_lock_release(&ftd->mutex); + eina_lock_free(&ftd->mutex); + free(ftd); + ecore_thread_reschedule(th); +} + +static void +_out_of_pool_job(void *data, Ecore_Thread *th) +{ + App_Data *ad = data; + App_Msg *msg; + + while (1) + { + int msgs; + eina_condition_wait(&ad->condition); + msgs = ad->msgs_received; + eina_lock_release(&ad->mutex); + if (msgs == ad->max_msgs) + { + msg = calloc(1, sizeof(App_Msg)); + msg->all_done = 1; + ecore_thread_feedback(th, msg); + return; + } + } +} + +static void +_print_status(void) +{ + int active, pending_total, pending_feedback, pending_short, available; + + active = ecore_thread_active_get(); + pending_total = ecore_thread_pending_total_get(); + pending_feedback = ecore_thread_pending_feedback_get(); + pending_short = ecore_thread_pending_get(); + available = ecore_thread_available_get(); + + printf("Status:\n\t* Active threads: %d\n" + "\t* Available threads: %d\n" + "\t* Pending short jobs: %d\n" + "\t* Pending feedback jobs: %d\n" + "\t* Pending total: %d\n", active, available, pending_short, + pending_feedback, pending_total); +} + +static void +_feedback_job_msg_cb(void *data, Ecore_Thread *th, void *msg_data) +{ + App_Data *ad = data; + App_Msg *msg = msg_data; + char *str; + + if (msg->all_done) + { + ecore_main_loop_quit(); + free(msg); + return; + } + + _print_status(); + + if (!msg->list) + printf("Received an empty list from thread %p\n", th); + else + { + int i = 0; + printf("Received %d elements from threads %p (printing first 5):\n", + eina_list_count(msg->list), th); + EINA_LIST_FREE(msg->list, str) + { + if (i <= 5) + printf("\t%s\n", str); + free(str); + i++; + } + } + + eina_lock_take(&ad->mutex); + ad->msgs_received++; + eina_condition_signal(&ad->condition); + eina_lock_release(&ad->mutex); + + free(msg); +} + +static void +_thread_end_cb(void *data, Ecore_Thread *th) +{ + App_Data *ad = data; + + printf("Normal termination for thread %p.\n", th); + if (th == ad->thread_3) + ad->thread_3 = NULL; +} + +static void +_thread_cancel_cb(void *data, Ecore_Thread *th) +{ + App_Data *ad = data; + + printf("Thread %p got cancelled.\n", th); + if (th == ad->thread_3) + ad->thread_3 = NULL; +} + +static Eina_Bool +_cancel_timer_cb(void *data) +{ + App_Data *ad = data; + + if (ad->thread_3 && !ecore_thread_check(ad->thread_3)) + ecore_thread_cancel(ad->thread_3); + + return EINA_FALSE; +} + +static Eina_Bool +_status_timer_cb(void *data) +{ + _print_status(); + + return EINA_TRUE; +} + +static const Ecore_Getopt optdesc = { + "ecore_thread_example", + NULL, + "0.0", + "(C) 2011 Enlightenment", + "Public domain?", + "Example program for Ecore_Thread", + 0, + { + ECORE_GETOPT_STORE_INT('t', "threads", "Max number of threads to run"), + ECORE_GETOPT_STORE_INT('m', "msgs", "Max number of messages to receive"), + ECORE_GETOPT_APPEND_METAVAR('p', "path", "Add path for feedback job", + "STRING", ECORE_GETOPT_TYPE_STR), + ECORE_GETOPT_HELP('h', "help"), + ECORE_GETOPT_SENTINEL + } +}; + +int +main(int argc, char *argv[]) +{ + int i, max_threads = 0, max_msgs = 0; + Eina_Bool opt_quit = EINA_FALSE; + Eina_List *path_list = NULL; + App_Data appdata; + Ecore_Getopt_Value values[] = { + ECORE_GETOPT_VALUE_INT(max_threads), + ECORE_GETOPT_VALUE_INT(max_msgs), + ECORE_GETOPT_VALUE_LIST(path_list), + ECORE_GETOPT_VALUE_BOOL(opt_quit), + ECORE_GETOPT_VALUE_NONE + }; + + ecore_init(); + + i = ecore_thread_max_get(); + printf("Initial max threads: %d\n", i); + + memset(&appdata, 0, sizeof(App_Data)); + appdata.max_msgs = 1; + + if (ecore_getopt_parse(&optdesc, values, argc, argv) < 0) + { + printf("Argument parsing failed\n"); + return 1; + } + + if (opt_quit) + return 0; + + if (max_threads) + { + ecore_thread_max_set(max_threads); + printf("Max threads: %d\n", ecore_thread_max_get()); + } + if (max_msgs) + appdata.max_msgs = max_msgs; + + if (!path_list) + { + Feedback_Thread_Data *ftd; + ecore_thread_global_data_add("count", (void *)3, NULL, EINA_FALSE); + ftd = calloc(1, sizeof(Feedback_Thread_Data)); + ftd->name = strdup("data0"); + ftd->base = strdup("/usr/bin"); + eina_lock_new(&ftd->mutex); + ecore_thread_global_data_add(ftd->name, ftd, NULL, EINA_TRUE); + ftd = calloc(1, sizeof(Feedback_Thread_Data)); + ftd->name = strdup("data1"); + ftd->base = strdup("/usr/lib"); + eina_lock_new(&ftd->mutex); + ecore_thread_global_data_add(ftd->name, ftd, NULL, EINA_TRUE); + ftd = calloc(1, sizeof(Feedback_Thread_Data)); + ftd->name = strdup("data2"); + ftd->base = strdup("/usr/share"); + eina_lock_new(&ftd->mutex); + ecore_thread_global_data_add(ftd->name, ftd, NULL, EINA_TRUE); + } + else + { + Feedback_Thread_Data *ftd; + char *str; + ecore_thread_global_data_add("count", + (void *)eina_list_count(path_list), NULL, + EINA_FALSE); + i = 0; + EINA_LIST_FREE(path_list, str) + { + char buf[32]; + snprintf(buf, sizeof(buf), "data%d", i); + ftd = calloc(1, sizeof(Feedback_Thread_Data)); + ftd->name = strdup(buf); + ftd->base = strdup(str); + eina_lock_new(&ftd->mutex); + ecore_thread_global_data_add(ftd->name, ftd, NULL, EINA_TRUE); + free(str); + i++; + } + } + + eina_lock_new(&appdata.mutex); + eina_condition_new(&appdata.condition, &appdata.mutex); + + ecore_thread_feedback_run(_out_of_pool_job, _feedback_job_msg_cb, NULL, + NULL, &appdata, EINA_TRUE); + + ecore_thread_run(_short_job, _thread_end_cb, _thread_cancel_cb, &appdata); + ecore_thread_feedback_run(_feedback_job, _feedback_job_msg_cb, + _thread_end_cb, _thread_cancel_cb, &appdata, + EINA_FALSE); + appdata.thread_3 = ecore_thread_run(_short_job, _thread_end_cb, + _thread_cancel_cb, &appdata); + ecore_thread_feedback_run(_feedback_job, _feedback_job_msg_cb, + _thread_end_cb, _thread_cancel_cb, &appdata, + EINA_FALSE); + + ecore_timer_add(1.0, _cancel_timer_cb, &appdata); + ecore_timer_add(2.0, _status_timer_cb, NULL); + + _print_status(); + + ecore_main_loop_begin(); + + eina_condition_free(&appdata.condition); + eina_lock_free(&appdata.mutex); + + ecore_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/ecore_time_functions_example.c b/libraries/ecore/src/examples/ecore_time_functions_example.c new file mode 100644 index 0000000..5fa5d60 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_time_functions_example.c @@ -0,0 +1,32 @@ +#include +#include + +static Eina_Bool +_timer_cb(void *data) +{ + printf("ecore time: %0.3f\n", ecore_time_get()); + printf("loop time: %0.3f\n", ecore_loop_time_get()); + printf("unix time: %0.3f\n", ecore_time_unix_get()); + printf("\nSleep for 1 second...\n\n"); + sleep(1); + printf("ecore time: %0.3f\n", ecore_time_get()); + printf("loop time: %0.3f\n", ecore_loop_time_get()); + printf("unix time: %0.3f\n", ecore_time_unix_get()); + + ecore_main_loop_quit(); + + return EINA_FALSE; +} + +int main(int argc, char **argv) +{ + if (!ecore_init()) + { + printf("ERROR: Cannot init Ecore!\n"); + return -1; + } + + ecore_timer_add(0.1, _timer_cb, NULL); + ecore_main_loop_begin(); + ecore_shutdown(); +} diff --git a/libraries/ecore/src/examples/ecore_timer_example.c b/libraries/ecore/src/examples/ecore_timer_example.c new file mode 100644 index 0000000..2d5d368 --- /dev/null +++ b/libraries/ecore/src/examples/ecore_timer_example.c @@ -0,0 +1,184 @@ +#include +#include + +#define TIMEOUT_1 1.0 // interval for timer1 +#define TIMEOUT_2 3.0 // timer2 - delay timer1 +#define TIMEOUT_3 8.2 // timer3 - pause timer1 +#define TIMEOUT_4 11.0 // timer4 - resume timer1 +#define TIMEOUT_5 14.0 // timer5 - change interval of timer1 +#define TIMEOUT_6 18.0 // top timer1 and start timer7 and timer8 with changed precision +#define TIMEOUT_7 1.1 // interval for timer7 +#define TIMEOUT_8 1.2 // interval for timer8 +#define DELAY_1 3.0 // delay time for timer1 - used by timer2 +#define INTERVAL1 2.0 // new interval for timer1 - used by timer5 + +static double _initial_time = 0; + +struct context { // helper struct to give some context to the callbacks + Ecore_Timer *timer1; + Ecore_Timer *timer2; + Ecore_Timer *timer3; + Ecore_Timer *timer4; + Ecore_Timer *timer5; + Ecore_Timer *timer6; + Ecore_Timer *timer7; + Ecore_Timer *timer8; +}; + +static double +_get_current_time(void) +{ + return ecore_time_get() - _initial_time; +} + +static Eina_Bool +_timer1_cb(void *data) +{ + printf("Timer1 expired after %0.3f seconds.\n", _get_current_time()); + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_timer2_cb(void *data) +{ + struct context *ctxt = data; + printf("Timer2 expired after %0.3f seconds. " + "Adding delay of %0.3f seconds to timer1.\n", + _get_current_time(), DELAY_1); + + ecore_timer_delay(ctxt->timer1, DELAY_1); + + ctxt->timer2 = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_timer3_cb(void *data) +{ + struct context *ctxt = data; + printf("Timer3 expired after %0.3f seconds. " + "Freezing timer1.\n", _get_current_time()); + + ecore_timer_freeze(ctxt->timer1); + + ctxt->timer3 = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_timer4_cb(void *data) +{ + struct context *ctxt = data; + printf("Timer4 expired after %0.3f seconds. " + "Resuming timer1, which has %0.3f seconds left to expire.\n", + _get_current_time(), ecore_timer_pending_get(ctxt->timer1)); + + ecore_timer_thaw(ctxt->timer1); + + ctxt->timer4 = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_timer5_cb(void *data) +{ + struct context *ctxt = data; + double interval = ecore_timer_interval_get(ctxt->timer1); + + printf("Timer5 expired after %0.3f seconds. " + "Changing interval of timer1 from %0.3f to %0.3f seconds.\n", + _get_current_time(), interval, INTERVAL1); + + ecore_timer_interval_set(ctxt->timer1, INTERVAL1); + + ctxt->timer5 = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_timer7_cb(void *data) +{ + struct context *ctxt = data; + printf("Timer7 expired after %0.3f seconds.\n", _get_current_time()); + + ctxt->timer7 = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_timer8_cb(void *data) +{ + struct context *ctxt = data; + printf("Timer8 expired after %0.3f seconds.\n", _get_current_time()); + + ctxt->timer8 = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_timer6_cb(void *data) +{ + struct context *ctxt = data; + printf("Timer6 expired after %0.3f seconds.\n", _get_current_time()); + + printf("Stopping timer1.\n"); + + ecore_timer_del(ctxt->timer1); + ctxt->timer1 = NULL; + + printf("Starting timer7 (%0.3fs) and timer8 (%0.3fs).\n", + TIMEOUT_7, TIMEOUT_8); + + ctxt->timer7 = ecore_timer_add(TIMEOUT_7, _timer7_cb, ctxt); + ctxt->timer8 = ecore_timer_add(TIMEOUT_8, _timer8_cb, ctxt); + + ecore_timer_precision_set(0.2); + + ctxt->timer6 = NULL; + return ECORE_CALLBACK_CANCEL; +} + +int main(int argc, char **argv) +{ + struct context ctxt = {0}; + + if (!ecore_init()) + { + printf("ERROR: Cannot init Ecore!\n"); + return -1; + } + + _initial_time = ecore_time_get(); + + ctxt.timer1 = ecore_timer_add(TIMEOUT_1, _timer1_cb, &ctxt); + ctxt.timer2 = ecore_timer_add(TIMEOUT_2, _timer2_cb, &ctxt); + ctxt.timer3 = ecore_timer_add(TIMEOUT_3, _timer3_cb, &ctxt); + ctxt.timer4 = ecore_timer_add(TIMEOUT_4, _timer4_cb, &ctxt); + ctxt.timer5 = ecore_timer_add(TIMEOUT_5, _timer5_cb, &ctxt); + ctxt.timer6 = ecore_timer_add(TIMEOUT_6, _timer6_cb, &ctxt); + + printf("start the main loop.\n"); + + ecore_main_loop_begin(); + + if (ctxt.timer1) + ecore_timer_del(ctxt.timer1); + if (ctxt.timer2) + ecore_timer_del(ctxt.timer2); + if (ctxt.timer3) + ecore_timer_del(ctxt.timer3); + if (ctxt.timer4) + ecore_timer_del(ctxt.timer4); + if (ctxt.timer5) + ecore_timer_del(ctxt.timer5); + if (ctxt.timer6) + ecore_timer_del(ctxt.timer6); + if (ctxt.timer7) + ecore_timer_del(ctxt.timer7); + if (ctxt.timer8) + ecore_timer_del(ctxt.timer8); + + ecore_shutdown(); + + return 0; +} diff --git a/libraries/ecore/src/examples/red.png b/libraries/ecore/src/examples/red.png new file mode 100644 index 0000000..dd03528 Binary files /dev/null and b/libraries/ecore/src/examples/red.png differ diff --git a/libraries/ecore/src/lib/Makefile.am b/libraries/ecore/src/lib/Makefile.am new file mode 100644 index 0000000..b13bc18 --- /dev/null +++ b/libraries/ecore/src/lib/Makefile.am @@ -0,0 +1,71 @@ +## Process this file with automake to produce Makefile.in +MAINTAINERCLEANFILES = Makefile.in +SUBDIRS = ecore + +if BUILD_ECORE_INPUT +SUBDIRS += ecore_input +endif + +if BUILD_ECORE_INPUT_EVAS +SUBDIRS += ecore_input_evas +endif + +if BUILD_ECORE_FB +SUBDIRS += ecore_fb +endif + +if BUILD_ECORE_DIRECTFB +SUBDIRS += ecore_directfb +endif + +if BUILD_ECORE_CON +SUBDIRS += ecore_con +endif + +if BUILD_ECORE_X +SUBDIRS += ecore_x +endif + +if BUILD_ECORE_WIN32 +SUBDIRS += ecore_win32 +endif + +if BUILD_ECORE_WINCE +SUBDIRS += ecore_wince +endif + +if BUILD_ECORE_SDL +SUBDIRS += ecore_sdl +endif + +if BUILD_ECORE_PSL1GHT +SUBDIRS += ecore_psl1ght +endif + +if BUILD_ECORE_COCOA +SUBDIRS += ecore_cocoa +endif + +if BUILD_ECORE_IPC +SUBDIRS += ecore_ipc +endif + +if BUILD_ECORE_EVAS +SUBDIRS += ecore_evas +endif + +if BUILD_ECORE_CONFIG +SUBDIRS += ecore_config +endif + +if BUILD_ECORE_FILE +SUBDIRS += ecore_file +endif + +if BUILD_ECORE_IMF +SUBDIRS += ecore_imf +endif + +if BUILD_ECORE_IMF_EVAS +SUBDIRS += ecore_imf_evas +endif diff --git a/libraries/ecore/src/lib/Makefile.in b/libraries/ecore/src/lib/Makefile.in new file mode 100644 index 0000000..b351087 --- /dev/null +++ b/libraries/ecore/src/lib/Makefile.in @@ -0,0 +1,820 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@BUILD_ECORE_INPUT_TRUE@am__append_1 = ecore_input +@BUILD_ECORE_INPUT_EVAS_TRUE@am__append_2 = ecore_input_evas +@BUILD_ECORE_FB_TRUE@am__append_3 = ecore_fb +@BUILD_ECORE_DIRECTFB_TRUE@am__append_4 = ecore_directfb +@BUILD_ECORE_CON_TRUE@am__append_5 = ecore_con +@BUILD_ECORE_X_TRUE@am__append_6 = ecore_x +@BUILD_ECORE_WIN32_TRUE@am__append_7 = ecore_win32 +@BUILD_ECORE_WINCE_TRUE@am__append_8 = ecore_wince +@BUILD_ECORE_SDL_TRUE@am__append_9 = ecore_sdl +@BUILD_ECORE_PSL1GHT_TRUE@am__append_10 = ecore_psl1ght +@BUILD_ECORE_COCOA_TRUE@am__append_11 = ecore_cocoa +@BUILD_ECORE_IPC_TRUE@am__append_12 = ecore_ipc +@BUILD_ECORE_EVAS_TRUE@am__append_13 = ecore_evas +@BUILD_ECORE_CONFIG_TRUE@am__append_14 = ecore_config +@BUILD_ECORE_FILE_TRUE@am__append_15 = ecore_file +@BUILD_ECORE_IMF_TRUE@am__append_16 = ecore_imf +@BUILD_ECORE_IMF_EVAS_TRUE@am__append_17 = ecore_imf_evas +subdir = src/lib +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = ecore ecore_input ecore_input_evas ecore_fb \ + ecore_directfb ecore_con ecore_x ecore_win32 ecore_wince \ + ecore_sdl ecore_psl1ght ecore_cocoa ecore_ipc ecore_evas \ + ecore_config ecore_file ecore_imf ecore_imf_evas +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +SUBDIRS = ecore $(am__append_1) $(am__append_2) $(am__append_3) \ + $(am__append_4) $(am__append_5) $(am__append_6) \ + $(am__append_7) $(am__append_8) $(am__append_9) \ + $(am__append_10) $(am__append_11) $(am__append_12) \ + $(am__append_13) $(am__append_14) $(am__append_15) \ + $(am__append_16) $(am__append_17) +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore/Ecore.h b/libraries/ecore/src/lib/ecore/Ecore.h new file mode 100644 index 0000000..fe4e631 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/Ecore.h @@ -0,0 +1,2346 @@ +/** + @brief Ecore Library Public API Calls + + These routines are used for Ecore Library interaction + */ + +/** + + @mainpage Ecore + + @version 1.1 + @date 2000-2011 + + Please see the @ref authors page for contact details. + + @section intro Introduction + + Ecore is a library of convenience functions. A brief explanation of how to use + it can be found in @ref Ecore_Main_Loop_Page. + + The Ecore library provides the following modules: + @li @ref Ecore_Main_Loop_Group + @li @ref Ecore_File_Group + @li @ref Ecore_Con_Group + @li @link Ecore_Evas.h Ecore_Evas - Evas convenience functions. @endlink + @li @ref Ecore_FB_Group + @li @link Ecore_Ipc.h Ecore_IPC - Inter Process Communication functions. @endlink + @li @link Ecore_X.h Ecore_X - X Windows System wrapper. @endlink + @li @ref Ecore_Win32_Group + @li @ref Ecore_WinCE_Group + + For more info on Ecore usage, there are these @ref Examples. + + @section compiling How to compile using Ecore? + pkgconfig (.pc) files are installed for every ecore module. + Thus, to compile using any of them, you can use something like the following: + + @verbatim + gcc *.c $(pkg-config ecore ecore-$x ecore-$y [...] --cflags --libs) + @endverbatim + + @section install How is it installed? + + Suggested configure options for evas for a Linux desktop X display: + + @verbatim + ./configure \ + make + su - + ... + make install + @endverbatim + + */ + +/** + @page authors Authors + @author Carsten Haitzler + @author Tom Gilbert + @author Burra + @author Chris Ross + @author Term + @author Tilman Sauerbeck + @author Ibukun Olumuyiwa + @author Yuri + @author Nicholas Curran + @author Howell Tam + @author Nathan Ingersoll + @author Andrew Elcock + @author Kim Woelders + @author Sebastian Dransfeld + @author Simon Poole + @author Jorge Luis Zapata Muga + @author dan sinclair + @author Michael 'Mickey' Lauer + @author David 'onefang' Seikel + @author Hisham 'CodeWarrior' Mardam Bey + @author Brian 'rephorm' Mattern + @author Tim Horton + @author Arnaud de Turckheim 'quarium' + @author Matt Barclay + @author Peter Wehrfritz + @author Albin "Lutin" Tonnerre + @author Vincent Torri + @author Lars Munch + @author Andre Dieb + @author Mathieu Taillefumier + @author Rui Miguel Silva Seabra + @author Samsung Electronics + @author Samsung SAIT + @author Nicolas Aguirre + @author Brett Nash + @author Mike Blumenkrantz + @author Leif Middelschulte + @author Mike McCormack + @author Sangho Park + @author Jihoon Kim + @author Daniel Juyung Seo + + Please contact to get in + contact with the developers and maintainers. + */ + +/* + @page Ecore_Main_Loop_Page The Ecore Main Loop + + @section intro What is Ecore? + + Ecore is a clean and tiny event loop library with many modules to do lots of + convenient things for a programmer, to save time and effort. + + It's small and lean, designed to work on embedded systems all the way to + large and powerful multi-cpu workstations. It serialises all system signals, + events etc. into a single event queue, that is easily processed without + needing to worry about concurrency. A properly written, event-driven program + using this kind of programming doesn't need threads, nor has to worry about + concurrency. It turns a program into a state machine, and makes it very + robust and easy to follow. + + Ecore gives you other handy primitives, such as timers to tick over for you + and call specified functions at particular times so the programmer can use + this to do things, like animate, or time out on connections or tasks that take + too long etc. + + Idle handlers are provided too, as well as calls on entering an idle state + (often a very good time to update the state of the program). All events that + enter the system are passed to specific callback functions that the program + sets up to handle those events. Handling them is simple and other Ecore + modules produce more events on the queue, coming from other sources such as + file descriptors etc. + + Ecore also lets you have functions called when file descriptors become active + for reading or writing, allowing for streamlined, non-blocking IO. + + Here is an example of a simple program and its basic event loop flow: + + @image html prog_flow.png + @image latex prog_flow.eps width=\textwidth + + + + @section work How does Ecore work? + + Ecore is very easy to learn and use. All the function calls are designed to + be easy to remember, explicit in describing what they do, and heavily + name-spaced. Ecore programs can start and be very simple. + + For example: + + @code + #include + + int + main(int argc, const char **argv) + { + ecore_init(); + ecore_app_args_set(argc, argv); + ecore_main_loop_begin(); + ecore_shutdown(); + return 0; + } + @endcode + + This program is very simple and doesn't check for errors, but it does start up + and begin a main loop waiting for events or timers to tick off. This program + doesn't set up any, but now we can expand on this simple program a little + more by adding some event handlers and timers. + + @code + #include + + Ecore_Timer *timer1 = NULL; + Ecore_Event_Handler *handler1 = NULL; + double start_time = 0.0; + + int + timer_func(void *data) + { + printf("Tick timer. Sec: %3.2f\n", ecore_time_get() - start_time); + return 1; + } + + int + exit_func(void *data, int ev_type, void *ev) + { + Ecore_Event_Signal_Exit *e; + + e = (Ecore_Event_Signal_Exit *)ev; + if (e->interrupt) printf("Exit: interrupt\n"); + else if (e->quit) printf("Exit: quit\n"); + else if (e->terminate) printf("Exit: terminate\n"); + ecore_main_loop_quit(); + return 1; + } + + int + main(int argc, const char **argv) + { + ecore_init(); + ecore_app_args_set(argc, argv); + start_time = ecore_time_get(); + handler1 = ecore_event_handler_add(ECORE_EVENT_SIGNAL_EXIT, exit_func, NULL); + timer1 = ecore_timer_add(0.5, timer_func, NULL); + ecore_main_loop_begin(); + ecore_shutdown(); + return 0; + } + @endcode + + In the previous example, we initialize our application and get the time at + which our program has started so we can calculate an offset. We set + up a timer to tick off in 0.5 seconds, and since it returns 1, will + keep ticking off every 0.5 seconds until it returns 0, or is deleted + by hand. An event handler is set up to call a function - + exit_func(), + whenever an event of type ECORE_EVENT_SIGNAL_EXIT is received (CTRL-C + on the command line will cause such an event to happen). If this event + occurs it tells you what kind of exit signal was received, and asks + the main loop to quit when it is finished by calling + ecore_main_loop_quit(). + + The handles returned by ecore_timer_add() and + ecore_event_handler_add() are + only stored here as an example. If you don't need to address the timer or + event handler again you don't need to store the result, so just call the + function, and don't assign the result to any variable. + + This program looks slightly more complex than needed to do these simple + things, but in principle, programs don't get any more complex. You add more + event handlers, for more events, will have more timers and such, BUT it all + follows the same principles as shown in this example. + + */ + +/* + @page Ecore_Config_Page The Enlightened Property Library + + The Enlightened Property Library (Ecore_Config) is an adbstraction + from the complexities of writing your own configuration. It provides + many features using the Enlightenment 17 development libraries. + + To use the library, you: + @li Set the default values of your properties. + @li Load the configuration from a file. You must set the default values + first, so that the library knows the correct type of each argument. + + The following examples show how to use the Enlightened Property Library: + @li @link config_basic_example.c config_basic_example.c @endlink + @li @link config_listener_example.c config_listener_example.c @endlink + + */ + +/** + @page X_Window_System_Page X Window System + + The Ecore library includes a wrapper for handling the X window system. + This page briefly explains what the X window system is and various terms + that are used. + */ + +#ifndef _ECORE_H +#define _ECORE_H + +#ifdef _MSC_VER +# include +#endif + +#include + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_ECORE_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_ECORE_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif /* ! _WIN32 */ + +#ifdef _WIN32 +# include +#elif (defined (__FreeBSD__) && (__FreeBSD_version >= 420001)) || defined (__OpenBSD__) +# include +# include +#else +# include +# include +#endif + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup Ecore_Init_Group Ecore initialization and shutdown functions. + * + * @{ + */ + +EAPI int + ecore_init(void); +EAPI int + ecore_shutdown(void); + +/** + * @} + */ + +/** + * + * @defgroup Ecore_Main_Loop_Group Ecore main loop functions + * + * These are functions acting on Ecore's main loop itself or on + * events and infrastructure directly linked to it. This loop is + * designed to work on embedded systems all the way to large and + * powerful multi-cpu workstations. + * + * It serialises all system signals and events into a single event + * queue, that can be easily processed without needing to worry + * about concurrency. A properly written, event-driven program + * using this kind of programming does not need threads. It makes + * the program very robust and easy to follow. + * + * For example, for the main loop to be of any use, you need to be + * able to add @b events and event handlers on it. Events for file + * descriptor events are covered in @ref Ecore_FD_Handler_Group. + * + * Timer functions are covered in @ref Ecore_Time_Group. + * + * There is also provision for callbacks for when the loop enters or + * exits an @b idle state. See @ref Ecore_Idle_Group for more + * information on it. + * + * Functions are also provided for spawning child processes using + * @c fork(). See @ref Ecore_Exe_Group for more details on it. + * + * Here is an example of simple program and its basic event loop + * flow: + * + * @image html prog_flow.png + * @image latex prog_flow.eps width=\textwidth + * + * For examples of setting up and using a main loop, see + * @ref Ecore_Main_Loop_Page. + * + * @{ + */ + +#define ECORE_VERSION_MAJOR 1 +#define ECORE_VERSION_MINOR 0 + +typedef struct _Ecore_Version +{ + int major; + int minor; + int micro; + int revision; +} Ecore_Version; + +EAPI extern Ecore_Version *ecore_version; + +#define ECORE_CALLBACK_CANCEL EINA_FALSE /**< Return value to remove a callback */ +#define ECORE_CALLBACK_RENEW EINA_TRUE /**< Return value to keep a callback */ + +#define ECORE_CALLBACK_PASS_ON EINA_TRUE /**< Return value to pass event to next handler */ +#define ECORE_CALLBACK_DONE EINA_FALSE /**< Return value to stop event handling */ + +/** + * @typedef Ecore_Task_Cb Ecore_Task_Cb + * A callback run for a task (timer, idler, poller, animator, etc) + */ +typedef Eina_Bool (*Ecore_Task_Cb)(void *data); + +/** + * @typedef Ecore_Eselect_Function Ecore_Eselect_Function + * A function which can be used to replace select() in the main loop + */ +typedef int (*Ecore_Select_Function)(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout); + +EAPI void +ecore_main_loop_iterate(void); + +EAPI void + ecore_main_loop_select_func_set(Ecore_Select_Function func); +EAPI Ecore_Select_Function + ecore_main_loop_select_func_get(void); + +EAPI Eina_Bool + ecore_main_loop_glib_integrate(void); +EAPI void + ecore_main_loop_glib_always_integrate_disable(void); + +EAPI void + ecore_main_loop_begin(void); +EAPI void + ecore_main_loop_quit(void); + +/** + * @typedef Ecore_Cb Ecore_Cb + * A generic callback called as a hook when a certain point in + * execution is reached. + */ +typedef void (*Ecore_Cb)(void *data); + +/** + * @typedef Ecore_Data_Cb Ecore_Data_Cb + * A callback which is used to return data to the main function + */ +typedef void *(*Ecore_Data_Cb)(void *data); + +/** + * @brief Call callback asynchronously in the main loop. + * @since 1.1.0 + * + * @param callback The callback to call in the main loop + * @param data The data to give to that call back + * + * For all calls that need to happen in the main loop (most EFL functions do), + * this helper function provides the infrastructure needed to do it safely + * by avoiding dead lock, race condition and properly wake up the main loop. + * + * Remember after that function call, you should never touch again the @p data + * in the thread, it is owned by the main loop and your callback should take + * care of freeing it if necessary. + */ +EAPI void +ecore_main_loop_thread_safe_call_async(Ecore_Cb callback, + void *data); + +/** + * @brief Call callback synchronously in the main loop. + * @since 1.1.0 + * + * @param callback The callback to call in the main loop + * @param data The data to give to that call back + * @return the value returned by the callback in the main loop + * + * For all calls that need to happen in the main loop (most EFL functions do), + * this helper function provides the infrastructure needed to do it safely + * by avoiding dead lock, race condition and properly wake up the main loop. + * + * Remember this function will block until the callback is executed in the + * main loop. It can take time and you have no guaranty about the timeline. + */ +EAPI void * +ecore_main_loop_thread_safe_call_sync(Ecore_Data_Cb callback, + void *data); + +/** + * @brief This function suspend the main loop in a know state + * @since 1.1.0 + * + * @result the number of time ecore_thread_main_loop_begin() has been called + * in this thread, if the main loop was suspended correctly. If not, it return @c -1. + * + * This function suspend the main loop in a know state, this let you + * use any EFL call you want after it return. Be carefull, the main loop + * is blocked until you call ecore_thread_main_loop_end(). This is + * the only sane way to achieve pseudo thread safety. + * + * Notice that until the main loop is blocked, the thread is blocked + * and their is noway around that. + * + * We still advise you, when possible, to use ecore_main_loop_thread_safe_call_async() + * as it will not block the thread nor the main loop. + */ +EAPI int +ecore_thread_main_loop_begin(void); + +/** + * @brief Unlock the main loop. + * @since 1.1.0 + * + * @result the number of time ecore_thread_main_loop_end() need to be called before + * the main loop is unlocked again. @c -1 will be returned if you are trying to unlock + * when there wasn't enough call to ecore_thread_main_loop_begin(). + * + * After a call to ecore_thread_main_loop_begin(), you need to absolutly + * call ecore_thread_main_loop_end(), or you application will stay frozen. + */ +EAPI int +ecore_thread_main_loop_end(void); + +/** + * @} + */ + +/** + * @defgroup Ecore_Event_Group Ecore Event functions + * + * Ecore events are used to wake up the Ecore main loop to warn + * about state changes, tasks completed, data available for reading + * or writing, etc. They are the base of the event oriented + * programming. + * + * The idea is to write many functions (callbacks) that will be + * registered to specific events, and called when these events + * happen. This way, when the system state changes (a mouse click is + * detected, a key is pressed, or the content of a file changes, for + * example), the respective callbacks will be called with some + * information about that event. Usually the function/callback will + * have a data pointer to the event info (the position in the screen + * where the mouse was clicked, the name of the key that was + * pressed, or the name of the file that has changed). + * + * The basic usage, when one needs to watch for an existing event, + * is to register a callback to it using ecore_event_add(). Of + * course it's necessary to know beforehand what are the types of + * events that the system/library will emmit. This should be + * available with the documentation from that system/library. + * + * When writing a library or group of functions that need to inform + * about something, and you already are running on top of a main + * loop, it is usually a good approach to use events. This way you + * allow others to register as many callbacks as necessary to this + * event, and don't have to care about who is registering to it. The + * functions ecore_event_type_new() and ecore_event_add() are + * available for this purpose. + * + * Example that deals with events: + * + * @li @ref ecore_event_example_c + * + * @ingroup Ecore_Main_Loop_Group + * + * @{ + */ + +#define ECORE_EVENT_NONE 0 +#define ECORE_EVENT_SIGNAL_USER 1 /**< User signal event */ +#define ECORE_EVENT_SIGNAL_HUP 2 /**< Hup signal event */ +#define ECORE_EVENT_SIGNAL_EXIT 3 /**< Exit signal event */ +#define ECORE_EVENT_SIGNAL_POWER 4 /**< Power signal event */ +#define ECORE_EVENT_SIGNAL_REALTIME 5 /**< Realtime signal event */ +#define ECORE_EVENT_COUNT 6 + +typedef struct _Ecore_Win32_Handler Ecore_Win32_Handler; /**< A handle for HANDLE handlers on Windows */ +typedef struct _Ecore_Event_Handler Ecore_Event_Handler; /**< A handle for an event handler */ +typedef struct _Ecore_Event_Filter Ecore_Event_Filter; /**< A handle for an event filter */ +typedef struct _Ecore_Event Ecore_Event; /**< A handle for an event */ +typedef struct _Ecore_Event_Signal_User Ecore_Event_Signal_User; /**< User signal event */ +typedef struct _Ecore_Event_Signal_Hup Ecore_Event_Signal_Hup; /**< Hup signal event */ +typedef struct _Ecore_Event_Signal_Exit Ecore_Event_Signal_Exit; /**< Exit signal event */ +typedef struct _Ecore_Event_Signal_Power Ecore_Event_Signal_Power; /**< Power signal event */ +typedef struct _Ecore_Event_Signal_Realtime Ecore_Event_Signal_Realtime; /**< Realtime signal event */ + +/** + * @typedef Ecore_Filter_Cb + * A callback used for filtering events from the main loop. + */ +typedef Eina_Bool (*Ecore_Filter_Cb)(void *data, void *loop_data, int type, void *event); + +/** + * @typedef Ecore_End_Cb Ecore_End_Cb + * This is the callback which is called at the end of a function, + * usually for cleanup purposes. + */ +typedef void (*Ecore_End_Cb)(void *user_data, void *func_data); + +/** + * @typedef Ecore_Event_Handler_Cb Ecore_Event_Handler_Cb + * A callback used by the main loop to handle events of a specified + * type. + */ +typedef Eina_Bool (*Ecore_Event_Handler_Cb)(void *data, int type, void *event); + +struct _Ecore_Event_Signal_User /** User signal event */ +{ + int number; /**< The signal number. Either 1 or 2 */ + void *ext_data; /**< Extension data - not used */ + +#if !defined (_WIN32) && !defined (__lv2ppu__) + siginfo_t data; /**< Signal info */ +#endif +}; + +struct _Ecore_Event_Signal_Hup /** Hup signal event */ +{ + void *ext_data; /**< Extension data - not used */ + +#if !defined (_WIN32) && !defined (__lv2ppu__) + siginfo_t data; /**< Signal info */ +#endif +}; + +struct _Ecore_Event_Signal_Exit /** Exit request event */ +{ + Eina_Bool interrupt : 1; /**< Set if the exit request was an interrupt signal*/ + Eina_Bool quit : 1; /**< set if the exit request was a quit signal */ + Eina_Bool terminate : 1; /**< Set if the exit request was a terminate singal */ + void *ext_data; /**< Extension data - not used */ + +#if !defined (_WIN32) && !defined (__lv2ppu__) + siginfo_t data; /**< Signal info */ +#endif +}; + +struct _Ecore_Event_Signal_Power /** Power event */ +{ + void *ext_data; /**< Extension data - not used */ + +#if !defined (_WIN32) && !defined (__lv2ppu__) + siginfo_t data; /**< Signal info */ +#endif +}; + +struct _Ecore_Event_Signal_Realtime /** Realtime event */ +{ + int num; /**< The realtime signal's number */ + +#if !defined (_WIN32) && !defined (__lv2ppu__) + siginfo_t data; /**< Signal info */ +#endif +}; + +EAPI Ecore_Event_Handler * +ecore_event_handler_add(int type, + Ecore_Event_Handler_Cb func, + const void *data); +EAPI void * + ecore_event_handler_del(Ecore_Event_Handler *event_handler); +EAPI Ecore_Event * + ecore_event_add(int type, + void *ev, + Ecore_End_Cb func_free, + void *data); +EAPI void * + ecore_event_del(Ecore_Event *event); +EAPI void * + ecore_event_handler_data_get(Ecore_Event_Handler *eh); +EAPI void * + ecore_event_handler_data_set(Ecore_Event_Handler *eh, + const void *data); +EAPI int + ecore_event_type_new(void); +EAPI Ecore_Event_Filter * + ecore_event_filter_add(Ecore_Data_Cb func_start, + Ecore_Filter_Cb func_filter, + Ecore_End_Cb func_end, + const void *data); +EAPI void * + ecore_event_filter_del(Ecore_Event_Filter *ef); +EAPI int + ecore_event_current_type_get(void); +EAPI void * + ecore_event_current_event_get(void); + +/** + * @} + */ + +/** + * @defgroup Ecore_Exe_Group Process Spawning Functions + * + * Functions that deal with and send signals to spawned processes. + * + * @ingroup Ecore_Main_Loop_Group + * + * @{ + */ + + #define ECORE_EXE_PRIORITY_INHERIT 9999 + +EAPI extern int ECORE_EXE_EVENT_ADD; /**< A child process has been added */ +EAPI extern int ECORE_EXE_EVENT_DEL; /**< A child process has been deleted (it exited, naming consistent with the rest of ecore). */ +EAPI extern int ECORE_EXE_EVENT_DATA; /**< Data from a child process. */ +EAPI extern int ECORE_EXE_EVENT_ERROR; /**< Errors from a child process. */ + +enum _Ecore_Exe_Flags /* flags for executing a child with its stdin and/or stdout piped back */ +{ + ECORE_EXE_NONE = 0, /**< No exe flags at all */ + ECORE_EXE_PIPE_READ = 1, /**< Exe Pipe Read mask */ + ECORE_EXE_PIPE_WRITE = 2, /**< Exe Pipe Write mask */ + ECORE_EXE_PIPE_ERROR = 4, /**< Exe Pipe error mask */ + ECORE_EXE_PIPE_READ_LINE_BUFFERED = 8, /**< Reads are buffered until a newline and split 1 line per Ecore_Exe_Event_Data_Line */ + ECORE_EXE_PIPE_ERROR_LINE_BUFFERED = 16, /**< Errors are buffered until a newline and split 1 line per Ecore_Exe_Event_Data_Line */ + ECORE_EXE_PIPE_AUTO = 32, /**< stdout and stderr are buffered automatically */ + ECORE_EXE_RESPAWN = 64, /**< FIXME: Exe is restarted if it dies */ + ECORE_EXE_USE_SH = 128, /**< Use /bin/sh to run the command. */ + ECORE_EXE_NOT_LEADER = 256, /**< Do not use setsid() to have the executed process be its own session leader */ + ECORE_EXE_TERM_WITH_PARENT = 512 /**< Makes child receive SIGTERM when parent dies. */ +}; +typedef enum _Ecore_Exe_Flags Ecore_Exe_Flags; + +enum _Ecore_Exe_Win32_Priority +{ + ECORE_EXE_WIN32_PRIORITY_IDLE, /**< Idle priority, for monitoring the system */ + ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL, /**< Below default priority */ + ECORE_EXE_WIN32_PRIORITY_NORMAL, /**< Default priority */ + ECORE_EXE_WIN32_PRIORITY_ABOVE_NORMAL, /**< Above default priority */ + ECORE_EXE_WIN32_PRIORITY_HIGH, /**< High priority, use with care as other threads in the system will not get processor time */ + ECORE_EXE_WIN32_PRIORITY_REALTIME /**< Realtime priority, should be almost never used as it can interrupt system threads that manage mouse input, keyboard input, and background disk flushing */ +}; +typedef enum _Ecore_Exe_Win32_Priority Ecore_Exe_Win32_Priority; + +typedef struct _Ecore_Exe Ecore_Exe; /**< A handle for spawned processes */ + +/** + * @typedef Ecore_Exe_Cb Ecore_Exe_Cb + * A callback to run with the associated @ref Ecore_Exe, usually + * for cleanup purposes. + */ +typedef void (*Ecore_Exe_Cb)(void *data, const Ecore_Exe *exe); + +typedef struct _Ecore_Exe_Event_Add Ecore_Exe_Event_Add; /**< Spawned Exe add event */ +typedef struct _Ecore_Exe_Event_Del Ecore_Exe_Event_Del; /**< Spawned Exe exit event */ +typedef struct _Ecore_Exe_Event_Data_Line Ecore_Exe_Event_Data_Line; /**< Lines from a child process */ +typedef struct _Ecore_Exe_Event_Data Ecore_Exe_Event_Data; /**< Data from a child process */ + +struct _Ecore_Exe_Event_Add /** Process add event */ +{ + Ecore_Exe *exe; /**< The handle to the added process */ + void *ext_data; /**< Extension data - not used */ +}; + +struct _Ecore_Exe_Event_Del /** Process exit event */ +{ + pid_t pid; /**< The process ID of the process that exited */ + int exit_code; /**< The exit code of the process */ + Ecore_Exe *exe; /**< The handle to the exited process, or NULL if not found */ + int exit_signal; /** < The signal that caused the process to exit */ + Eina_Bool exited : 1; /** < set to 1 if the process exited of its own accord */ + Eina_Bool signalled : 1; /** < set to 1 id the process exited due to uncaught signal */ + void *ext_data; /**< Extension data - not used */ +#if !defined (_WIN32) && !defined (__lv2ppu__) + siginfo_t data; /**< Signal info */ +#endif +}; + +struct _Ecore_Exe_Event_Data_Line /**< Lines from a child process */ +{ + char *line; + int size; +}; + +struct _Ecore_Exe_Event_Data /** Data from a child process event */ +{ + Ecore_Exe *exe; /**< The handle to the process */ + void *data; /**< the raw binary data from the child process that was received */ + int size; /**< the size of this data in bytes */ + Ecore_Exe_Event_Data_Line *lines; /**< an array of line data if line buffered, the last one has it's line member set to NULL */ +}; + +EAPI void + ecore_exe_run_priority_set(int pri); +EAPI int + ecore_exe_run_priority_get(void); +EAPI Ecore_Exe * + ecore_exe_run(const char *exe_cmd, + const void *data); +EAPI Ecore_Exe * +ecore_exe_pipe_run(const char *exe_cmd, + Ecore_Exe_Flags flags, + const void *data); +EAPI void +ecore_exe_callback_pre_free_set(Ecore_Exe *exe, + Ecore_Exe_Cb func); +EAPI Eina_Bool +ecore_exe_send(Ecore_Exe *exe, + const void *data, + int size); +EAPI void + ecore_exe_close_stdin(Ecore_Exe *exe); +EAPI void + ecore_exe_auto_limits_set(Ecore_Exe *exe, + int start_bytes, + int end_bytes, + int start_lines, + int end_lines); +EAPI Ecore_Exe_Event_Data * +ecore_exe_event_data_get(Ecore_Exe *exe, + Ecore_Exe_Flags flags); +EAPI void + ecore_exe_event_data_free(Ecore_Exe_Event_Data *data); +EAPI void * + ecore_exe_free(Ecore_Exe *exe); +EAPI pid_t + ecore_exe_pid_get(const Ecore_Exe *exe); +EAPI void + ecore_exe_tag_set(Ecore_Exe *exe, + const char *tag); +EAPI const char * + ecore_exe_tag_get(const Ecore_Exe *exe); +EAPI const char * + ecore_exe_cmd_get(const Ecore_Exe *exe); +EAPI void * + ecore_exe_data_get(const Ecore_Exe *exe); +EAPI void * + ecore_exe_data_set(Ecore_Exe *exe, + void *data); +EAPI Ecore_Exe_Flags + ecore_exe_flags_get(const Ecore_Exe *exe); +EAPI void + ecore_exe_pause(Ecore_Exe *exe); +EAPI void + ecore_exe_continue(Ecore_Exe *exe); +EAPI void + ecore_exe_interrupt(Ecore_Exe *exe); +EAPI void + ecore_exe_quit(Ecore_Exe *exe); +EAPI void + ecore_exe_terminate(Ecore_Exe *exe); +EAPI void + ecore_exe_kill(Ecore_Exe *exe); +EAPI void + ecore_exe_signal(Ecore_Exe *exe, + int num); +EAPI void +ecore_exe_hup(Ecore_Exe *exe); + +/** + * @} + */ + +/** + * @defgroup Ecore_FD_Handler_Group File Event Handling Functions + * + * Functions that deal with file descriptor handlers. + * + * The @ref Ecore_Fd_Handler can be used to watch a file descriptor + * for data available for reading, for the availability to write + * without blocking, and for errors on the file descriptor. + * + * ecore_main_fd_handler_add() is used to setup a handler for a + * given file descriptor. This file descriptor can be the standard + * input, a network socket, a stream received through some driver + * of a hardware decoder, etc. Thus it can contain errors, like a + * disconnection, a broken pipe, and so, and that's why it's + * possible to check for these errors with the @ref ECORE_FD_ERROR + * flag. + * + * An @ref Ecore_Fd_Handler can be used to watch on a file + * descriptor without blocking, still being able to receive events, + * expire timers, and other watch for other things that happen in + * the Ecore main loop. + * + * Example of use of a file descriptor handler: + * @li @ref ecore_fd_handler_example_c + * + * @ingroup Ecore_Main_Loop_Group + * + * @{ + */ + +typedef struct _Ecore_Fd_Handler Ecore_Fd_Handler; /**< A handle for Fd handlers */ + +enum _Ecore_Fd_Handler_Flags +{ + ECORE_FD_READ = 1, /**< Fd Read mask */ + ECORE_FD_WRITE = 2, /**< Fd Write mask */ + ECORE_FD_ERROR = 4 /**< Fd Error mask */ +}; +typedef enum _Ecore_Fd_Handler_Flags Ecore_Fd_Handler_Flags; + +/** + * @typedef Ecore_Fd_Cb Ecore_Fd_Cb + * A callback used by an @ref Ecore_Fd_Handler. + */ +typedef Eina_Bool (*Ecore_Fd_Cb)(void *data, Ecore_Fd_Handler *fd_handler); + +/** + * @typedef Ecore_Fd_Prep_Cb Ecore_Fd_Prep_Cb + * A callback used by an @ref Ecore_Fd_Handler. + */ +typedef void (*Ecore_Fd_Prep_Cb)(void *data, Ecore_Fd_Handler *fd_handler); + +/** + * @typedef Ecore_Win32_Handle_Cb Ecore_Win32_Handle_Cb + * A callback used by an @ref Ecore_Win32_Handler. + */ +typedef Eina_Bool (*Ecore_Win32_Handle_Cb)(void *data, Ecore_Win32_Handler *wh); + +EAPI Ecore_Fd_Handler * +ecore_main_fd_handler_add(int fd, + Ecore_Fd_Handler_Flags flags, + Ecore_Fd_Cb func, + const void *data, + Ecore_Fd_Cb buf_func, + const void *buf_data); +EAPI void +ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, + Ecore_Fd_Prep_Cb func, + const void *data); +EAPI void * + ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler); +EAPI int + ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler); +EAPI Eina_Bool + ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, + Ecore_Fd_Handler_Flags flags); +EAPI void +ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, + Ecore_Fd_Handler_Flags flags); + +EAPI Ecore_Win32_Handler * +ecore_main_win32_handler_add(void *h, + Ecore_Win32_Handle_Cb func, + const void *data); +EAPI void * +ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler); + +/** + * @} + */ + +/** + * @defgroup Ecore_Poller_Group Ecore Poll functions + * + * These functions are for the need to poll information, but provide + * a shared abstracted API to pool such polling to minimise wakeup + * and ensure all the polling happens in as few spots as possible + * areound a core poll interval. For now only 1 core poller type is + * supprted: ECORE_POLLER_CORE + * + * Example of @ref Ecore_Poller: + * @li @ref ecore_poller_example_c + * + * @ingroup Ecore_Main_Loop_Group + * + * @{ + */ + +enum _Ecore_Poller_Type /* Poller types */ +{ + ECORE_POLLER_CORE = 0 /**< The core poller interval */ +}; +typedef enum _Ecore_Poller_Type Ecore_Poller_Type; + +typedef struct _Ecore_Poller Ecore_Poller; /**< A handle for pollers */ + +EAPI void +ecore_poller_poll_interval_set(Ecore_Poller_Type type, + double poll_time); +EAPI double + ecore_poller_poll_interval_get(Ecore_Poller_Type type); +EAPI Eina_Bool + ecore_poller_poller_interval_set(Ecore_Poller *poller, + int interval); +EAPI int + ecore_poller_poller_interval_get(Ecore_Poller *poller); +EAPI Ecore_Poller * + ecore_poller_add(Ecore_Poller_Type type, + int interval, + Ecore_Task_Cb func, + const void *data); +EAPI void *ecore_poller_del(Ecore_Poller *poller); + +/** + * @} + */ + +/** + * @defgroup Ecore_Animator_Group Ecore Animator functions + * + * @brief Ecore animators are a helper to simplify creating + * animations. + * + * Creating an animation is as simple as saying for how long it + * should be run and having a callback that does the animation, + * something like this: + * @code + * static Eina_Bool + * _do_animation(void *data, double pos) + * { + * evas_object_move(data, 100 * pos, 100 * pos); + * ... do some more animating ... + * } + * ... + * ecore_animator_timeline_add(2, _do_animation, my_evas_object); + * @endcode + * In the sample above we create an animation to move + * @c my_evas_object from position (0,0) to (100,100) in 2 seconds. + * + * If your animation will run for an unspecified amount of time you + * can use ecore_animator_add(), which is like using + * ecore_timer_add() with the interval being the + * @ref ecore_animator_frametime_set "framerate". Note that this has + * tangible benefits to creating a timer for each animation in terms + * of performance. + * + * For a more detailed example that show several animation see + * @ref tutorial_ecore_animator. + * + * @ingroup Ecore_Main_Loop_Group + * + * @{ + */ + +typedef struct _Ecore_Animator Ecore_Animator; /**< A handle for animators */ + +enum _Ecore_Pos_Map /* Position mappings */ +{ + ECORE_POS_MAP_LINEAR, /**< Linear 0.0 -> 1.0 */ + ECORE_POS_MAP_ACCELERATE, /**< Start slow then speed up */ + ECORE_POS_MAP_DECELERATE, /**< Start fast then slow down */ + ECORE_POS_MAP_SINUSOIDAL, /**< Start slow, speed up then slow down at end */ + ECORE_POS_MAP_ACCELERATE_FACTOR, /**< Start slow then speed up, v1 being a power factor, 0.0 being linear, 1.0 being normal accelerate, 2.0 being much more pronounced accelerate (squared), 3.0 being cubed, etc. */ + ECORE_POS_MAP_DECELERATE_FACTOR, /**< Start fast then slow down, v1 being a power factor, 0.0 being linear, 1.0 being normal decelerate, 2.0 being much more pronounced decelerate (squared), 3.0 being cubed, etc. */ + ECORE_POS_MAP_SINUSOIDAL_FACTOR, /**< Start slow, speed up then slow down at end, v1 being a power factor, 0.0 being linear, 1.0 being normal sinusoidal, 2.0 being much more pronounced sinusoidal (squared), 3.0 being cubed, etc. */ + ECORE_POS_MAP_DIVISOR_INTERP, /**< Start at gradient * v1, interpolated via power of v2 curve */ + ECORE_POS_MAP_BOUNCE, /**< Start at 0.0 then "drop" like a ball bouncing to the ground at 1.0, and bounce v2 times, with decay factor of v1 */ + ECORE_POS_MAP_SPRING /**< Start at 0.0 then "wobble" like a spring rest position 1.0, and wobble v2 times, with decay factor of v1 */ +}; +typedef enum _Ecore_Pos_Map Ecore_Pos_Map; + +enum _Ecore_Animator_Source /* Timing sources for animators */ +{ + ECORE_ANIMATOR_SOURCE_TIMER, /**< The default system clock/timer based animator that ticks every "frametime" seconds */ + ECORE_ANIMATOR_SOURCE_CUSTOM /**< A custom animator trigger that you need to call ecore_animator_trigger() to make it tick */ +}; +typedef enum _Ecore_Animator_Source Ecore_Animator_Source; + +/** + * @typedef Ecore_Timeline_Cb Ecore_Timeline_Cb + * A callback run for a task (animators with runtimes) + */ +typedef Eina_Bool (*Ecore_Timeline_Cb)(void *data, double pos); + +/** + * @brief Add an animator to call @p func at every animaton tick during main + * loop execution. + * + * @param func The function to call when it ticks off + * @param data The data to pass to the function + * @return A handle to the new animator + * + * This function adds a animator and returns its handle on success and NULL on + * failure. The function @p func will be called every N seconds where N is the + * @p frametime interval set by ecore_animator_frametime_set(). The function + * will be passed the @p data pointer as its parameter. + * + * When the animator @p func is called, it must return a value of either 1 or + * 0. If it returns 1 (or ECORE_CALLBACK_RENEW), it will be called again at + * the next tick, or if it returns 0 (or ECORE_CALLBACK_CANCEL) it will be + * deleted automatically making any references/handles for it invalid. + * + * @note The default @p frametime value is 1/30th of a second. + * + * @see ecore_animator_timeline_add() + * @see ecore_animator_frametime_set() + */ +EAPI Ecore_Animator *ecore_animator_add(Ecore_Task_Cb func, + const void *data); +/** + * @brief Add a animator that runs for a limited time + * + * @param runtime The time to run in seconds + * @param func The function to call when it ticks off + * @param data The data to pass to the function + * @return A handle to the new animator + * + * This function is just like ecore_animator_add() except the animator only + * runs for a limited time specified in seconds by @p runtime. Once the + * runtime the animator has elapsed (animator finished) it will automatically + * be deleted. The callback function @p func can return ECORE_CALLBACK_RENEW + * to keep the animator running or ECORE_CALLBACK_CANCEL ro stop it and have + * it be deleted automatically at any time. + * + * The @p func will ALSO be passed a position parameter that will be in value + * from 0.0 to 1.0 to indicate where along the timeline (0.0 start, 1.0 end) + * the animator run is at. If the callback wishes not to have a linear + * transition it can "map" this value to one of several curves and mappings + * via ecore_animator_pos_map(). + * + * @note The default @p frametime value is 1/30th of a second. + * + * @see ecore_animator_add() + * @see ecore_animator_pos_map() + * @since 1.1.0 + */ +EAPI Ecore_Animator * +ecore_animator_timeline_add(double runtime, + Ecore_Timeline_Cb func, + const void *data); +/** + * @brief Delete the specified animator from the animator list. + * + * @param animator The animator to delete + * @return The data pointer set for the animator on add + * + * Delete the specified @p animator from the set of animators that are + * executed during main loop execution. This function returns the data + * parameter that was being passed to the callback on success, or NULL on + * failure. After this call returns the specified animator object @p animator + * is invalid and should not be used again. It will not get called again after + * deletion. + */ +EAPI void * +ecore_animator_del(Ecore_Animator *animator); +/** + * @brief Suspend the specified animator. + * + * @param animator The animator to delete + * + * The specified @p animator will be temporarly removed from the set of + * animators that are executed during main loop. + * + * @warning Freezing an animator doesn't freeze accounting of how long that + * animator has been running. Therefore if the animator was created with + * ecore_animator_timeline_add() the @p pos argument given to the callback + * will increase as if the animator hadn't been frozen and the animator may + * have it's execution halted if @p runtime elapsed. + */ +EAPI void +ecore_animator_freeze(Ecore_Animator *animator); +/** + * @brief Restore execution of the specified animator. + * + * @param animator The animator to delete + * + * The specified @p animator will be put back in the set of animators that are + * executed during main loop. + */ +EAPI void +ecore_animator_thaw(Ecore_Animator *animator); +/** + * @brief Set the animator call interval in seconds. + * + * @param frametime The time in seconds in between animator ticks. + * + * This function sets the time interval (in seconds) between animator ticks. + * At every tick the callback of every existing animator will be called. + * + * @warning Too small a value may cause performance issues and too high a + * value may cause your animation to seem "jerky". + * + * @note The default @p frametime value is 1/30th of a second. + */ +EAPI void +ecore_animator_frametime_set(double frametime); +/** + * @brief Get the animator call interval in seconds. + * + * @return The time in second in between animator ticks. + * + * This function retrieves the time in seconds between animator ticks. + * + * @see ecore_animator_frametime_set() + */ +EAPI double +ecore_animator_frametime_get(void); +/** + * @brief Maps an input position from 0.0 to 1.0 along a timeline to a + * position in a different curve. + * + * @param pos The input position to map + * @param map The mapping to use + * @param v1 A parameter use by the mapping (pass 0.0 if not used) + * @param v2 A parameter use by the mapping (pass 0.0 if not used) + * @return The mapped value + * + * Takes an input position (0.0 to 1.0) and maps to a new position (normally + * between 0.0 and 1.0, but it may go above/below 0.0 or 1.0 to show that it + * has "overshot" the mark) using some interpolation (mapping) algorithm. + * + * This function useful to create non-linear animations. It offers a variety + * of possible animaton curves to be used: + * @li ECORE_POS_MAP_LINEAR - Linear, returns @p pos + * @li ECORE_POS_MAP_ACCELERATE - Start slow then speed up + * @li ECORE_POS_MAP_DECELERATE - Start fast then slow down + * @li ECORE_POS_MAP_SINUSOIDAL - Start slow, speed up then slow down at end + * @li ECORE_POS_MAP_ACCELERATE_FACTOR - Start slow then speed up, v1 being a + * power factor, 0.0 being linear, 1.0 being ECORE_POS_MAP_ACCELERATE, 2.0 + * being much more pronounced accelerate (squared), 3.0 being cubed, etc. + * @li ECORE_POS_MAP_DECELERATE_FACTOR - Start fast then slow down, v1 being a + * power factor, 0.0 being linear, 1.0 being ECORE_POS_MAP_DECELERATE, 2.0 + * being much more pronounced decelerate (squared), 3.0 being cubed, etc. + * @li ECORE_POS_MAP_SINUSOIDAL_FACTOR - Start slow, speed up then slow down + * at end, v1 being a power factor, 0.0 being linear, 1.0 being + * ECORE_POS_MAP_SINUSOIDAL, 2.0 being much more pronounced sinusoidal + * (squared), 3.0 being cubed, etc. + * @li ECORE_POS_MAP_DIVISOR_INTERP - Start at gradient * v1, interpolated via + * power of v2 curve + * @li ECORE_POS_MAP_BOUNCE - Start at 0.0 then "drop" like a ball bouncing to + * the ground at 1.0, and bounce v2 times, with decay factor of v1 + * @li ECORE_POS_MAP_SPRING - Start at 0.0 then "wobble" like a spring rest + * position 1.0, and wobble v2 times, with decay factor of v1 + * @note When not listed v1 and v2 have no effect. + * + * @image html ecore-pos-map.png + * @image latex ecore-pos-map.eps width=\textwidth + * + * One way to use this would be: + * @code + * double pos; // input position in a timeline from 0.0 to 1.0 + * double out; // output position after mapping + * int x1, y1, x2, y2; // x1 & y1 are start position, x2 & y2 are end position + * int x, y; // x & y are the calculated position + * + * out = ecore_animator_pos_map(pos, ECORE_POS_MAP_BOUNCE, 1.8, 7); + * x = (x1 * out) + (x2 * (1.0 - out)); + * y = (y1 * out) + (y2 * (1.0 - out)); + * move_my_object_to(myobject, x, y); + * @endcode + * This will make an animaton that bounces 7 each times diminishing by a + * factor of 1.8. + * + * @see _Ecore_Pos_Map + * + * @since 1.1.0 + */ +EAPI double +ecore_animator_pos_map(double pos, + Ecore_Pos_Map map, + double v1, + double v2); +/** + * @brief Set the source of animator ticks for the mainloop + * + * @param source The source of animator ticks to use + * + * This sets the source of animator ticks. When an animator is active the + * mainloop will "tick" over frame by frame calling all animators that are + * registered until none are. The mainloop will tick at a given rate based + * on the animator source. The default source is the system clock timer + * source - ECORE_ANIMATOR_SOURCE_TIMER. This source uses the system clock + * to tick over every N seconds (specified by ecore_animator_frametime_set(), + * with the default being 1/30th of a second unless set otherwise). You can + * set a custom tick source by setting the source to + * ECORE_ANIMATOR_SOURCE_CUSTOM and then drive it yourself based on some input + * tick source (like another application via ipc, some vertical blanking + * interrupt interrupt etc.) using + * ecore_animator_custom_source_tick_begin_callback_set() and + * ecore_animator_custom_source_tick_end_callback_set() to set the functions + * that will be called to start and stop the ticking source, which when it + * gets a "tick" should call ecore_animator_custom_tick() to make the "tick" over 1 + * frame. + */ +EAPI void +ecore_animator_source_set(Ecore_Animator_Source source); +/** + * @brief Get the animator source currently set. + * + * @return The current animator source + * + * This gets the current animator source. + * + * @see ecore_animator_source_set() + */ +EAPI Ecore_Animator_Source +ecore_animator_source_get(void); +/** + * @brief Set the function that begins a custom animator tick source + * + * @param func The function to call when ticking is to begin + * @param data The data passed to the tick begin function as its parameter + * + * The Ecore Animator infrastructure handles tracking if animators are needed + * or not and which ones need to be called and when, but when the tick source + * is custom, you have to provide a tick source by calling + * ecore_animator_custom_tick() to indicate a frame tick happened. In order + * to allow the source of ticks to be dynamically enabled or disabled as + * needed, the @p func when set is called to enable the tick source to + * produce tick events that call ecore_animator_custom_tick(). If @p func + * is NULL then no function is called to begin custom ticking. + * + * @see ecore_animator_source_set() + * @see ecore_animator_custom_source_tick_end_callback_set() + * @see ecore_animator_custom_tick() + */ +EAPI void +ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func, + const void *data); +/** + * @brief Set the function that ends a custom animator tick source + * + * @param func The function to call when ticking is to end + * @param data The data passed to the tick end function as its parameter + * + * This function is a matching pair to the function set by + * ecore_animator_custom_source_tick_begin_callback_set() and is called + * when ticking is to stop. If @p func is NULL then no function will be + * called to stop ticking. For more information please see + * ecore_animator_custom_source_tick_begin_callback_set(). + * + * @see ecore_animator_source_set() + * @see ecore_animator_custom_source_tick_begin_callback_set() + * @see ecore_animator_custom_tick() + */ +EAPI void +ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func, + const void *data); +/** + * @brief Trigger a custom animator tick + * + * When animator source is set to ECORE_ANIMATOR_SOURCE_CUSTOM, then calling + * this function triggers a run of all animators currently registered with + * Ecore as this indicates a "frame tick" happened. This will do nothing if + * the animator source(set by ecore_animator_source_set()) is not set to + * ECORE_ANIMATOR_SOURCE_CUSTOM. + * + * @see ecore_animator_source_set() + * @see ecore_animator_custom_source_tick_begin_callback_set + * @see ecore_animator_custom_source_tick_end_callback_set()() + */ +EAPI void +ecore_animator_custom_tick(void); + +/** + * @} + */ + +/** + * @defgroup Ecore_Time_Group Ecore Time functions + * + * Functions that deal with time. These functions include those + * that simply retrieve it in a given format, and those that create + * events based on it. + * + * The timer allows callbacks to be called at specific intervals. + * + * Examples with functions that deal with time: + * @li @ref ecore_time_functions_example_c + * @li @ref ecore_timer_example_c + * + * @ingroup Ecore_Main_Loop_Group + * + * @{ + */ + +typedef struct _Ecore_Timer Ecore_Timer; /**< A handle for timers */ + +EAPI double + ecore_time_get(void); +EAPI double + ecore_time_unix_get(void); +EAPI double + ecore_loop_time_get(void); + +EAPI Ecore_Timer * +ecore_timer_add(double in, + Ecore_Task_Cb func, + const void *data); +EAPI Ecore_Timer * +ecore_timer_loop_add(double in, + Ecore_Task_Cb func, + const void *data); +EAPI void * + ecore_timer_del(Ecore_Timer *timer); +EAPI void + ecore_timer_interval_set(Ecore_Timer *timer, + double in); +EAPI double + ecore_timer_interval_get(Ecore_Timer *timer); +EAPI void + ecore_timer_freeze(Ecore_Timer *timer); +EAPI void + ecore_timer_thaw(Ecore_Timer *timer); +EAPI void + ecore_timer_delay(Ecore_Timer *timer, + double add); +EAPI double + ecore_timer_pending_get(Ecore_Timer *timer); +EAPI double + ecore_timer_precision_get(void); +EAPI void + ecore_timer_precision_set(double precision); +EAPI char * + ecore_timer_dump(void); + +/** + * @} + */ + +/** + * @defgroup Ecore_Idle_Group Ecore Idle functions + * + * Callbacks that are called when the program enters or exits an + * idle state. + * + * The ecore main loop enters an idle state when it is waiting for + * timers to time out, data to come in on a file descriptor or any + * other event to occur. You can set callbacks to be called when + * the main loop enters an idle state, during an idle state or just + * after the program wakes up. + * + * Enterer callbacks are good for updating your program's state, if + * it has a state engine. Once all of the enterer handlers are + * called, the program will enter a "sleeping" state. + * + * Idler callbacks are called when the main loop has called all + * enterer handlers. They are useful for interfaces that require + * polling and timers would be too slow to use. + * + * If no idler callbacks are specified, then the process literally + * goes to sleep. Otherwise, the idler callbacks are called + * continuously while the loop is "idle", using as much CPU as is + * available to the process. + * + * Exiter callbacks are called when the main loop wakes up from an + * idle state. + * + * @note Idle state doesn't mean that the @b program is idle, but + * that the main loop is idle. It doesn't have any timers, + * events, fd handlers or anything else to process (which in most + * event driven programs also means that the @b program is + * idle too, but it's not a rule). The program itself may be doing + * a lot of processing in the idler, or in another thread, for + * example. + * + * Example with functions that deal with idle state: + * + * @li @ref ecore_idler_example_c + * + * @ingroup Ecore_Main_Loop_Group + * + * @{ + */ + +typedef struct _Ecore_Idler Ecore_Idler; /**< A handle for idlers */ +typedef struct _Ecore_Idle_Enterer Ecore_Idle_Enterer; /**< A handle for idle enterers */ +typedef struct _Ecore_Idle_Exiter Ecore_Idle_Exiter; /**< A handle for idle exiters */ + +/** + * Add an idler handler. + * @param func The function to call when idling. + * @param data The data to be passed to this @p func call. + * @return A idler handle if successfully added. NULL otherwise. + * + * Add an idler handle to the event loop, returning a handle on + * success and NULL otherwise. The function @p func will be called + * repeatedly while no other events are ready to be processed, as + * long as it returns 1 (or ECORE_CALLBACK_RENEW). A return of 0 + * (or ECORE_CALLBACK_CANCEL) deletes the idler. + * + * Idlers are useful for progressively prossessing data without blocking. + */ +EAPI Ecore_Idler * +ecore_idler_add(Ecore_Task_Cb func, + const void *data); + +/** + * Delete an idler callback from the list to be executed. + * @param idler The handle of the idler callback to delete + * @return The data pointer passed to the idler callback on success. NULL + * otherwise. + */ +EAPI void * +ecore_idler_del(Ecore_Idler *idler); + +EAPI Ecore_Idle_Enterer * +ecore_idle_enterer_add(Ecore_Task_Cb func, + const void *data); +EAPI Ecore_Idle_Enterer * +ecore_idle_enterer_before_add(Ecore_Task_Cb func, + const void *data); +EAPI void * +ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer); + +EAPI Ecore_Idle_Exiter * +ecore_idle_exiter_add(Ecore_Task_Cb func, + const void *data); +EAPI void * +ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter); + +/** + * @} + */ + +/** + * @defgroup Ecore_Thread_Group Ecore Thread functions + * + * Facilities to run heavy tasks in different threads to avoid blocking + * the main loop. + * + * The EFL is, for the most part, not thread safe. This means that if you + * have some task running in another thread and you have, for example, an + * Evas object to show the status progress of this task, you cannot update + * the object from within the thread. This can only be done from the main + * thread, the one running the main loop. This problem can be solved + * by running a thread that sends messages to the main one using an + * @ref Ecore_Pipe_Group "Ecore_Pipe", but when you need to handle other + * things like cancelling the thread, your code grows in coplexity and gets + * much harder to maintain. + * + * Ecore Thread is here to solve that problem. It is @b not a simple wrapper + * around standard POSIX threads (or the equivalent in other systems) and + * it's not meant to be used to run parallel tasks throughout the entire + * duration of the program, especially when these tasks are performance + * critical, as Ecore manages these tasks using a pool of threads based on + * system configuration. + * + * What Ecore Thread does, is make it a lot easier to dispatch a worker + * function to perform some heavy task and then get the result once it + * completes, without blocking the application's UI. In addition, cancelling + * and rescheduling comes practically for free and the developer needs not + * worry about how many threads are launched, since Ecore will schedule + * them according to the number of processors the system has and maximum + * amount of concurrent threads set for the application. + * + * At the system level, Ecore will start a new thread on an as-needed basis + * until the maximum set is reached. When no more threads can be launched, + * new worker functions will be queued in a waiting list until a thread + * becomes available. This way, system threads will be shared throughout + * different worker functions, but running only one at a time. At the same + * time, a worker function that is rescheduled may be run on a different + * thread the next time. + * + * The ::Ecore_Thread handler has two meanings, depending on what context + * it is on. The one returned when starting a worker with any of the + * functions ecore_thread_run() or ecore_thread_feedback_run() is an + * identifier of that specific instance of the function and can be used from + * the main loop with the ecore_thread_cancel() and ecore_thread_check() + * functions. This handler must not be shared with the worker function + * function running in the thread. This same handler will be the one received + * on the @c end, @c cancel and @c feedback callbacks. + * + * The worker function, that's the one running in the thread, also receives + * an ::Ecore_Thread handler that can be used with ecore_thread_cancel() and + * ecore_thread_check(), sharing the flag with the main loop. But this + * handler is also associated with the thread where the function is running. + * This has strong implications when working with thread local data. + * + * There are two kinds of worker threads Ecore handles: simple, or short, + * workers and feedback workers. + * + * The first kind is for simple functions that perform a + * usually small but time consuming task. Ecore will run this function in + * a thread as soon as one becomes available and notify the calling user of + * its completion once the task is done. + * + * The following image shows the flow of a program running four tasks on + * a pool of two threads. + * + * @image html ecore_thread.png + * @image rtf ecore_thread.png + * @image latex ecore_thread.eps width=\textwidth + * + * For larger tasks that may require continuous communication with the main + * program, the feedback workers provide the same functionality plus a way + * for the function running in the thread to send messages to the main + * thread. + * + * The next diagram omits some details shown in the previous one regarding + * how threads are spawned and tasks are queued, but illustrates how feedback + * jobs communicate with the main loop and the special case of threads + * running out of pool. + * + * @image html ecore_thread_feedback.png + * @image rtf ecore_thread_feedback.png + * @image latex ecore_thread_feedback.eps width=\textwidth + * + * See an overview example in @ref ecore_thread_example_c. + * + * @ingroup Ecore_Main_Loop_Group + * + * @{ + */ + +typedef struct _Ecore_Thread Ecore_Thread; /**< A handle for threaded jobs */ + +/** + * @typedef Ecore_Thread_Cb Ecore_Thread_Cb + * A callback used by Ecore_Thread helper. + */ +typedef void (*Ecore_Thread_Cb)(void *data, Ecore_Thread *thread); +/** + * @typedef Ecore_Thread_Notify_Cb Ecore_Thread_Notify_Cb + * A callback used by the main loop to receive data sent by an + * @ref Ecore_Thread_Group. + */ +typedef void (*Ecore_Thread_Notify_Cb)(void *data, Ecore_Thread *thread, void *msg_data); + +/** + * Schedule a task to run in a parallel thread to avoid locking the main loop + * + * @param func_blocking The function that should run in another thread. + * @param func_end Function to call from main loop when @p func_blocking + * completes its task successfully (may be NULL) + * @param func_cancel Function to call from main loop if the thread running + * @p func_blocking is cancelled or fails to start (may be NULL) + * @param data User context data to pass to all callbacks. + * @return A new thread handler, or NULL on failure + * + * This function will try to create a new thread to run @p func_blocking in, + * or if the maximum number of concurrent threads has been reached, will + * add it to the pending list, where it will wait until a thread becomes + * available. The return value will be an ::Ecore_Thread handle that can + * be used to cancel the thread before its completion. + * + * @note This function should always return immediately, but in the rare + * case that Ecore is built with no thread support, @p func_blocking will + * be called here, actually blocking the main loop. + * + * Once a thread becomes available, @p func_blocking will be run in it until + * it finishes, then @p func_end is called from the thread containing the + * main loop to inform the user of its completion. While in @p func_blocking, + * no functions from the EFL can be used, except for those from Eina that are + * marked to be thread-safe. Even for the latter, caution needs to be taken + * if the data is shared across several threads. + * + * @p func_end will be called from the main thread when @p func_blocking ends, + * so here it's safe to use anything from the EFL freely. + * + * The thread can also be cancelled before its completion calling + * ecore_thread_cancel(), either from the main thread or @p func_blocking. + * In this case, @p func_cancel will be called, also from the main thread + * to inform of this happening. If the thread could not be created, this + * function will be called and it's @c thread parameter will be NULL. It's + * also safe to call any EFL function here, as it will be running in the + * main thread. + * + * Inside @p func_blocking, it's possible to call ecore_thread_reschedule() + * to tell Ecore that this function should be called again. + * + * Be aware that no assumptions can be made about the order in which the + * @p func_end callbacks for each task will be called. Once the function is + * running in a different thread, it's the OS that will handle its running + * schedule, and different functions may take longer to finish than others. + * Also remember that just starting several tasks together doesn't mean they + * will be running at the same time. Ecore will schedule them based on the + * number of threads available for the particular system it's running in, + * so some of the jobs started may be waiting until another one finishes + * before it can execute its own @p func_blocking. + * + * @see ecore_thread_feedback_run() + * @see ecore_thread_cancel() + * @see ecore_thread_reschedule() + * @see ecore_thread_max_set() + */ +EAPI Ecore_Thread * +ecore_thread_run(Ecore_Thread_Cb func_blocking, + Ecore_Thread_Cb func_end, + Ecore_Thread_Cb func_cancel, + const void *data); +/** + * Launch a thread to run a task than can talk back to the main thread + * + * @param func_heavy The function that should run in another thread. + * @param func_notify Function that receives the data sent from the thread + * @param func_end Function to call from main loop when @p func_heavy + * completes its task successfully + * @param func_cancel Function to call from main loop if the thread running + * @p func_heavy is cancelled or fails to start + * @param data User context data to pass to all callback. + * @param try_no_queue If you want to run outside of the thread pool. + * @return A new thread handler, or NULL on failure + * + * See ecore_thread_run() for a general description of this function. + * + * The difference with the above is that ecore_thread_run() is meant for + * tasks that don't need to communicate anything until they finish, while + * this function is provided with a new callback, @p func_notify, that will + * be called from the main thread for every message sent from @p func_heavy + * with ecore_thread_feedback(). + * + * Like with ecore_thread_run(), a new thread will be launched to run + * @p func_heavy unless the maximum number of simultaneous threadas has been + * reached, in which case the function will be scheduled to run whenever a + * running task ends and a thread becomes free. But if @p try_no_queue is + * set, Ecore will first try to launch a thread outside of the pool to run + * the task. If it fails, it will revert to the normal behaviour of using a + * thread from the pool as if @p try_no_queue had not been set. + * + * Keep in mind that Ecore handles the thread pool based on the number of + * CPUs available, but running a thread outside of the pool doesn't count for + * this, so having too many of them may have drastic effects over the + * program's performance. + * + * @see ecore_thread_feedback() + * @see ecore_thread_run() + * @see ecore_thread_cancel() + * @see ecore_thread_reschedule() + * @see ecore_thread_max_set() + */ +EAPI Ecore_Thread * +ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, + Ecore_Thread_Notify_Cb func_notify, + Ecore_Thread_Cb func_end, + Ecore_Thread_Cb func_cancel, + const void *data, + Eina_Bool try_no_queue); +/** + * Cancel a running thread. + * + * @param thread The thread to cancel. + * @return Will return EINA_TRUE if the thread has been cancelled, + * EINA_FALSE if it is pending. + * + * This function can be called both in the main loop or in the running thread. + * + * This function cancels a running thread. If @p thread can be immediately + * cancelled (it's still pending execution after creation or rescheduling), + * then the @c cancel callback will be called, @p thread will be freed and + * the function will return EINA_TRUE. + * + * If the thread is already running, then this function returns EINA_FALSE + * after marking the @p thread as pending cancellation. For the thread to + * actually be terminated, it needs to return from the user function back + * into Ecore control. This can happen in several ways: + * @li The function ends and returns normally. If it hadn't been cancelled, + * @c func_end would be called here, but instead @c func_cancel will happen. + * @li The function returns after requesting to be rescheduled with + * ecore_thread_reschedule(). + * @li The function is prepared to leave early by checking if + * ecore_thread_check() returns EINA_TRUE. + * + * The user function can cancel itself by calling ecore_thread_cancel(), but + * it should always use the ::Ecore_Thread handle passed to it and never + * share it with the main loop thread by means of shared user data or any + * other way. + * + * @p thread will be freed and should not be used again if this function + * returns EINA_TRUE or after the @c func_cancel callback returns. + * + * @see ecore_thread_check() + */ +EAPI Eina_Bool +ecore_thread_cancel(Ecore_Thread *thread); +/** + * Checks if a thread is pending cancellation + * + * @param thread The thread to test. + * @return EINA_TRUE if the thread is pending cancellation, + * EINA_FALSE if it is not. + * + * This function can be called both in the main loop or in the running thread. + * + * When ecore_thread_cancel() is called on an already running task, the + * thread is marked as pending cancellation. This function returns EINA_TRUE + * if this mark is set for the given @p thread and can be used from the + * main loop thread to check if a still active thread has been cancelled, + * or from the user function running in the thread to check if it should + * stop doing what it's doing and return early, effectively cancelling the + * task. + * + * @see ecore_thread_cancel() + */ +EAPI Eina_Bool +ecore_thread_check(Ecore_Thread *thread); +/** + * Sends data from the worker thread to the main loop + * + * @param thread The current ::Ecore_Thread context to send data from + * @param msg_data Data to be transmitted to the main loop + * @return EINA_TRUE if @p msg_data was successfully sent to main loop, + * EINA_FALSE if anything goes wrong. + * + * You should use this function only in the @c func_heavy call. + * + * Only the address to @p msg_data will be sent and once this function + * returns EINA_TRUE, the job running in the thread should never touch the + * contents of it again. The data sent should be malloc()'ed or something + * similar, as long as it's not memory local to the thread that risks being + * overwritten or deleted once it goes out of scope or the thread finishes. + * + * Care must be taken that @p msg_data is properly freed in the @c func_notify + * callback set when creating the thread. + * + * @see ecore_thread_feedback_run() + */ +EAPI Eina_Bool +ecore_thread_feedback(Ecore_Thread *thread, + const void *msg_data); +/** + * Asks for the function in the thread to be called again at a later time + * + * @param thread The current ::Ecore_Thread context to rescheduled + * @return EINA_TRUE if the task was successfully rescheduled, + * EINA_FALSE if anything goes wrong. + * + * This function should be called only from the same function represented + * by @pthread. + * + * Calling this function will mark the thread for a reschedule, so as soon + * as it returns, it will be added to the end of the list of pending tasks. + * If no other tasks are waiting or there are sufficient threads available, + * the rescheduled task will be launched again immediately. + * + * This should never return EINA_FALSE, unless it was called from the wrong + * thread or with the wrong arguments. + * + * The @c func_end callback set when the thread is created will not be + * called until the function in the thread returns without being rescheduled. + * Similarly, if the @p thread is cancelled, the reschedule will not take + * effect. + */ +EAPI Eina_Bool +ecore_thread_reschedule(Ecore_Thread *thread); +/** + * Gets the number of active threads running jobs + * + * @return Number of active threads running jobs + * + * This returns the number of threads currently running jobs of any type + * through the Ecore_Thread API. + * + * @note Jobs started through the ecore_thread_feedback_run() function with + * the @c try_no_queue parameter set to EINA_TRUE will not be accounted for + * in the return of this function unless the thread creation fails and it + * falls back to using one from the pool. + */ +EAPI int +ecore_thread_active_get(void); +/** + * Gets the number of short jobs waiting for a thread to run + * + * @return Number of pending threads running "short" jobs + * + * This returns the number of tasks started with ecore_thread_run() that are + * pending, waiting for a thread to become available to run them. + */ +EAPI int +ecore_thread_pending_get(void); +/** + * Gets the number of feedback jobs waiting for a thread to run + * + * @return Number of pending threads running "feedback" jobs + * + * This returns the number of tasks started with ecore_thread_feedback_run() + * that are pending, waiting for a thread to become available to run them. + */ +EAPI int +ecore_thread_pending_feedback_get(void); +/** + * Gets the total number of pending jobs + * + * @return Number of pending threads running jobs + * + * Same as the sum of ecore_thread_pending_get() and + * ecore_thread_pending_feedback_get(). + */ +EAPI int +ecore_thread_pending_total_get(void); +/** + * Gets the maximum number of threads that can run simultaneously + * + * @return Max possible number of Ecore_Thread's running concurrently + * + * This returns the maximum number of Ecore_Thread's that may be running at + * the same time. If this number is reached, new jobs started by either + * ecore_thread_run() or ecore_thread_feedback_run() will be added to the + * respective pending queue until one of the running threads finishes its + * task and becomes available to run a new one. + * + * By default, this will be the number of available CPUs for the + * running program (as returned by eina_cpu_count()), or 1 if this value + * could not be fetched. + * + * @see ecore_thread_max_set() + * @see ecore_thread_max_reset() + */ +EAPI int +ecore_thread_max_get(void); +/** + * Sets the maximum number of threads allowed to run simultaneously + * + * @param num The new maximum + * + * This sets a new value for the maximum number of concurrently running + * Ecore_Thread's. It @b must an integer between 1 and (2 * @c x), where @c x + * is the number for CPUs available. + * + * @see ecore_thread_max_get() + * @see ecore_thread_max_reset() + */ +EAPI void +ecore_thread_max_set(int num); +/** + * Resets the maximum number of concurrently running threads to the default + * + * This resets the value returned by ecore_thread_max_get() back to its + * default. + * + * @see ecore_thread_max_get() + * @see ecore_thread_max_set() + */ +EAPI void +ecore_thread_max_reset(void); +/** + * Gets the number of threads available for running tasks + * + * @return The number of available threads + * + * Same as doing ecore_thread_max_get() - ecore_thread_active_get(). + * + * This function may return a negative number only in the case the user + * changed the maximum number of running threads while other tasks are + * running. + */ +EAPI int +ecore_thread_available_get(void); +/** + * Adds some data to a hash local to the thread + * + * @param thread The thread context the data belongs to + * @param key The name under which the data will be stored + * @param value The data to add + * @param cb Function to free the data when removed from the hash + * @param direct If true, this will not copy the key string (like + * eina_hash_direct_add()) + * @return EINA_TRUE on success, EINA_FALSE on failure + * + * Ecore Thread has a mechanism to share data across several worker functions + * that run on the same system thread. That is, the data is stored per + * thread and for a worker function to have access to it, it must be run + * by the same thread that stored the data. + * + * When there are no more workers pending, the thread will be destroyed + * along with the internal hash and any data left in it will be freed with + * the @p cb function given. + * + * This set of functions is useful to share things around several instances + * of a function when that thing is costly to create and can be reused, but + * may only be used by one function at a time. + * + * For example, if you have a program doing requisitions to a database, + * these requisitions can be done in threads so that waiting for the + * database to respond doesn't block the UI. Each of these threads will + * run a function, and each function will be dependent on a connection to + * the database, which may not be able to handle more than one request at + * a time so for each running function you will need one connection handle. + * The options then are: + * @li Each function opens a connection when it's called, does the work and + * closes the connection when it finishes. This may be costly, wasting a lot + * of time on resolving hostnames, negotiating permissions and allocating + * memory. + * @li Open the connections in the main loop and pass it to the threads + * using the data pointer. Even worse, it's just as costly as before and now + * it may even be kept with connections open doing nothing until a thread + * becomes available to run the function. + * @li Have a way to share connection handles, so that each instance of the + * function can check if an available connection exists, and if it doesn't, + * create one and add it to the pool. When no more connections are needed, + * they are all closed. + * + * The last option is the most efficient, but it requires a lot of work to + * implement properly. Using thread local data helps to achieve the same + * result while avoiding doing all the tracking work on your code. The way + * to use it would be, at the worker function, to ask for the connection + * with ecore_thread_local_data_find() and if it doesn't exist, then open + * a new one and save it with ecore_thread_local_data_add(). Do the work and + * forget about the connection handle, when everything is done the function + * just ends. The next worker to run on that thread will check if a + * connection exists and find that it does, so the process of opening a + * new one has been spared. When no more workers exist, the thread is + * destroyed and the callback used when saving the connection will be called + * to close it. + * + * This function adds the data @p value to the thread data under the given + * @p key. + * No other value in the hash may have the same @p key. If you need to + * change the value under a @p key, or you don't know if one exists already, + * you can use ecore_thread_local_data_set(). + * + * Neither @p key nor @p value may be NULL and @p key will be copied in the + * hash, unless @p direct is set, in which case the string used should not + * be freed until the data is removed from the hash. + * + * The @p cb function will be called when the data in the hash needs to be + * freed, be it because it got deleted with ecore_thread_local_data_del() or + * because @p thread was terminated and the hash destroyed. This parameter + * may be NULL, in which case @p value needs to be manually freed after + * removing it from the hash with either ecore_thread_local_data_del() or + * ecore_thread_local_data_set(), but it's very unlikely that this is what + * you want. + * + * This function, and all of the others in the @c ecore_thread_local_data + * family of functions, can only be called within the worker function running + * in the thread. Do not call them from the main loop or from a thread + * other than the one represented by @p thread. + * + * @see ecore_thread_local_data_set() + * @see ecore_thread_local_data_find() + * @see ecore_thread_local_data_del() + */ +EAPI Eina_Bool +ecore_thread_local_data_add(Ecore_Thread *thread, + const char *key, + void *value, + Eina_Free_Cb cb, + Eina_Bool direct); +/** + * Sets some data in the hash local to the given thread + * + * @param thread The thread context the data belongs to + * @param key The name under which the data will be stored + * @param value The data to add + * @param cb Function to free the data when removed from the hash + * + * If no data exists in the hash under the @p key, this function adds + * @p value in the hash under the given @p key and returns NULL. + * The key itself is copied. + * + * If the hash already contains something under @p key, the data will be + * replaced by @p value and the old value will be returned. + * + * NULL will also be returned if either @p key or @p value are NULL, or if + * an error occurred. + * + * This function, and all of the others in the @c ecore_thread_local_data + * family of functions, can only be called within the worker function running + * in the thread. Do not call them from the main loop or from a thread + * other than the one represented by @p thread. + * + * @see ecore_thread_local_data_add() + * @see ecore_thread_local_data_del() + * @see ecore_thread_local_data_find() + */ +EAPI void * +ecore_thread_local_data_set(Ecore_Thread *thread, + const char *key, + void *value, + Eina_Free_Cb cb); +/** + * Gets data stored in the hash local to the given thread + * + * @param thread The thread context the data belongs to + * @param key The name under which the data is stored + * @return The value under the given key, or NULL on error + * + * Finds and return the data stored in the shared hash under the key @p key. + * + * This function, and all of the others in the @c ecore_thread_local_data + * family of functions, can only be called within the worker function running + * in the thread. Do not call them from the main loop or from a thread + * other than the one represented by @p thread. + * + * @see ecore_thread_local_data_add() + * @see ecore_thread_local_data_wait() + */ +EAPI void * +ecore_thread_local_data_find(Ecore_Thread *thread, + const char *key); +/** + * Deletes from the thread's hash the data corresponding to the given key + * + * @param thread The thread context the data belongs to + * @param key The name under which the data is stored + * @return EINA_TRUE on success, EINA_FALSE on failure + * + * If there's any data stored associated with @p key in the global hash, + * this function will remove it from it and return EINA_TRUE. If no data + * exists or an error occurs, it returns EINA_FALSE. + * + * If the data was added to the hash with a free function, then it will + * also be freed after removing it from the hash, otherwise it requires + * to be manually freed by the user, which means that if no other reference + * to it exists before calling this function, it will result in a memory + * leak. + * + * This function, and all of the others in the @c ecore_thread_local_data + * family of functions, can only be called within the worker function running + * in the thread. Do not call them from the main loop or from a thread + * other than the one represented by @p thread. + * + * @see ecore_thread_local_data_add() + */ +EAPI Eina_Bool +ecore_thread_local_data_del(Ecore_Thread *thread, + const char *key); + +/** + * Adds some data to a hash shared by all threads + * + * @param key The name under which the data will be stored + * @param value The data to add + * @param cb Function to free the data when removed from the hash + * @param direct If true, this will not copy the key string (like + * eina_hash_direct_add()) + * @return EINA_TRUE on success, EINA_FALSE on failure + * + * Ecore Thread keeps a hash that can be used to share data across several + * threads, including the main loop one, without having to manually handle + * mutexes to do so safely. + * + * This function adds the data @p value to this hash under the given @p key. + * No other value in the hash may have the same @p key. If you need to + * change the value under a @p key, or you don't know if one exists already, + * you can use ecore_thread_global_data_set(). + * + * Neither @p key nor @p value may be NULL and @p key will be copied in the + * hash, unless @p direct is set, in which case the string used should not + * be freed until the data is removed from the hash. + * + * The @p cb function will be called when the data in the hash needs to be + * freed, be it because it got deleted with ecore_thread_global_data_del() or + * because Ecore Thread was shut down and the hash destroyed. This parameter + * may be NULL, in which case @p value needs to be manually freed after + * removing it from the hash with either ecore_thread_global_data_del() or + * ecore_thread_global_data_set(). + * + * Manually freeing any data that was added to the hash with a @p cb function + * is likely to produce a segmentation fault, or any other strange + * happenings, later on in the program. + * + * @see ecore_thread_global_data_del() + * @see ecore_thread_global_data_set() + * @see ecore_thread_global_data_find() + */ +EAPI Eina_Bool +ecore_thread_global_data_add(const char *key, + void *value, + Eina_Free_Cb cb, + Eina_Bool direct); +/** + * Sets some data in the hash shared by all threads + * + * @param key The name under which the data will be stored + * @param value The data to add + * @param cb Function to free the data when removed from the hash + * + * If no data exists in the hash under the @p key, this function adds + * @p value in the hash under the given @p key and returns NULL. + * The key itself is copied. + * + * If the hash already contains something under @p key, the data will be + * replaced by @p value and the old value will be returned. + * + * NULL will also be returned if either @p key or @p value are NULL, or if + * an error occurred. + * + * @see ecore_thread_global_data_add() + * @see ecore_thread_global_data_del() + * @see ecore_thread_global_data_find() + */ +EAPI void * +ecore_thread_global_data_set(const char *key, + void *value, + Eina_Free_Cb cb); +/** + * Gets data stored in the hash shared by all threads + * + * @param key The name under which the data is stored + * @return The value under the given key, or NULL on error + * + * Finds and return the data stored in the shared hash under the key @p key. + * + * Keep in mind that the data returned may be used by more than one thread + * at the same time and no reference counting is done on it by Ecore. + * Freeing the data or modifying its contents may require additional + * precautions to be considered, depending on the application's design. + * + * @see ecore_thread_global_data_add() + * @see ecore_thread_global_data_wait() + */ +EAPI void * +ecore_thread_global_data_find(const char *key); +/** + * Deletes from the shared hash the data corresponding to the given key + * + * @param key The name under which the data is stored + * @return EINA_TRUE on success, EINA_FALSE on failure + * + * If there's any data stored associated with @p key in the global hash, + * this function will remove it from it and return EINA_TRUE. If no data + * exists or an error occurs, it returns EINA_FALSE. + * + * If the data was added to the hash with a free function, then it will + * also be freed after removing it from the hash, otherwise it requires + * to be manually freed by the user, which means that if no other reference + * to it exists before calling this function, it will result in a memory + * leak. + * + * Note, also, that freeing data that other threads may be using will result + * in a crash, so appropriate care must be taken by the application when + * that possibility exists. + * + * @see ecore_thread_global_data_add() + */ +EAPI Eina_Bool +ecore_thread_global_data_del(const char *key); +/** + * Gets data stored in the shared hash, or wait for it if it doesn't exist + * + * @param key The name under which the data is stored + * @param seconds The amount of time in seconds to wait for the data. + * @return The value under the given key, or NULL on error + * + * Finds and return the data stored in the shared hash under the key @p key. + * + * If there's nothing in the hash under the given @p key, the function + * will block and wait up to @p seconds seconds for some other thread to + * add it with either ecore_thread_global_data_add() or + * ecore_thread_global_data_set(). If after waiting there's still no data + * to get, NULL will be returned. + * + * If @p seconds is 0, then no waiting will happen and this function works + * like ecore_thread_global_data_find(). If @p seconds is less than 0, then + * the function will wait indefinitely. + * + * Keep in mind that the data returned may be used by more than one thread + * at the same time and no reference counting is done on it by Ecore. + * Freeing the data or modifying its contents may require additional + * precautions to be considered, depending on the application's design. + * + * @see ecore_thread_global_data_add() + * @see ecore_thread_global_data_find() + */ +EAPI void * +ecore_thread_global_data_wait(const char *key, + double seconds); + +/** + * @} + */ + +/** + * @defgroup Ecore_Pipe_Group Pipe wrapper + * + * These functions wrap the pipe / write / read functions to easily + * integrate its use into ecore's main loop. + * + * The ecore_pipe_add() function creates file descriptors (sockets + * on Windows) and attach a handle to the ecore main loop. That + * handle is called when data is read in the pipe. To write data in + * the pipe, just call ecore_pipe_write(). When you are done, just + * call ecore_pipe_del(). + * + * For examples see here: + * @li @ref tutorial_ecore_pipe_gstreamer_example + * @li @ref tutorial_ecore_pipe_simple_example + * + * @ingroup Ecore_Main_Loop_Group + * + * @{ + */ + +typedef struct _Ecore_Pipe Ecore_Pipe; /**< A handle for pipes */ + +/** + * @typedef Ecore_Pipe_Cb Ecore_Pipe_Cb + * The callback that data written to the pipe is sent to. + */ +typedef void (*Ecore_Pipe_Cb)(void *data, void *buffer, unsigned int nbyte); + +EAPI Ecore_Pipe * +ecore_pipe_add(Ecore_Pipe_Cb handler, + const void *data); +EAPI void * + ecore_pipe_del(Ecore_Pipe *p); +EAPI Eina_Bool + ecore_pipe_write(Ecore_Pipe *p, + const void *buffer, + unsigned int nbytes); +EAPI void + ecore_pipe_write_close(Ecore_Pipe *p); +EAPI void + ecore_pipe_read_close(Ecore_Pipe *p); +EAPI void + ecore_pipe_thaw(Ecore_Pipe *p); +EAPI void + ecore_pipe_freeze(Ecore_Pipe *p); +EAPI int + ecore_pipe_wait(Ecore_Pipe *p, + int message_count, + double wait); + +/** + * @} + */ + +/** + * @defgroup Ecore_Job_Group Ecore Job functions + * + * You can queue jobs that are to be done by the main loop when the + * current event is dealt with. + * + * Jobs are processed by the main loop similarly to events. They + * also will be executed in the order in which they were added. + * + * A good use for them is when you don't want to execute an action + * immeditately, but want to give the control back to the main loop + * so that it will call your job callback when jobs start being + * processed (and if there are other jobs added before yours, they + * will be processed first). This also gives the chance to other + * actions in your program to cancel the job before it is started. + * + * Examples of using @ref Ecore_Job: + * @li @ref ecore_job_example_c + * + * @ingroup Ecore_Main_Loop_Group + * + * @{ + */ + +typedef struct _Ecore_Job Ecore_Job; /**< A job handle */ + +EAPI Ecore_Job * +ecore_job_add(Ecore_Cb func, + const void *data); +EAPI void * +ecore_job_del(Ecore_Job *job); + +/** + * @} + */ + +/** + * @defgroup Ecore_Application_Group Ecore Application functions + * + * @{ + */ + +EAPI void +ecore_app_args_set(int argc, + const char **argv); +EAPI void +ecore_app_args_get(int *argc, + char ***argv); +EAPI void +ecore_app_restart(void); + +/** + * @} + */ + +/** + * @defgroup Ecore_Throttle_Group Ecore Throttle functions + * + * @ingroup Ecore_Main_Loop_Group + * + * @{ + */ + +EAPI void + ecore_throttle_adjust(double amount); +EAPI double + ecore_throttle_get(void); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif +#endif diff --git a/libraries/ecore/src/lib/ecore/Ecore_Getopt.h b/libraries/ecore/src/lib/ecore/Ecore_Getopt.h new file mode 100644 index 0000000..0a11787 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/Ecore_Getopt.h @@ -0,0 +1,419 @@ +#ifndef _ECORE_GETOPT_H +#define _ECORE_GETOPT_H + +#include +#include + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_ECORE_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_ECORE_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif /* ! _WIN32 */ + +/** + * @file Ecore_Getopt.h + * @brief Contains powerful getopt replacement. + * + * This replacement handles both short (-X) or long options (--ABC) + * options, with various actions supported, like storing one value and + * already converting to required type, counting number of + * occurrences, setting true or false values, show help, license, + * copyright and even support user-defined callbacks. + * + * It is provided a set of C Pre Processor macros so definition is + * straightforward. + * + * Values will be stored elsewhere indicated by an array of pointers + * to values, it is given in separate to parser description so you can + * use multiple values with the same parser. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + ECORE_GETOPT_ACTION_STORE, + ECORE_GETOPT_ACTION_STORE_CONST, + ECORE_GETOPT_ACTION_STORE_TRUE, + ECORE_GETOPT_ACTION_STORE_FALSE, + ECORE_GETOPT_ACTION_CHOICE, + ECORE_GETOPT_ACTION_APPEND, + ECORE_GETOPT_ACTION_COUNT, + ECORE_GETOPT_ACTION_CALLBACK, + ECORE_GETOPT_ACTION_HELP, + ECORE_GETOPT_ACTION_VERSION, + ECORE_GETOPT_ACTION_COPYRIGHT, + ECORE_GETOPT_ACTION_LICENSE +} Ecore_Getopt_Action; + +typedef enum { + ECORE_GETOPT_TYPE_STR, + ECORE_GETOPT_TYPE_BOOL, + ECORE_GETOPT_TYPE_SHORT, + ECORE_GETOPT_TYPE_INT, + ECORE_GETOPT_TYPE_LONG, + ECORE_GETOPT_TYPE_USHORT, + ECORE_GETOPT_TYPE_UINT, + ECORE_GETOPT_TYPE_ULONG, + ECORE_GETOPT_TYPE_DOUBLE +} Ecore_Getopt_Type; + +typedef enum { + ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO = 0, + ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES = 1, + ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL = 3 +} Ecore_Getopt_Desc_Arg_Requirement; + +typedef union _Ecore_Getopt_Value Ecore_Getopt_Value; + +typedef struct _Ecore_Getopt_Desc_Store Ecore_Getopt_Desc_Store; +typedef struct _Ecore_Getopt_Desc_Callback Ecore_Getopt_Desc_Callback; +typedef struct _Ecore_Getopt_Desc Ecore_Getopt_Desc; +typedef struct _Ecore_Getopt Ecore_Getopt; + +union _Ecore_Getopt_Value +{ + char **strp; + unsigned char *boolp; + short *shortp; + int *intp; + long *longp; + unsigned short *ushortp; + unsigned int *uintp; + unsigned long *ulongp; + double *doublep; + Eina_List **listp; + void **ptrp; +}; + +struct _Ecore_Getopt_Desc_Store +{ + Ecore_Getopt_Type type; /**< type of data being handled */ + Ecore_Getopt_Desc_Arg_Requirement arg_req; + union + { + const char *strv; + Eina_Bool boolv; + short shortv; + int intv; + long longv; + unsigned short ushortv; + unsigned int uintv; + unsigned long ulongv; + double doublev; + } def; +}; + +struct _Ecore_Getopt_Desc_Callback +{ + Eina_Bool (*func)(const Ecore_Getopt *parser, + const Ecore_Getopt_Desc *desc, + const char *str, + void *data, + Ecore_Getopt_Value *storage); + const void *data; + Ecore_Getopt_Desc_Arg_Requirement arg_req; + const char *def; +}; + +struct _Ecore_Getopt_Desc +{ + char shortname; /**< used with a single dash */ + const char *longname; /**< used with double dashes */ + const char *help; /**< used by --help/ecore_getopt_help() */ + const char *metavar; /**< used by ecore_getopt_help() with nargs > 0 */ + + Ecore_Getopt_Action action; /**< define how to handle it */ + union + { + const Ecore_Getopt_Desc_Store store; + const void *store_const; + const char *const *choices; /* NULL terminated. */ + const Ecore_Getopt_Type append_type; + const Ecore_Getopt_Desc_Callback callback; + const void *dummy; + } action_param; +}; + +struct _Ecore_Getopt +{ + const char *prog; /**< to be used when ecore_app_args_get() fails */ + const char *usage; /**< usage example, %prog is replaced */ + const char *version; /**< if exists, --version will work */ + const char *copyright; /**< if exists, --copyright will work */ + const char *license; /**< if exists, --license will work */ + const char *description; /**< long description, possible multiline */ + Eina_Bool strict : 1; /**< fail on errors */ + const Ecore_Getopt_Desc descs[]; /* NULL terminated. */ +}; + +#define ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, type, arg_requirement, default_value) \ + {shortname, longname, help, metavar, ECORE_GETOPT_ACTION_STORE, \ + {.store = {type, arg_requirement, default_value}}} + +#define ECORE_GETOPT_STORE(shortname, longname, help, type) \ + ECORE_GETOPT_STORE_FULL(shortname, longname, help, NULL, type, \ + ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES, {}) + +#define ECORE_GETOPT_STORE_STR(shortname, longname, help) \ + ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_STR) +#define ECORE_GETOPT_STORE_BOOL(shortname, longname, help) \ + ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_BOOL) +#define ECORE_GETOPT_STORE_SHORT(shortname, longname, help) \ + ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_SHORT) +#define ECORE_GETOPT_STORE_INT(shortname, longname, help) \ + ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_INT) +#define ECORE_GETOPT_STORE_LONG(shortname, longname, help) \ + ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_LONG) +#define ECORE_GETOPT_STORE_USHORT(shortname, longname, help) \ + ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_USHORT) +#define ECORE_GETOPT_STORE_UINT(shortname, longname, help) \ + ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_UINT) +#define ECORE_GETOPT_STORE_ULONG(shortname, longname, help) \ + ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_ULONG) +#define ECORE_GETOPT_STORE_DOUBLE(shortname, longname, help) \ + ECORE_GETOPT_STORE(shortname, longname, help, ECORE_GETOPT_TYPE_DOUBLE) + +#define ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, type) \ + ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, type, \ + ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES, {}) + +#define ECORE_GETOPT_STORE_METAVAR_STR(shortname, longname, help, metavar) \ + ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_STR) +#define ECORE_GETOPT_STORE_METAVAR_BOOL(shortname, longname, help, metavar) \ + ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_BOOL) +#define ECORE_GETOPT_STORE_METAVAR_SHORT(shortname, longname, help, metavar) \ + ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_SHORT) +#define ECORE_GETOPT_STORE_METAVAR_INT(shortname, longname, help, metavar) \ + ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_INT) +#define ECORE_GETOPT_STORE_METAVAR_LONG(shortname, longname, help, metavar) \ + ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_LONG) +#define ECORE_GETOPT_STORE_METAVAR_USHORT(shortname, longname, help, metavar) \ + ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_USHORT) +#define ECORE_GETOPT_STORE_METAVAR_UINT(shortname, longname, help, metavar) \ + ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_UINT) +#define ECORE_GETOPT_STORE_METAVAR_ULONG(shortname, longname, help, metavar) \ + ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_ULONG) +#define ECORE_GETOPT_STORE_METAVAR_DOUBLE(shortname, longname, help, metavar) \ + ECORE_GETOPT_STORE_METAVAR(shortname, longname, help, metavar, ECORE_GETOPT_TYPE_DOUBLE) + +#define ECORE_GETOPT_STORE_DEF(shortname, longname, help, type, default_value) \ + ECORE_GETOPT_STORE_FULL(shortname, longname, help, NULL, type, \ + ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL, \ + default_value) + +#define ECORE_GETOPT_STORE_DEF_STR(shortname, longname, help, default_value) \ + ECORE_GETOPT_STORE_DEF(shortname, longname, help, \ + ECORE_GETOPT_TYPE_STR, \ + {.strv = default_value}) +#define ECORE_GETOPT_STORE_DEF_BOOL(shortname, longname, help, default_value) \ + ECORE_GETOPT_STORE_DEF(shortname, longname, help, \ + ECORE_GETOPT_TYPE_BOOL, \ + {.boolv = default_value}) +#define ECORE_GETOPT_STORE_DEF_SHORT(shortname, longname, help, default_value) \ + ECORE_GETOPT_STORE_DEF(shortname, longname, help, \ + ECORE_GETOPT_TYPE_SHORT, \ + {.shortv = default_value}) +#define ECORE_GETOPT_STORE_DEF_INT(shortname, longname, help, default_value) \ + ECORE_GETOPT_STORE_DEF(shortname, longname, help, \ + ECORE_GETOPT_TYPE_INT, \ + {.intv = default_value}) +#define ECORE_GETOPT_STORE_DEF_LONG(shortname, longname, help, default_value) \ + ECORE_GETOPT_STORE_DEF(shortname, longname, help, \ + ECORE_GETOPT_TYPE_LONG, \ + {.longv = default_value}) +#define ECORE_GETOPT_STORE_DEF_USHORT(shortname, longname, help, default_value) \ + ECORE_GETOPT_STORE_DEF(shortname, longname, help, \ + ECORE_GETOPT_TYPE_USHORT, \ + {.ushortv = default_value}) +#define ECORE_GETOPT_STORE_DEF_UINT(shortname, longname, help, default_value) \ + ECORE_GETOPT_STORE_DEF(shortname, longname, help, \ + ECORE_GETOPT_TYPE_UINT, \ + {.uintv = default_value}) +#define ECORE_GETOPT_STORE_DEF_ULONG(shortname, longname, help, default_value) \ + ECORE_GETOPT_STORE_DEF(shortname, longname, help, \ + ECORE_GETOPT_TYPE_ULONG, \ + {.ulongv = default_value}) +#define ECORE_GETOPT_STORE_DEF_DOUBLE(shortname, longname, help, default_value) \ + ECORE_GETOPT_STORE_DEF(shortname, longname, help, \ + ECORE_GETOPT_TYPE_DOUBLE, \ + {.doublev = default_value}) + +#define ECORE_GETOPT_STORE_FULL_STR(shortname, longname, help, metavar, arg_requirement, default_value) \ + ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \ + ECORE_GETOPT_TYPE_STR, \ + arg_requirement, \ + {.strv = default_value}) +#define ECORE_GETOPT_STORE_FULL_BOOL(shortname, longname, help, metavar, arg_requirement, default_value) \ + ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \ + ECORE_GETOPT_TYPE_BOOL, \ + arg_requirement, \ + {.boolv = default_value}) +#define ECORE_GETOPT_STORE_FULL_SHORT(shortname, longname, help, metavar, arg_requirement, default_value) \ + ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \ + ECORE_GETOPT_TYPE_SHORT, \ + arg_requirement, \ + {.shortv = default_value}) +#define ECORE_GETOPT_STORE_FULL_INT(shortname, longname, help, metavar, arg_requirement, default_value) \ + ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \ + ECORE_GETOPT_TYPE_INT, \ + arg_requirement, \ + {.intv = default_value}) +#define ECORE_GETOPT_STORE_FULL_LONG(shortname, longname, help, metavar, arg_requirement, default_value) \ + ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \ + ECORE_GETOPT_TYPE_LONG, \ + arg_requirement, \ + {.longv = default_value}) +#define ECORE_GETOPT_STORE_FULL_USHORT(shortname, longname, help, metavar, arg_requirement, default_value) \ + ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \ + ECORE_GETOPT_TYPE_USHORT, \ + arg_requirement, \ + {.ushortv = default_value}) +#define ECORE_GETOPT_STORE_FULL_UINT(shortname, longname, help, metavar, arg_requirement, default_value) \ + ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \ + ECORE_GETOPT_TYPE_UINT, \ + arg_requirement, \ + {.uintv = default_value}) +#define ECORE_GETOPT_STORE_FULL_ULONG(shortname, longname, help, metavar, arg_requirement, default_value) \ + ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \ + ECORE_GETOPT_TYPE_ULONG, \ + arg_requirement, \ + {.ulongv = default_value}) +#define ECORE_GETOPT_STORE_FULL_DOUBLE(shortname, longname, help, metavar, arg_requirement, default_value) \ + ECORE_GETOPT_STORE_FULL(shortname, longname, help, metavar, \ + ECORE_GETOPT_TYPE_DOUBLE, \ + arg_requirement, \ + {.doublev = default_value}) + +#define ECORE_GETOPT_STORE_CONST(shortname, longname, help, value) \ + {shortname, longname, help, NULL, ECORE_GETOPT_ACTION_STORE_CONST, \ + {.store_const = value}} +#define ECORE_GETOPT_STORE_TRUE(shortname, longname, help) \ + {shortname, longname, help, NULL, ECORE_GETOPT_ACTION_STORE_TRUE, \ + {.dummy = NULL}} +#define ECORE_GETOPT_STORE_FALSE(shortname, longname, help) \ + {shortname, longname, help, NULL, ECORE_GETOPT_ACTION_STORE_FALSE, \ + {.dummy = NULL}} + +#define ECORE_GETOPT_CHOICE(shortname, longname, help, choices_array) \ + {shortname, longname, help, NULL, ECORE_GETOPT_ACTION_CHOICE, \ + {.choices = choices_array}} +#define ECORE_GETOPT_CHOICE_METAVAR(shortname, longname, help, metavar, choices_array) \ + {shortname, longname, help, metavar, ECORE_GETOPT_ACTION_CHOICE, \ + {.choices = choices_array}} + +#define ECORE_GETOPT_APPEND(shortname, longname, help, sub_type) \ + {shortname, longname, help, NULL, ECORE_GETOPT_ACTION_APPEND, \ + {.append_type = sub_type}} +#define ECORE_GETOPT_APPEND_METAVAR(shortname, longname, help, metavar, type) \ + {shortname, longname, help, metavar, ECORE_GETOPT_ACTION_APPEND, \ + {.append_type = type}} + +#define ECORE_GETOPT_COUNT(shortname, longname, help) \ + {shortname, longname, help, NULL, ECORE_GETOPT_ACTION_COUNT, \ + {.dummy = NULL}} + +#define ECORE_GETOPT_CALLBACK_FULL(shortname, longname, help, metavar, callback_func, callback_data, argument_requirement, default_value) \ + {shortname, longname, help, metavar, ECORE_GETOPT_ACTION_CALLBACK, \ + {.callback = {callback_func, callback_data, \ + argument_requirement, default_value}}} +#define ECORE_GETOPT_CALLBACK_NOARGS(shortname, longname, help, callback_func, callback_data) \ + ECORE_GETOPT_CALLBACK_FULL(shortname, longname, help, NULL, \ + callback_func, callback_data, \ + ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO, \ + NULL) +#define ECORE_GETOPT_CALLBACK_ARGS(shortname, longname, help, metavar, callback_func, callback_data) \ + ECORE_GETOPT_CALLBACK_FULL(shortname, longname, help, metavar, \ + callback_func, callback_data, \ + ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES, \ + NULL) + +#define ECORE_GETOPT_HELP(shortname, longname) \ + {shortname, longname, "show this message.", NULL, \ + ECORE_GETOPT_ACTION_HELP, \ + {.dummy = NULL}} + +#define ECORE_GETOPT_VERSION(shortname, longname) \ + {shortname, longname, "show program version.", NULL, \ + ECORE_GETOPT_ACTION_VERSION, \ + {.dummy = NULL}} + +#define ECORE_GETOPT_COPYRIGHT(shortname, longname) \ + {shortname, longname, "show copyright.", NULL, \ + ECORE_GETOPT_ACTION_COPYRIGHT, \ + {.dummy = NULL}} + +#define ECORE_GETOPT_LICENSE(shortname, longname) \ + {shortname, longname, "show license.", NULL, \ + ECORE_GETOPT_ACTION_LICENSE, \ + {.dummy = NULL}} + +#define ECORE_GETOPT_SENTINEL {0, NULL, NULL, NULL, 0, {.dummy = NULL}} + +#define ECORE_GETOPT_VALUE_STR(val) {.strp = &(val)} +#define ECORE_GETOPT_VALUE_BOOL(val) {.boolp = &(val)} +#define ECORE_GETOPT_VALUE_SHORT(val) {.shortp = &(val)} +#define ECORE_GETOPT_VALUE_INT(val) {.intp = &(val)} +#define ECORE_GETOPT_VALUE_LONG(val) {.longp = &(val)} +#define ECORE_GETOPT_VALUE_USHORT(val) {.ushortp = &(val)} +#define ECORE_GETOPT_VALUE_UINT(val) {.uintp = &(val)} +#define ECORE_GETOPT_VALUE_ULONG(val) {.ulongp = &(val)} +#define ECORE_GETOPT_VALUE_DOUBLE(val) {.doublep = &(val)} +#define ECORE_GETOPT_VALUE_PTR(val) {.ptrp = &(val)} +#define ECORE_GETOPT_VALUE_PTR_CAST(val) {.ptrp = (void **)&(val)} +#define ECORE_GETOPT_VALUE_LIST(val) {.listp = &(val)} +#define ECORE_GETOPT_VALUE_NONE {.ptrp = NULL} + +EAPI void +ecore_getopt_help(FILE *fp, + const Ecore_Getopt *info); + +EAPI Eina_Bool + ecore_getopt_parser_has_duplicates(const Ecore_Getopt *parser); +EAPI int + ecore_getopt_parse(const Ecore_Getopt *parser, + Ecore_Getopt_Value *values, + int argc, + char **argv); + +EAPI Eina_List *ecore_getopt_list_free(Eina_List *list); + +/* helper functions to be used with ECORE_GETOPT_CALLBACK_*() */ +EAPI Eina_Bool +ecore_getopt_callback_geometry_parse(const Ecore_Getopt *parser, + const Ecore_Getopt_Desc *desc, + const char *str, + void *data, + Ecore_Getopt_Value *storage); +EAPI Eina_Bool +ecore_getopt_callback_size_parse(const Ecore_Getopt *parser, + const Ecore_Getopt_Desc *desc, + const char *str, + void *data, + Ecore_Getopt_Value *storage); + +#ifdef __cplusplus +} +#endif +#endif /* _ECORE_GETOPT_H */ diff --git a/libraries/ecore/src/lib/ecore/Makefile.am b/libraries/ecore/src/lib/ecore/Makefile.am new file mode 100644 index 0000000..2fb6a0a --- /dev/null +++ b/libraries/ecore/src/lib/ecore/Makefile.am @@ -0,0 +1,60 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = @GLIB_CFLAGS@ @EVIL_CFLAGS@ @EINA_CFLAGS@ @WIN32_CPPFLAGS@ @EFL_ECORE_BUILD@ +AM_CFLAGS = @WIN32_CFLAGS@ @EFL_PTHREAD_CFLAGS@ + +lib_LTLIBRARIES = libecore.la +includes_HEADERS = \ +Ecore.h \ +Ecore_Getopt.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_la_SOURCES = \ +ecore.c \ +ecore_anim.c \ +ecore_app.c \ +ecore_events.c \ +ecore_getopt.c \ +ecore_idle_enterer.c \ +ecore_idle_exiter.c \ +ecore_idler.c \ +ecore_job.c \ +ecore_main.c \ +ecore_pipe.c \ +ecore_poll.c \ +ecore_time.c \ +ecore_timer.c \ +ecore_thread.c \ +ecore_glib.c \ +ecore_throttle.c + +if ECORE_HAVE_WIN32 + +libecore_la_SOURCES += ecore_exe_win32.c + +else + +if ECORE_HAVE_WINCE + +libecore_la_SOURCES += ecore_exe_wince.c + +else + +if ECORE_HAVE_PS3 + +libecore_la_SOURCES += ecore_exe_ps3.c + +else + +libecore_la_SOURCES += ecore_signal.c ecore_exe.c + +endif + +endif + +endif + +libecore_la_LIBADD = @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ @rt_libs@ -lm +libecore_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ @EFL_PTHREAD_LIBS@ + +EXTRA_DIST = ecore_private.h diff --git a/libraries/ecore/src/lib/ecore/Makefile.in b/libraries/ecore/src/lib/ecore/Makefile.in new file mode 100644 index 0000000..e19bfde --- /dev/null +++ b/libraries/ecore/src/lib/ecore/Makefile.in @@ -0,0 +1,853 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@ECORE_HAVE_WIN32_TRUE@am__append_1 = ecore_exe_win32.c +@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_TRUE@am__append_2 = ecore_exe_wince.c +@ECORE_HAVE_PS3_TRUE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__append_3 = ecore_exe_ps3.c +@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__append_4 = ecore_signal.c ecore_exe.c +subdir = src/lib/ecore +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_la_DEPENDENCIES = +am__libecore_la_SOURCES_DIST = ecore.c ecore_anim.c ecore_app.c \ + ecore_events.c ecore_getopt.c ecore_idle_enterer.c \ + ecore_idle_exiter.c ecore_idler.c ecore_job.c ecore_main.c \ + ecore_pipe.c ecore_poll.c ecore_time.c ecore_timer.c \ + ecore_thread.c ecore_glib.c ecore_throttle.c ecore_exe_win32.c \ + ecore_exe_wince.c ecore_exe_ps3.c ecore_signal.c ecore_exe.c +@ECORE_HAVE_WIN32_TRUE@am__objects_1 = ecore_exe_win32.lo +@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_TRUE@am__objects_2 = ecore_exe_wince.lo +@ECORE_HAVE_PS3_TRUE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__objects_3 = ecore_exe_ps3.lo +@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@am__objects_4 = ecore_signal.lo \ +@ECORE_HAVE_PS3_FALSE@@ECORE_HAVE_WIN32_FALSE@@ECORE_HAVE_WINCE_FALSE@ ecore_exe.lo +am_libecore_la_OBJECTS = ecore.lo ecore_anim.lo ecore_app.lo \ + ecore_events.lo ecore_getopt.lo ecore_idle_enterer.lo \ + ecore_idle_exiter.lo ecore_idler.lo ecore_job.lo ecore_main.lo \ + ecore_pipe.lo ecore_poll.lo ecore_time.lo ecore_timer.lo \ + ecore_thread.lo ecore_glib.lo ecore_throttle.lo \ + $(am__objects_1) $(am__objects_2) $(am__objects_3) \ + $(am__objects_4) +libecore_la_OBJECTS = $(am_libecore_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libecore_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_la_SOURCES) +DIST_SOURCES = $(am__libecore_la_SOURCES_DIST) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = @GLIB_CFLAGS@ @EVIL_CFLAGS@ @EINA_CFLAGS@ @WIN32_CPPFLAGS@ @EFL_ECORE_BUILD@ +AM_CFLAGS = @WIN32_CFLAGS@ @EFL_PTHREAD_CFLAGS@ +lib_LTLIBRARIES = libecore.la +includes_HEADERS = \ +Ecore.h \ +Ecore_Getopt.h + +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_la_SOURCES = ecore.c ecore_anim.c ecore_app.c ecore_events.c \ + ecore_getopt.c ecore_idle_enterer.c ecore_idle_exiter.c \ + ecore_idler.c ecore_job.c ecore_main.c ecore_pipe.c \ + ecore_poll.c ecore_time.c ecore_timer.c ecore_thread.c \ + ecore_glib.c ecore_throttle.c $(am__append_1) $(am__append_2) \ + $(am__append_3) $(am__append_4) +libecore_la_LIBADD = @dlopen_libs@ @EINA_LIBS@ @EVIL_LIBS@ @GLIB_LIBS@ @WIN32_LIBS@ @LTLIBINTL@ @EFL_PTHREAD_LIBS@ @rt_libs@ -lm +libecore_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ @EFL_PTHREAD_LIBS@ +EXTRA_DIST = ecore_private.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore.la: $(libecore_la_OBJECTS) $(libecore_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_la_LINK) -rpath $(libdir) $(libecore_la_OBJECTS) $(libecore_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_anim.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_app.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_events.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_exe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_exe_ps3.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_exe_win32.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_exe_wince.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_getopt.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_glib.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_idle_enterer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_idle_exiter.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_idler.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_job.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_main.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_pipe.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_poll.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_signal.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_thread.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_throttle.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_time.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_timer.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore/ecore.c b/libraries/ecore/src/lib/ecore/ecore.c new file mode 100644 index 0000000..99d79c1 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore.c @@ -0,0 +1,731 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#ifndef _MSC_VER +# include +#endif + +#ifdef HAVE_LOCALE_H +# include +#endif + +#ifdef HAVE_LANGINFO_H +# include +#endif + +#ifdef HAVE_SYS_MMAN_H +# include +#endif + +#ifdef HAVE_EVIL +# include +#endif +#include + +#include "Ecore.h" +#include "ecore_private.h" + +#if HAVE_MALLINFO +#include + +static Ecore_Version _version = { VERS_MAJ, VERS_MIN, VERS_MIC, VERS_REV }; +EAPI Ecore_Version *ecore_version = &_version; + +#define KEEP_MAX(Global, Local) \ + if (Global < (Local)) \ + Global = Local; + +static Eina_Bool _ecore_memory_statistic(void *data); +static int _ecore_memory_max_total = 0; +static int _ecore_memory_max_free = 0; +static pid_t _ecore_memory_pid = 0; +#endif + +static const char *_ecore_magic_string_get(Ecore_Magic m); +static int _ecore_init_count = 0; +int _ecore_log_dom = -1; +int _ecore_fps_debug = 0; + +typedef struct _Ecore_Safe_Call Ecore_Safe_Call; +struct _Ecore_Safe_Call +{ + union { + Ecore_Cb async; + Ecore_Data_Cb sync; + } cb; + void *data; + + Eina_Lock m; + Eina_Condition c; + + int current_id; + + Eina_Bool sync : 1; + Eina_Bool suspend : 1; +}; + +static void _ecore_main_loop_thread_safe_call(Ecore_Safe_Call *order); +static void _thread_safe_cleanup(void *data); +static void _thread_callback(void *data, + void *buffer, + unsigned int nbyte); +static Eina_List *_thread_cb = NULL; +static Ecore_Pipe *_thread_call = NULL; +static Eina_Lock _thread_safety; + +static int _thread_loop = 0; +static Eina_Lock _thread_mutex; +static Eina_Condition _thread_cond; +static Eina_Lock _thread_feedback_mutex; +static Eina_Condition _thread_feedback_cond; + +static Eina_Lock _thread_id_lock; +static int _thread_id = -1; +static int _thread_id_max = 0; +static int _thread_id_update = 0; + +Eina_Lock _ecore_main_loop_lock; +int _ecore_main_lock_count; + +/** OpenBSD does not define CODESET + * FIXME ?? + */ + +#ifndef CODESET +# define CODESET "INVALID" +#endif + +/** + * @addtogroup Ecore_Init_Group + * + * @{ + */ + +/** + * Set up connections, signal handlers, sockets etc. + * @return 1 or greater on success, 0 otherwise + * + * This function sets up all singal handlers and the basic event loop. If it + * succeeds, 1 will be returned, otherwise 0 will be returned. + * + * @code + * #include + * + * int main(int argc, char **argv) + * { + * if (!ecore_init()) + * { + * printf("ERROR: Cannot init Ecore!\n"); + * return -1; + * } + * ecore_main_loop_begin(); + * ecore_shutdown(); + * } + * @endcode + */ +EAPI int +ecore_init(void) +{ + if (++_ecore_init_count != 1) + return _ecore_init_count; + +#ifdef HAVE_LOCALE_H + setlocale(LC_CTYPE, ""); +#endif + /* + if (strcmp(nl_langinfo(CODESET), "UTF-8")) + { + WRN("Not a utf8 locale!"); + } + */ +#ifdef HAVE_EVIL + if (!evil_init()) + return --_ecore_init_count; +#endif + if (!eina_init()) + goto shutdown_evil; + _ecore_log_dom = eina_log_domain_register("ecore", ECORE_DEFAULT_LOG_COLOR); + if (_ecore_log_dom < 0) + { + EINA_LOG_ERR("Ecore was unable to create a log domain."); + goto shutdown_log_dom; + } + if (getenv("ECORE_FPS_DEBUG")) _ecore_fps_debug = 1; + if (_ecore_fps_debug) _ecore_fps_debug_init(); + _ecore_main_loop_init(); + _ecore_signal_init(); + _ecore_thread_init(); + _ecore_exe_init(); + _ecore_glib_init(); + _ecore_job_init(); + _ecore_time_init(); + + eina_lock_new(&_thread_safety); + eina_lock_new(&_thread_mutex); + eina_condition_new(&_thread_cond, &_thread_mutex); + eina_lock_new(&_thread_feedback_mutex); + eina_condition_new(&_thread_feedback_cond, &_thread_feedback_mutex); + _thread_call = ecore_pipe_add(_thread_callback, NULL); + eina_lock_new(&_thread_id_lock); + + eina_lock_new(&_ecore_main_loop_lock); + +#if HAVE_MALLINFO + if (getenv("ECORE_MEM_STAT")) + { + _ecore_memory_pid = getpid(); + ecore_animator_add(_ecore_memory_statistic, NULL); + } +#endif + +#if defined(GLIB_INTEGRATION_ALWAYS) + if (_ecore_glib_always_integrate) ecore_main_loop_glib_integrate(); +#endif + + return _ecore_init_count; + +shutdown_log_dom: + eina_shutdown(); +shutdown_evil: +#ifdef HAVE_EVIL + evil_shutdown(); +#endif + return --_ecore_init_count; +} + +/** + * Shut down connections, signal handlers sockets etc. + * + * This function shuts down all things set up in ecore_init() and cleans up all + * event queues, handlers, filters, timers, idlers, idle enterers/exiters + * etc. set up after ecore_init() was called. + * + * Do not call this function from any callback that may be called from the main + * loop, as the main loop will then fall over and not function properly. + */ +EAPI int +ecore_shutdown(void) +{ + /* + * take a lock here because _ecore_event_shutdown() does callbacks + */ + _ecore_lock(); + if (--_ecore_init_count != 0) + goto unlock; + + ecore_pipe_del(_thread_call); + eina_lock_free(&_thread_safety); + eina_condition_free(&_thread_cond); + eina_lock_free(&_thread_mutex); + eina_condition_free(&_thread_feedback_cond); + eina_lock_free(&_thread_feedback_mutex); + eina_lock_free(&_thread_id_lock); + + if (_ecore_fps_debug) _ecore_fps_debug_shutdown(); + _ecore_poller_shutdown(); + _ecore_animator_shutdown(); + _ecore_glib_shutdown(); + _ecore_job_shutdown(); + _ecore_thread_shutdown(); + _ecore_exe_shutdown(); + _ecore_idle_enterer_shutdown(); + _ecore_idle_exiter_shutdown(); + _ecore_idler_shutdown(); + _ecore_timer_shutdown(); + _ecore_event_shutdown(); + _ecore_main_shutdown(); + _ecore_signal_shutdown(); + _ecore_main_loop_shutdown(); + +#if HAVE_MALLINFO + if (getenv("ECORE_MEM_STAT")) + { + _ecore_memory_statistic(NULL); + + ERR("[%i] Memory MAX total: %i, free: %i", + _ecore_memory_pid, + _ecore_memory_max_total, + _ecore_memory_max_free); + } +#endif + + eina_log_domain_unregister(_ecore_log_dom); + _ecore_log_dom = -1; + eina_shutdown(); +#ifdef HAVE_EVIL + evil_shutdown(); +#endif +unlock: + _ecore_unlock(); + + return _ecore_init_count; +} + +/** + * @} + */ + +static int wakeup = 42; + +EAPI void +ecore_main_loop_thread_safe_call_async(Ecore_Cb callback, + void *data) +{ + Ecore_Safe_Call *order; + + if (!callback) return; + + if (eina_main_loop_is()) + { + callback(data); + return; + } + + order = malloc(sizeof (Ecore_Safe_Call)); + if (!order) return; + + order->cb.async = callback; + order->data = data; + order->sync = EINA_FALSE; + order->suspend = EINA_FALSE; + + _ecore_main_loop_thread_safe_call(order); +} + +EAPI void * +ecore_main_loop_thread_safe_call_sync(Ecore_Data_Cb callback, + void *data) +{ + Ecore_Safe_Call *order; + void *ret; + + if (!callback) return NULL; + + if (eina_main_loop_is()) + { + return callback(data); + } + + order = malloc(sizeof (Ecore_Safe_Call)); + if (!order) return NULL; + + order->cb.sync = callback; + order->data = data; + eina_lock_new(&order->m); + eina_condition_new(&order->c, &order->m); + order->sync = EINA_TRUE; + order->suspend = EINA_FALSE; + + _ecore_main_loop_thread_safe_call(order); + + eina_lock_take(&order->m); + eina_condition_wait(&order->c); + eina_lock_release(&order->m); + + ret = order->data; + + order->sync = EINA_FALSE; + order->cb.async = _thread_safe_cleanup; + order->data = order; + + _ecore_main_loop_thread_safe_call(order); + + return ret; +} + +EAPI int +ecore_thread_main_loop_begin(void) +{ + Ecore_Safe_Call *order; + + if (eina_main_loop_is()) + { + return ++_thread_loop; + } + + order = malloc(sizeof (Ecore_Safe_Call)); + if (!order) return -1; + + eina_lock_take(&_thread_id_lock); + order->current_id = ++_thread_id_max; + if (order->current_id < 0) + { + _thread_id_max = 0; + order->current_id = ++_thread_id_max; + } + eina_lock_release(&_thread_id_lock); + + eina_lock_new(&order->m); + eina_condition_new(&order->c, &order->m); + order->suspend = EINA_TRUE; + + _ecore_main_loop_thread_safe_call(order); + + eina_lock_take(&order->m); + while (order->current_id != _thread_id) + eina_condition_wait(&order->c); + eina_lock_release(&order->m); + + eina_main_loop_define(); + + _thread_loop = 1; + + return EINA_TRUE; +} + +EAPI int +ecore_thread_main_loop_end(void) +{ + int current_id; + + if (_thread_loop == 0) + { + ERR("the main loop is not locked ! No matching call to ecore_thread_main_loop_begin()."); + return -1; + } + + /* until we unlock the main loop, this thread has the main loop id */ + if (!eina_main_loop_is()) + { + ERR("Not in a locked thread !"); + return -1; + } + + _thread_loop--; + if (_thread_loop > 0) + return _thread_loop; + + current_id = _thread_id; + + eina_lock_take(&_thread_mutex); + _thread_id_update = _thread_id; + eina_condition_broadcast(&_thread_cond); + eina_lock_release(&_thread_mutex); + + eina_lock_take(&_thread_feedback_mutex); + while (current_id == _thread_id && _thread_id != -1) + eina_condition_wait(&_thread_feedback_cond); + eina_lock_release(&_thread_feedback_mutex); + + return 0; +} + +EAPI void +ecore_print_warning(const char *function, + const char *sparam) +{ + WRN("***** Developer Warning ***** :\n" + "\tThis program is calling:\n\n" + "\t%s();\n\n" + "\tWith the parameter:\n\n" + "\t%s\n\n" + "\tbeing NULL. Please fix your program.", function, sparam); + if (getenv("ECORE_ERROR_ABORT")) abort(); +} + +EAPI void +_ecore_magic_fail(const void *d, + Ecore_Magic m, + Ecore_Magic req_m, + const char *fname) +{ + ERR("\n" + "*** ECORE ERROR: Ecore Magic Check Failed!!!\n" + "*** IN FUNCTION: %s()", fname); + if (!d) + ERR(" Input handle pointer is NULL!"); + else if (m == ECORE_MAGIC_NONE) + ERR(" Input handle has already been freed!"); + else if (m != req_m) + ERR(" Input handle is wrong type\n" + " Expected: %08x - %s\n" + " Supplied: %08x - %s", + (unsigned int)req_m, _ecore_magic_string_get(req_m), + (unsigned int)m, _ecore_magic_string_get(m)); + ERR("*** NAUGHTY PROGRAMMER!!!\n" + "*** SPANK SPANK SPANK!!!\n" + "*** Now go fix your code. Tut tut tut!"); + if (getenv("ECORE_ERROR_ABORT")) abort(); +} + +static const char * +_ecore_magic_string_get(Ecore_Magic m) +{ + switch (m) + { + case ECORE_MAGIC_NONE: + return "None (Freed Object)"; + break; + + case ECORE_MAGIC_EXE: + return "Ecore_Exe (Executable)"; + break; + + case ECORE_MAGIC_TIMER: + return "Ecore_Timer (Timer)"; + break; + + case ECORE_MAGIC_IDLER: + return "Ecore_Idler (Idler)"; + break; + + case ECORE_MAGIC_IDLE_ENTERER: + return "Ecore_Idle_Enterer (Idler Enterer)"; + break; + + case ECORE_MAGIC_IDLE_EXITER: + return "Ecore_Idle_Exiter (Idler Exiter)"; + break; + + case ECORE_MAGIC_FD_HANDLER: + return "Ecore_Fd_Handler (Fd Handler)"; + break; + + case ECORE_MAGIC_WIN32_HANDLER: + return "Ecore_Win32_Handler (Win32 Handler)"; + break; + + case ECORE_MAGIC_EVENT_HANDLER: + return "Ecore_Event_Handler (Event Handler)"; + break; + + case ECORE_MAGIC_EVENT: + return "Ecore_Event (Event)"; + break; + + default: + return ""; + } +} + +/* fps debug calls - for debugging how much time your app actually spends */ +/* "running" (and the inverse being time spent running)... this does not */ +/* account for other apps and multitasking... */ + +static int _ecore_fps_debug_init_count = 0; +static int _ecore_fps_debug_fd = -1; +unsigned int *_ecore_fps_runtime_mmap = NULL; + +void +_ecore_fps_debug_init(void) +{ + char buf[PATH_MAX]; + const char *tmp; + int pid; + + _ecore_fps_debug_init_count++; + if (_ecore_fps_debug_init_count > 1) return; + +#ifndef HAVE_EVIL + tmp = "/tmp"; +#else + tmp = evil_tmpdir_get (); +#endif /* HAVE_EVIL */ + pid = (int)getpid(); + snprintf(buf, sizeof(buf), "%s/.ecore_fps_debug-%i", tmp, pid); + _ecore_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644); + if (_ecore_fps_debug_fd < 0) + { + unlink(buf); + _ecore_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644); + } + if (_ecore_fps_debug_fd >= 0) + { + unsigned int zero = 0; + char *buf2 = (char *)&zero; + ssize_t todo = sizeof(unsigned int); + + while (todo > 0) + { + ssize_t r = write(_ecore_fps_debug_fd, buf2, todo); + if (r > 0) + { + todo -= r; + buf2 += r; + } + else if ((r < 0) && (errno == EINTR)) + continue; + else + { + ERR("could not write to file '%s' fd %d: %s", + tmp, _ecore_fps_debug_fd, strerror(errno)); + close(_ecore_fps_debug_fd); + _ecore_fps_debug_fd = -1; + return; + } + } + _ecore_fps_runtime_mmap = mmap(NULL, sizeof(unsigned int), + PROT_READ | PROT_WRITE, + MAP_SHARED, + _ecore_fps_debug_fd, 0); + if (_ecore_fps_runtime_mmap == MAP_FAILED) + _ecore_fps_runtime_mmap = NULL; + } +} + +void +_ecore_fps_debug_shutdown(void) +{ + _ecore_fps_debug_init_count--; + if (_ecore_fps_debug_init_count > 0) return; + if (_ecore_fps_debug_fd >= 0) + { + char buf[4096]; + const char *tmp; + int pid; + +#ifndef HAVE_EVIL + tmp = "/tmp"; +#else + tmp = (char *)evil_tmpdir_get (); +#endif /* HAVE_EVIL */ + pid = (int)getpid(); + snprintf(buf, sizeof(buf), "%s/.ecore_fps_debug-%i", tmp, pid); + unlink(buf); + if (_ecore_fps_runtime_mmap) + { + munmap(_ecore_fps_runtime_mmap, sizeof(int)); + _ecore_fps_runtime_mmap = NULL; + } + close(_ecore_fps_debug_fd); + _ecore_fps_debug_fd = -1; + } +} + +void +_ecore_fps_debug_runtime_add(double t) +{ + if ((_ecore_fps_debug_fd >= 0) && + (_ecore_fps_runtime_mmap)) + { + unsigned int tm; + + tm = (unsigned int)(t * 1000000.0); + /* i know its not 100% theoretically guaranteed, but i'd say a write */ + /* of an int could be considered atomic for all practical purposes */ + /* oh and since this is cumulative, 1 second = 1,000,000 ticks, so */ + /* this can run for about 4294 seconds becore looping. if you are */ + /* doing performance testing in one run for over an hour... well */ + /* time to restart or handle a loop condition :) */ + *(_ecore_fps_runtime_mmap) += tm; + } +} + +#if HAVE_MALLINFO +static Eina_Bool +_ecore_memory_statistic(__UNUSED__ void *data) +{ + struct mallinfo mi; + static int uordblks = 0; + static int fordblks = 0; + Eina_Bool changed = EINA_FALSE; + + mi = mallinfo(); + +#define HAS_CHANGED(Global, Local) \ + if (Global != Local) \ + { \ + Global = Local; \ + changed = EINA_TRUE; \ + } + + HAS_CHANGED(uordblks, mi.uordblks); + HAS_CHANGED(fordblks, mi.fordblks); + + if (changed) + ERR("[%i] Memory total: %i, free: %i", + _ecore_memory_pid, + mi.uordblks, + mi.fordblks); + + KEEP_MAX(_ecore_memory_max_total, mi.uordblks); + KEEP_MAX(_ecore_memory_max_free, mi.fordblks); + + return ECORE_CALLBACK_RENEW; +} + +#endif + +static void +_ecore_main_loop_thread_safe_call(Ecore_Safe_Call *order) +{ + Eina_Bool count; + + eina_lock_take(&_thread_safety); + + count = _thread_cb ? 0 : 1; + _thread_cb = eina_list_append(_thread_cb, order); + if (count) ecore_pipe_write(_thread_call, &wakeup, sizeof (int)); + + eina_lock_release(&_thread_safety); +} + +static void +_thread_safe_cleanup(void *data) +{ + Ecore_Safe_Call *call = data; + + eina_condition_free(&call->c); + eina_lock_free(&call->m); +} + +static void +_thread_callback(void *data __UNUSED__, + void *buffer __UNUSED__, + unsigned int nbyte __UNUSED__) +{ + Ecore_Safe_Call *call; + Eina_List *callback; + + eina_lock_take(&_thread_safety); + callback = _thread_cb; + _thread_cb = NULL; + eina_lock_release(&_thread_safety); + + EINA_LIST_FREE(callback, call) + { + if (call->suspend) + { + eina_lock_take(&_thread_mutex); + + eina_lock_take(&call->m); + _thread_id = call->current_id; + eina_condition_broadcast(&call->c); + eina_lock_release(&call->m); + + while (_thread_id_update != _thread_id) + eina_condition_wait(&_thread_cond); + eina_lock_release(&_thread_mutex); + + eina_main_loop_define(); + + eina_lock_take(&_thread_feedback_mutex); + + _thread_id = -1; + + eina_condition_broadcast(&_thread_feedback_cond); + eina_lock_release(&_thread_feedback_mutex); + + _thread_safe_cleanup(call); + free(call); + } + else if (call->sync) + { + call->data = call->cb.sync(call->data); + eina_condition_broadcast(&call->c); + } + else + { + call->cb.async(call->data); + free(call); + } + } +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_anim.c b/libraries/ecore/src/lib/ecore/ecore_anim.c new file mode 100644 index 0000000..9adaa77 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_anim.c @@ -0,0 +1,479 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include "Ecore.h" +#include "ecore_private.h" + +struct _Ecore_Animator +{ + EINA_INLIST; + ECORE_MAGIC; + + Ecore_Task_Cb func; + void *data; + + double start, run; + Ecore_Timeline_Cb run_func; + void *run_data; + + Eina_Bool delete_me : 1; + Eina_Bool suspended : 1; +}; + +static Eina_Bool _ecore_animator_run(void *data); +static Eina_Bool _ecore_animator(void *data); + +static int animators_delete_me = 0; +static Ecore_Animator *animators = NULL; +static double animators_frametime = 1.0 / 30.0; + +static Ecore_Animator_Source src = ECORE_ANIMATOR_SOURCE_TIMER; +static Ecore_Timer *timer = NULL; +static int ticking = 0; +static Ecore_Cb begin_tick_cb = NULL; +static const void *begin_tick_data = NULL; +static Ecore_Cb end_tick_cb = NULL; +static const void *end_tick_data = NULL; + +static void +_begin_tick(void) +{ + if (ticking) return; + ticking = 1; + switch (src) + { + case ECORE_ANIMATOR_SOURCE_TIMER: + if (!timer) + { + double t_loop = ecore_loop_time_get(); + double sync_0 = 0.0; + double d = -fmod(t_loop - sync_0, animators_frametime); + + timer = _ecore_timer_loop_add(animators_frametime, + _ecore_animator, NULL); + _ecore_timer_delay(timer, d); + } + break; + + case ECORE_ANIMATOR_SOURCE_CUSTOM: + if (begin_tick_cb) begin_tick_cb((void *)begin_tick_data); + break; + + default: + break; + } +} + +static void +_end_tick(void) +{ + if (!ticking) return; + ticking = 0; + switch (src) + { + case ECORE_ANIMATOR_SOURCE_TIMER: + if (timer) + { + _ecore_timer_del(timer); + timer = NULL; + } + break; + + case ECORE_ANIMATOR_SOURCE_CUSTOM: + if (end_tick_cb) end_tick_cb((void *)end_tick_data); + break; + + default: + break; + } +} + +static Eina_Bool +_do_tick(void) +{ + Ecore_Animator *animator; + + EINA_INLIST_FOREACH(animators, animator) + { + if (!animator->delete_me && !animator->suspended) + { + if (!_ecore_call_task_cb(animator->func, animator->data)) + { + animator->delete_me = EINA_TRUE; + animators_delete_me++; + } + } + } + if (animators_delete_me) + { + Ecore_Animator *l; + for (l = animators; l; ) + { + animator = l; + l = (Ecore_Animator *)EINA_INLIST_GET(l)->next; + if (animator->delete_me) + { + animators = (Ecore_Animator *) + eina_inlist_remove(EINA_INLIST_GET(animators), + EINA_INLIST_GET(animator)); + ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE); + free(animator); + animators_delete_me--; + if (animators_delete_me == 0) break; + } + } + } + if (!animators) + { + _end_tick(); + return ECORE_CALLBACK_CANCEL; + } + return ECORE_CALLBACK_RENEW; +} + +static Ecore_Animator * +_ecore_animator_add(Ecore_Task_Cb func, + const void *data) +{ + Ecore_Animator *animator = NULL; + + if (!func) return animator; + animator = calloc(1, sizeof(Ecore_Animator)); + if (!animator) return animator; + ECORE_MAGIC_SET(animator, ECORE_MAGIC_ANIMATOR); + animator->func = func; + animator->data = (void *)data; + animators = (Ecore_Animator *)eina_inlist_append(EINA_INLIST_GET(animators), EINA_INLIST_GET(animator)); + _begin_tick(); + return animator; +} + +EAPI Ecore_Animator * +ecore_animator_add(Ecore_Task_Cb func, + const void *data) +{ + Ecore_Animator *animator; + + _ecore_lock(); + animator = _ecore_animator_add(func, data); + _ecore_unlock(); + + return animator; +} + +EAPI Ecore_Animator * +ecore_animator_timeline_add(double runtime, + Ecore_Timeline_Cb func, + const void *data) +{ + Ecore_Animator *animator; + + _ecore_lock(); + if (runtime <= 0.0) runtime = 0.0; + animator = _ecore_animator_add(_ecore_animator_run, NULL); + animator->data = animator; + animator->run_func = func; + animator->run_data = (void *)data; + animator->start = ecore_loop_time_get(); + animator->run = runtime; + _ecore_unlock(); + return animator; +} + +static double +_pos_map_sin(double in) +{ + return eina_f32p32_double_to(eina_f32p32_sin(eina_f32p32_double_from(in))); +} + +static double +_pos_map_cos(double in) +{ + return eina_f32p32_double_to(eina_f32p32_cos(eina_f32p32_double_from(in))); +} + +static double +_pos_map_accel_factor(double pos, + double v1) +{ + int i, fact = (int)v1; + double p, o1 = pos, o2 = pos, v; + p = 1.0 - _pos_map_sin((M_PI / 2.0) + ((pos * M_PI) / 2.0)); + o2 = p; + for (i = 0; i < fact; i++) + { + o1 = o2; + o2 = o2 * p; + } + v = v1 - (double)fact; + pos = (v * o2) + ((1.0 - v) * o1); + return pos; +} + +static double +_pos_map_pow(double pos, + double divis, + int p) +{ + double v = 1.0; + int i; + for (i = 0; i < p; i++) v *= pos; + return ((pos * divis) * (1.0 - v)) + (pos * v); +} + +static double +_pos_map_spring(double pos, + int bounces, + double decfac) +{ + int segnum, segpos, b1, b2; + double len, decay, decpos, p2; + if (bounces < 0) bounces = 0; + p2 = _pos_map_pow(pos, 0.5, 3); + len = (M_PI / 2.0) + ((double)bounces * M_PI); + segnum = (bounces * 2) + 1; + segpos = 2 * (((int)(p2 * segnum) + 1) / 2); + b1 = segpos; + b2 = segnum + 1; + if (b1 < 0) b1 = 0; + decpos = (double)b1 / (double)b2; + decay = _pos_map_accel_factor(1.0 - decpos, decfac); + return _pos_map_sin((M_PI / 2.0) + (p2 * len)) * decay; +} + +EAPI double +ecore_animator_pos_map(double pos, + Ecore_Pos_Map map, + double v1, + double v2) +{ + /* purely functional - locking not required */ + if (pos > 1.0) pos = 1.0; + else if (pos < 0.0) + pos = 0.0; + switch (map) + { + case ECORE_POS_MAP_LINEAR: + return pos; + + case ECORE_POS_MAP_ACCELERATE: + pos = 1.0 - _pos_map_sin((M_PI / 2.0) + ((pos * M_PI) / 2.0)); + return pos; + + case ECORE_POS_MAP_DECELERATE: + pos = _pos_map_sin((pos * M_PI) / 2.0); + return pos; + + case ECORE_POS_MAP_SINUSOIDAL: + pos = (1.0 - _pos_map_cos(pos * M_PI)) / 2.0; + return pos; + + case ECORE_POS_MAP_ACCELERATE_FACTOR: + pos = _pos_map_accel_factor(pos, v1); + return pos; + + case ECORE_POS_MAP_DECELERATE_FACTOR: + pos = 1.0 - _pos_map_accel_factor(1.0 - pos, v1); + return pos; + + case ECORE_POS_MAP_SINUSOIDAL_FACTOR: + if (pos < 0.5) pos = _pos_map_accel_factor(pos * 2.0, v1) / 2.0; + else pos = 1.0 - (_pos_map_accel_factor((1.0 - pos) * 2.0, v1) / 2.0); + return pos; + + case ECORE_POS_MAP_DIVISOR_INTERP: + pos = _pos_map_pow(pos, v1, (int)v2); + return pos; + + case ECORE_POS_MAP_BOUNCE: + pos = _pos_map_spring(pos, (int)v2, v1); + if (pos < 0.0) pos = -pos; + pos = 1.0 - pos; + return pos; + + case ECORE_POS_MAP_SPRING: + pos = 1.0 - _pos_map_spring(pos, (int)v2, v1); + return pos; + + default: + return pos; + } + return pos; +} + +EAPI void * +ecore_animator_del(Ecore_Animator *animator) +{ + void *data = NULL; + + _ecore_lock(); + if (!ECORE_MAGIC_CHECK(animator, ECORE_MAGIC_ANIMATOR)) + { + ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR, + "ecore_animator_del"); + goto unlock; + } + if (animator->delete_me) + { + data = animator->data; + goto unlock; + } + animator->delete_me = EINA_TRUE; + animators_delete_me++; + if (animator->run_func) + data = animator->run_data; + else + data = animator->data; +unlock: + _ecore_unlock(); + return data; +} + +EAPI void +ecore_animator_frametime_set(double frametime) +{ + _ecore_lock(); + if (frametime < 0.0) frametime = 0.0; + if (animators_frametime == frametime) goto unlock; + animators_frametime = frametime; + _end_tick(); + if (animators) _begin_tick(); +unlock: + _ecore_unlock(); +} + +EAPI double +ecore_animator_frametime_get(void) +{ + return animators_frametime; +} + +EAPI void +ecore_animator_freeze(Ecore_Animator *animator) +{ + _ecore_lock(); + if (!ECORE_MAGIC_CHECK(animator, ECORE_MAGIC_ANIMATOR)) + { + ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR, + "ecore_animator_del"); + goto unlock; + } + if (animator->delete_me) goto unlock; + animator->suspended = EINA_TRUE; +unlock: + _ecore_unlock(); +} + +EAPI void +ecore_animator_thaw(Ecore_Animator *animator) +{ + _ecore_lock(); + if (!ECORE_MAGIC_CHECK(animator, ECORE_MAGIC_ANIMATOR)) + { + ECORE_MAGIC_FAIL(animator, ECORE_MAGIC_ANIMATOR, + "ecore_animator_del"); + goto unlock; + } + if (animator->delete_me) goto unlock; + animator->suspended = EINA_FALSE; +unlock: + _ecore_unlock(); +} + +EAPI void +ecore_animator_source_set(Ecore_Animator_Source source) +{ + _ecore_lock(); + src = source; + _end_tick(); + if (animators) _begin_tick(); + _ecore_unlock(); +} + +EAPI Ecore_Animator_Source +ecore_animator_source_get(void) +{ + return src; +} + +EAPI void +ecore_animator_custom_source_tick_begin_callback_set(Ecore_Cb func, + const void *data) +{ + _ecore_lock(); + begin_tick_cb = func; + begin_tick_data = data; + _end_tick(); + if (animators) _begin_tick(); + _ecore_unlock(); +} + +EAPI void +ecore_animator_custom_source_tick_end_callback_set(Ecore_Cb func, + const void *data) +{ + _ecore_lock(); + end_tick_cb = func; + end_tick_data = data; + _end_tick(); + if (animators) _begin_tick(); + _ecore_unlock(); +} + +EAPI void +ecore_animator_custom_tick(void) +{ + _ecore_lock(); + if (src == ECORE_ANIMATOR_SOURCE_CUSTOM) _do_tick(); + _ecore_unlock(); +} + +void +_ecore_animator_shutdown(void) +{ + _end_tick(); + while (animators) + { + Ecore_Animator *animator; + + animator = animators; + animators = (Ecore_Animator *)eina_inlist_remove(EINA_INLIST_GET(animators), EINA_INLIST_GET(animators)); + ECORE_MAGIC_SET(animator, ECORE_MAGIC_NONE); + free(animator); + } +} + +static Eina_Bool +_ecore_animator_run(void *data) +{ + Ecore_Animator *animator = data; + double pos = 0.0, t; + Eina_Bool run_ret; + + t = ecore_loop_time_get(); + if (animator->run > 0.0) + { + pos = (t - animator->start) / animator->run; + if (pos > 1.0) pos = 1.0; + else if (pos < 0.0) + pos = 0.0; + } + run_ret = animator->run_func(animator->run_data, pos); + if (t >= (animator->start + animator->run)) run_ret = EINA_FALSE; + return run_ret; +} + +static Eina_Bool +_ecore_animator(void *data __UNUSED__) +{ + Eina_Bool r; + _ecore_lock(); + r = _do_tick(); + _ecore_unlock(); + return r; +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_app.c b/libraries/ecore/src/lib/ecore/ecore_app.c new file mode 100644 index 0000000..5e4bf02 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_app.c @@ -0,0 +1,95 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#ifndef _MSC_VER +# include +#else +# include +#endif + +#ifdef HAVE_EVIL +# include +#endif + +#include "Ecore.h" +#include "ecore_private.h" + +static int app_argc = 0; +static char **app_argv = NULL; + +/** + * @addtogroup Ecore_Application_Group + * + * @{ + */ + +/** + * Set up the programs command-line arguments. + * @param argc The same as passed as argc to the programs main() function + * @param argv The same as passed as argv to the programs main() function + * + * A call to this function will store the programs command-line arguments + * for later use by ecore_app_restart() or ecore_app_args_get(). + */ +EAPI void +ecore_app_args_set(int argc, + const char **argv) +{ + EINA_MAIN_LOOP_CHECK_RETURN; + + if ((argc < 1) || + (!argv)) return; + app_argc = argc; + app_argv = (char **)argv; +} + +/** + * Return the programs stored command-line arguments. + * @param argc A pointer to the return value to hold argc + * @param argv A pointer to the return value to hold argv + * + * When called, this funciton returns the arguments for the program stored by + * ecore_app_args_set(). The integer pointed to by @p argc will be filled, if + * the pointer is not NULL, and the string array pointer @p argv will be filled + * also if the pointer is not NULL. The values they are filled with will be the + * same set by ecore_app_args_set(). + */ +EAPI void +ecore_app_args_get(int *argc, + char ***argv) +{ + EINA_MAIN_LOOP_CHECK_RETURN; + + if (argc) *argc = app_argc; + if (argv) *argv = app_argv; +} + +/** + * Restart the program executable with the command-line arguments stored. + * + * This function will restart & re-execute this program in place of itself + * using the command-line arguments stored by ecore_app_args_set(). This is + * an easy way for a program to restart itself for cleanup purposes, + * configuration reasons or in the event of a crash. + */ +EAPI void +ecore_app_restart(void) +{ +#ifdef HAVE_EXECVP + char *args[4096]; + int i; + + if ((app_argc < 1) || (!app_argv)) return; + if (app_argc >= 4096) return; + for (i = 0; i < app_argc; i++) args[i] = app_argv[i]; + args[i] = NULL; + execvp(app_argv[0], args); +#endif +} + +/** + * @} + */ diff --git a/libraries/ecore/src/lib/ecore/ecore_events.c b/libraries/ecore/src/lib/ecore/ecore_events.c new file mode 100644 index 0000000..f31baf8 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_events.c @@ -0,0 +1,790 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "Ecore.h" +#include "ecore_private.h" + +static int inpurge = 0; + +struct _Ecore_Event_Handler +{ + EINA_INLIST; + ECORE_MAGIC; + int type; + Ecore_Event_Handler_Cb func; + void *data; + int references; + Eina_Bool delete_me : 1; +}; + +struct _Ecore_Event_Filter +{ + EINA_INLIST; + ECORE_MAGIC; + Ecore_Data_Cb func_start; + Ecore_Filter_Cb func_filter; + Ecore_End_Cb func_end; + void *loop_data; + void *data; + int references; + Eina_Bool delete_me : 1; +}; + +struct _Ecore_Event +{ + EINA_INLIST; + ECORE_MAGIC; + int type; + void *event; + Ecore_End_Cb func_free; + void *data; + int references; + Eina_Bool delete_me : 1; +}; + +static int events_num = 0; +static Ecore_Event *events = NULL; +static Ecore_Event *event_current = NULL; +static Ecore_Event *purge_events = NULL; + +static Ecore_Event_Handler **event_handlers = NULL; +static Ecore_Event_Handler *event_handler_current = NULL; +static int event_handlers_num = 0; +static int event_handlers_alloc_num = 0; +static Eina_List *event_handlers_delete_list = NULL; + +static Ecore_Event_Handler *event_handlers_add_list = NULL; + +static Ecore_Event_Filter *event_filters = NULL; +static Ecore_Event_Filter *event_filter_current = NULL; +static Ecore_Event *event_filter_event_current = NULL; +static int event_filters_delete_me = 0; +static int event_id_max = ECORE_EVENT_COUNT; +static int ecore_raw_event_type = ECORE_EVENT_NONE; +static void *ecore_raw_event_event = NULL; + +static void _ecore_event_purge_deleted(void); +static void *_ecore_event_del(Ecore_Event *event); + +/** + * @addtogroup Ecore_Event_Group + * + * @{ + */ + +/** + * Add an event handler. + * @param type The type of the event this handler will get called for + * @param func The function to call when the event is found in the queue + * @param data A data pointer to pass to the called function @p func + * @return A new Event handler, or NULL on failure + * + * Add an event handler to the list of handlers. This will, on success, return + * a handle to the event handler object that was created, that can be used + * later to remove the handler using ecore_event_handler_del(). The @p type + * parameter is the integer of the event type that will trigger this callback + * to be called. The callback @p func is called when this event is processed + * and will be passed the event type, a pointer to the private event + * structure that is specific to that event type, and a data pointer that is + * provided in this call as the @p data parameter. + * + * When the callback @p func is called, it must return 1 or 0. If it returns + * 1 (or ECORE_CALLBACK_PASS_ON), It will keep being called as per normal, for + * each handler set up for that event type. If it returns 0 (or + * ECORE_CALLBACK_DONE), it will cease processing handlers for that particular + * event, so all handler set to handle that event type that have not already + * been called, will not be. + */ +EAPI Ecore_Event_Handler * +ecore_event_handler_add(int type, + Ecore_Event_Handler_Cb func, + const void *data) +{ + Ecore_Event_Handler *eh = NULL; + + _ecore_lock(); + + if (!func) goto unlock; + if ((type <= ECORE_EVENT_NONE) || (type >= event_id_max)) goto unlock; + eh = calloc(1, sizeof(Ecore_Event_Handler)); + if (!eh) goto unlock; + ECORE_MAGIC_SET(eh, ECORE_MAGIC_EVENT_HANDLER); + eh->type = type; + eh->func = func; + eh->data = (void *)data; + if (type >= (event_handlers_num - 1)) + { + int p_alloc_num; + + p_alloc_num = event_handlers_alloc_num; + event_handlers_num = type + 1; + if (event_handlers_num > event_handlers_alloc_num) + { + Ecore_Event_Handler **new_handlers; + int i; + + event_handlers_alloc_num = ((event_handlers_num + 16) / 16) * 16; + new_handlers = realloc(event_handlers, event_handlers_alloc_num * sizeof(Ecore_Event_Handler *)); + if (!new_handlers) + { + free(eh); + goto unlock; + } + event_handlers = new_handlers; + for (i = p_alloc_num; i < event_handlers_alloc_num; i++) + event_handlers[i] = NULL; + } + } + if (ecore_raw_event_type == type) + event_handlers_add_list = (Ecore_Event_Handler *)eina_inlist_append(EINA_INLIST_GET(event_handlers_add_list), EINA_INLIST_GET(eh)); + else if (type < event_handlers_alloc_num) + event_handlers[type] = (Ecore_Event_Handler *)eina_inlist_append(EINA_INLIST_GET(event_handlers[type]), EINA_INLIST_GET(eh)); + +unlock: + _ecore_unlock(); + return eh; +} + +/** + * Delete an event handler. + * @param event_handler Event handler handle to delete + * @return Data passed to handler + * + * Delete a specified event handler from the handler list. On success this will + * delete the event handler and return the pointer passed as @p data when the + * handler was added by ecore_event_handler_add(). On failure NULL will be + * returned. Once a handler is deleted it will no longer be called. + */ +EAPI void * +ecore_event_handler_del(Ecore_Event_Handler *event_handler) +{ + void *data = NULL; + + _ecore_lock(); + if (!ECORE_MAGIC_CHECK(event_handler, ECORE_MAGIC_EVENT_HANDLER)) + { + ECORE_MAGIC_FAIL(event_handler, ECORE_MAGIC_EVENT_HANDLER, + "ecore_event_handler_del"); + goto unlock; + } + data = _ecore_event_handler_del(event_handler); +unlock: + _ecore_unlock(); + + return data; +} + +/** + * @brief Get the data associated with an #Ecore_Event_Handler + * @param eh The event handler + * @return The data + * + * This function returns the data previously associated with @p eh by + * ecore_event_handler_add(). + */ +EAPI void * +ecore_event_handler_data_get(Ecore_Event_Handler *eh) +{ + void *data = NULL; + + _ecore_lock(); + if (!ECORE_MAGIC_CHECK(eh, ECORE_MAGIC_EVENT_HANDLER)) + { + ECORE_MAGIC_FAIL(eh, ECORE_MAGIC_EVENT_HANDLER, "ecore_event_handler_data_get"); + goto unlock; + } + data = eh->data; +unlock: + _ecore_unlock(); + return data; +} + +/** + * @brief Set the data associated with an #Ecore_Event_Handler + * @param eh The event handler + * @param data The data to associate + * @return The previous data + * + * This function sets @p data to @p eh and returns the old data pointer + * which was previously associated with @p eh by ecore_event_handler_add(). + */ +EAPI void * +ecore_event_handler_data_set(Ecore_Event_Handler *eh, + const void *data) +{ + void *old = NULL; + + _ecore_lock(); + if (!ECORE_MAGIC_CHECK(eh, ECORE_MAGIC_EVENT_HANDLER)) + { + ECORE_MAGIC_FAIL(eh, ECORE_MAGIC_EVENT_HANDLER, "ecore_event_handler_data_set"); + goto unlock; + } + old = eh->data; + eh->data = (void *)data; +unlock: + _ecore_unlock(); + + return old; +} + +static void +_ecore_event_generic_free(void *data __UNUSED__, + void *event) +{ + free (event); +} + +/** + * Add an event to the event queue. + * @param type The event type to add to the end of the event queue + * @param ev The private data structure for this event type + * @param func_free The function to be called to free this private structure + * @param data The data pointer to be passed to the free function + * @return A Handle for that event + * + * On success this function returns a handle to an event on the event queue, or + * NULL if it fails. If it succeeds, an event of type @p type will be added + * to the queue for processing by event handlers added by + * ecore_event_handler_add(). The @p ev parameter will be a pointer to the event + * private data that is specific to that event type. When the event is no + * longer needed, @p func_free will be called and passed the private structure + * pointer for cleaning up. If @p func_free is NULL, free() will be called + * with the private structure pointer. + * func_free is passed @p data as its data parameter. + */ +EAPI Ecore_Event * +ecore_event_add(int type, + void *ev, + Ecore_End_Cb func_free, + void *data) +{ + Ecore_Event *event = NULL; + + _ecore_lock(); + +/* if (!ev) goto unlock; */ + if (type <= ECORE_EVENT_NONE) goto unlock; + if (type >= event_id_max) goto unlock; + if ((ev) && (!func_free)) func_free = _ecore_event_generic_free; + event = _ecore_event_add(type, ev, func_free, data); +unlock: + _ecore_unlock(); + return event; +} + +/** + * Delete an event from the queue. + * @param event The event handle to delete + * @return The data pointer originally set for the event free function + * + * This deletes the event @p event from the event queue, and returns the + * @p data parameer originally set when adding it with ecore_event_add(). This + * does not immediately call the free function, and it may be called later on + * cleanup, and so if the free function depends on the data pointer to work, + * you should defer cleaning of this till the free function is called later. + */ +EAPI void * +ecore_event_del(Ecore_Event *event) +{ + void *data = NULL; + + _ecore_lock(); + if (!ECORE_MAGIC_CHECK(event, ECORE_MAGIC_EVENT)) + { + ECORE_MAGIC_FAIL(event, ECORE_MAGIC_EVENT, "ecore_event_del"); + goto unlock; + } + EINA_SAFETY_ON_TRUE_GOTO(event->delete_me, unlock); + event->delete_me = 1; + data = event->data; +unlock: + _ecore_unlock(); + return data; +} + +/** + * Allocate a new event type id sensibly and return the new id. + * @return A new event type id. + * + * This function allocates a new event type id and returns it. Once an event + * type has been allocated it can never be de-allocated during the life of + * the program. There is no guarantee of the contents of this event ID, or how + * it is calculated, except that the ID will be unique to the current instance + * of the process. + */ +EAPI int +ecore_event_type_new(void) +{ + int id; + + _ecore_lock(); + id = event_id_max++; + _ecore_unlock(); + + return id; +} + +/** + * Add a filter the current event queue. + * @param func_start Function to call just before filtering and return data + * @param func_filter Function to call on each event + * @param func_end Function to call after the queu has been filtered + * @param data Data to pass to the filter functions + * @return A filter handle + * + * This adds a filter to call callbacks to loop through the event queue and + * filter events out of the queue. On failure NULL is returned. On success a + * Filter handle is returned. Filters are called on the queue just before + * Event handler processing to try and remove redundant events. Just as + * processing starts @p func_start is called and passed the @p data pointer. + * This function returns a pointer that is used as loop_data that is now passed to + * @p func_filter as loop_data. @p func_filter is also passed @p data and the + * event type and private event structure. If this callback returns 0, the + * event is removed from the queue. If it returns 1, the event is kept. When + * processing is finished @p func_end is called and is passed the loop_data + * and @p data pointer to clean up. + */ +EAPI Ecore_Event_Filter * +ecore_event_filter_add(Ecore_Data_Cb func_start, + Ecore_Filter_Cb func_filter, + Ecore_End_Cb func_end, + const void *data) +{ + Ecore_Event_Filter *ef = NULL; + + _ecore_lock(); + if (!func_filter) goto unlock; + ef = calloc(1, sizeof(Ecore_Event_Filter)); + if (!ef) goto unlock; + ECORE_MAGIC_SET(ef, ECORE_MAGIC_EVENT_FILTER); + ef->func_start = func_start; + ef->func_filter = func_filter; + ef->func_end = func_end; + ef->data = (void *)data; + event_filters = (Ecore_Event_Filter *)eina_inlist_append(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef)); +unlock: + _ecore_unlock(); + return ef; +} + +/** + * Delete an event filter. + * @param ef The event filter handle + * @return The data set for the filter + * + * Delete a filter that has been added by its @p ef handle. On success this + * will return the data pointer set when this filter was added. On failure + * NULL is returned. + */ +EAPI void * +ecore_event_filter_del(Ecore_Event_Filter *ef) +{ + void *data = NULL; + + _ecore_lock(); + if (!ECORE_MAGIC_CHECK(ef, ECORE_MAGIC_EVENT_FILTER)) + { + ECORE_MAGIC_FAIL(ef, ECORE_MAGIC_EVENT_FILTER, "ecore_event_filter_del"); + goto unlock; + } + EINA_SAFETY_ON_TRUE_GOTO(ef->delete_me, unlock); + ef->delete_me = 1; + event_filters_delete_me = 1; + data = ef->data; +unlock: + _ecore_unlock(); + + return data; +} + +/** + * Return the current event type being handled. + * @return The current event type being handled if inside a handler callback + * + * If the program is currently inside an Ecore event handler callback this + * will return the type of the current event being processed. If Ecore is + * not inside an event handler, ECORE_EVENT_NONE is returned. + * + * This is useful when certain Ecore modules such as Ecore_Evas "swallow" + * events and not all the original information is passed on. In special cases + * this extra information may be useful or needed and using this call can let + * the program know if the event type being handled is one it wants to get more + * information about. + */ +EAPI int +ecore_event_current_type_get(void) +{ + return ecore_raw_event_type; +} + +/** + * Return the current event type pointer handled. + * @return The current event pointer being handled if inside a handler callback + * + * If the program is currently inside an Ecore event handler callback this + * will return the pointer of the current event being processed. If Ecore is + * not inside an event handler, NULL will be returned. + * + * This is useful when certain Ecore modules such as Ecore_Evas "swallow" + * events and not all the original information is passed on. In special cases + * this extra information may be useful or needed and using this call can let + * the program access the event data if the type of the event is handled by + * the program. + */ +EAPI void * +ecore_event_current_event_get(void) +{ + return ecore_raw_event_event; +} + +/** + * @} + */ + +EAPI void * +_ecore_event_handler_del(Ecore_Event_Handler *event_handler) +{ + EINA_SAFETY_ON_TRUE_RETURN_VAL(event_handler->delete_me, NULL); + event_handler->delete_me = 1; + event_handlers_delete_list = eina_list_append(event_handlers_delete_list, event_handler); + return event_handler->data; +} + +void +_ecore_event_shutdown(void) +{ + int i; + Ecore_Event_Handler *eh; + Ecore_Event_Filter *ef; + + while (events) _ecore_event_del(events); + event_current = NULL; + for (i = 0; i < event_handlers_num; i++) + { + while ((eh = event_handlers[i])) + { + event_handlers[i] = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers[i]), EINA_INLIST_GET(event_handlers[i])); + ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE); + if (!eh->delete_me) free(eh); + } + } + EINA_LIST_FREE(event_handlers_delete_list, eh) + free(eh); + if (event_handlers) free(event_handlers); + event_handlers = NULL; + event_handlers_num = 0; + event_handlers_alloc_num = 0; + while ((ef = event_filters)) + { + event_filters = (Ecore_Event_Filter *)eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(event_filters)); + ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE); + free(ef); + } + event_filters_delete_me = 0; + event_filter_current = NULL; + event_filter_event_current = NULL; +} + +int +_ecore_event_exist(void) +{ + Ecore_Event *e; + EINA_INLIST_FOREACH(events, e) + if (!e->delete_me) return 1; + return 0; +} + +Ecore_Event * +_ecore_event_add(int type, + void *ev, + Ecore_End_Cb func_free, + void *data) +{ + Ecore_Event *e; + + e = calloc(1, sizeof(Ecore_Event)); + if (!e) return NULL; + ECORE_MAGIC_SET(e, ECORE_MAGIC_EVENT); + e->type = type; + e->event = ev; + e->func_free = func_free; + e->data = data; + if (inpurge > 0) + { + purge_events = (Ecore_Event *)eina_inlist_append(EINA_INLIST_GET(purge_events), EINA_INLIST_GET(e)); + events_num++; + } + else + { + events = (Ecore_Event *)eina_inlist_append(EINA_INLIST_GET(events), EINA_INLIST_GET(e)); + events_num++; + } + return e; +} + +void * +_ecore_event_del(Ecore_Event *event) +{ + void *data; + + data = event->data; + if (event->func_free) _ecore_call_end_cb(event->func_free, event->data, event->event); + events = (Ecore_Event *)eina_inlist_remove(EINA_INLIST_GET(events), EINA_INLIST_GET(event)); + ECORE_MAGIC_SET(event, ECORE_MAGIC_NONE); + free(event); + events_num--; + return data; +} + +static void +_ecore_event_purge_deleted(void) +{ + Ecore_Event *itr = events; + + inpurge++; + while (itr) + { + Ecore_Event *next = (Ecore_Event *)EINA_INLIST_GET(itr)->next; + if ((!itr->references) && (itr->delete_me)) + _ecore_event_del(itr); + itr = next; + } + inpurge--; + while (purge_events) + { + Ecore_Event *e = purge_events; + purge_events = (Ecore_Event *)eina_inlist_remove(EINA_INLIST_GET(purge_events), EINA_INLIST_GET(purge_events)); + events = (Ecore_Event *)eina_inlist_append(EINA_INLIST_GET(events), EINA_INLIST_GET(e)); + } +} + +static inline void +_ecore_event_filters_apply() +{ + if (!event_filter_current) + { + /* regular main loop, start from head */ + event_filter_current = event_filters; + } + else + { + /* recursive main loop, continue from where we were */ + event_filter_current = (Ecore_Event_Filter *)EINA_INLIST_GET(event_filter_current)->next; + } + + while (event_filter_current) + { + Ecore_Event_Filter *ef = event_filter_current; + + if (!ef->delete_me) + { + ef->references++; + + if (ef->func_start) + ef->loop_data = _ecore_call_data_cb(ef->func_start, ef->data); + + if (!event_filter_event_current) + { + /* regular main loop, start from head */ + event_filter_event_current = events; + } + else + { + /* recursive main loop, continue from where we were */ + event_filter_event_current = (Ecore_Event *)EINA_INLIST_GET(event_filter_event_current)->next; + } + + while (event_filter_event_current) + { + Ecore_Event *e = event_filter_event_current; + + if (!_ecore_call_filter_cb(ef->func_filter, ef->data, + ef->loop_data, e->type, e->event)) + { + ecore_event_del(e); + } + + if (event_filter_event_current) /* may have changed in recursive main loops */ + event_filter_event_current = (Ecore_Event *)EINA_INLIST_GET(event_filter_event_current)->next; + } + if (ef->func_end) + _ecore_call_end_cb(ef->func_end, ef->data, ef->loop_data); + + ef->references--; + } + + if (event_filter_current) /* may have changed in recursive main loops */ + event_filter_current = (Ecore_Event_Filter *)EINA_INLIST_GET(event_filter_current)->next; + } + if (event_filters_delete_me) + { + int deleted_in_use = 0; + Ecore_Event_Filter *l; + for (l = event_filters; l; ) + { + Ecore_Event_Filter *ef = l; + l = (Ecore_Event_Filter *)EINA_INLIST_GET(l)->next; + if (ef->delete_me) + { + if (ef->references) + { + deleted_in_use++; + continue; + } + + event_filters = (Ecore_Event_Filter *)eina_inlist_remove(EINA_INLIST_GET(event_filters), EINA_INLIST_GET(ef)); + ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE); + free(ef); + } + } + if (!deleted_in_use) + event_filters_delete_me = 0; + } +} + +void +_ecore_event_call(void) +{ + Eina_List *l, *l_next; + Ecore_Event_Handler *eh; + + _ecore_event_filters_apply(); + + if (!event_current) + { + /* regular main loop, start from head */ + event_current = events; + event_handler_current = NULL; + } + + while (event_current) + { + Ecore_Event *e = event_current; + int handle_count = 0; + + if (e->delete_me) + { + event_current = (Ecore_Event *)EINA_INLIST_GET(event_current)->next; + continue; + } + + ecore_raw_event_type = e->type; + ecore_raw_event_event = e->event; + e->references++; + if ((e->type >= 0) && (e->type < event_handlers_num)) + { + if (!event_handler_current) + { + /* regular main loop, start from head */ + event_handler_current = event_handlers[e->type]; + } + else + { + /* recursive main loop, continue from where we were */ + event_handler_current = (Ecore_Event_Handler *)EINA_INLIST_GET(event_handler_current)->next; + } + + while ((event_handler_current) && (!e->delete_me)) + { + eh = event_handler_current; + if (!eh->delete_me) + { + Eina_Bool ret; + + handle_count++; + + eh->references++; + ret = _ecore_call_handler_cb(eh->func, eh->data, e->type, e->event); + eh->references--; + + if (!ret) + { + event_handler_current = NULL; + break; /* 0 == "call no further handlers" */ + } + } + + if (event_handler_current) /* may have changed in recursive main loops */ + event_handler_current = (Ecore_Event_Handler *)EINA_INLIST_GET(event_handler_current)->next; + } + } + while (event_handlers_add_list) + { + eh = event_handlers_add_list; + event_handlers_add_list = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers_add_list), EINA_INLIST_GET(eh)); + event_handlers[eh->type] = (Ecore_Event_Handler *)eina_inlist_append(EINA_INLIST_GET(event_handlers[eh->type]), EINA_INLIST_GET(eh)); + } + /* if no handlers were set for EXIT signal - then default is */ + /* to quit the main loop */ + if ((e->type == ECORE_EVENT_SIGNAL_EXIT) && (handle_count == 0)) + ecore_main_loop_quit(); + e->references--; + e->delete_me = 1; + + if (event_current) /* may have changed in recursive main loops */ + event_current = (Ecore_Event *)EINA_INLIST_GET(event_current)->next; + } + + ecore_raw_event_type = ECORE_EVENT_NONE; + ecore_raw_event_event = NULL; + + _ecore_event_purge_deleted(); + + EINA_LIST_FOREACH_SAFE(event_handlers_delete_list, l, l_next, eh) + { + if (eh->references) continue; + + event_handlers_delete_list = eina_list_remove_list(event_handlers_delete_list, l); + + event_handlers[eh->type] = (Ecore_Event_Handler *)eina_inlist_remove(EINA_INLIST_GET(event_handlers[eh->type]), EINA_INLIST_GET(eh)); + ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE); + free(eh); + } +} + +EAPI void * +_ecore_event_signal_user_new(void) +{ + Ecore_Event_Signal_User *e; + + e = calloc(1, sizeof(Ecore_Event_Signal_User)); + return e; +} + +void * +_ecore_event_signal_hup_new(void) +{ + Ecore_Event_Signal_Hup *e; + + e = calloc(1, sizeof(Ecore_Event_Signal_Hup)); + return e; +} + +void * +_ecore_event_signal_exit_new(void) +{ + Ecore_Event_Signal_Exit *e; + + e = calloc(1, sizeof(Ecore_Event_Signal_Exit)); + return e; +} + +void * +_ecore_event_signal_power_new(void) +{ + Ecore_Event_Signal_Power *e; + + e = calloc(1, sizeof(Ecore_Event_Signal_Power)); + return e; +} + +void * +_ecore_event_signal_realtime_new(void) +{ + return calloc(1, sizeof(Ecore_Event_Signal_Realtime)); +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_exe.c b/libraries/ecore/src/lib/ecore/ecore_exe.c new file mode 100644 index 0000000..d5465fc --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_exe.c @@ -0,0 +1,1880 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#if defined (__FreeBSD__) || defined (__OpenBSD__) || defined (__NetBSD__) +# include +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_SYS_PRCTL_H +# include +#endif + +#ifdef HAVE_SYS_WAIT_H +# include +#endif + +#include "Ecore.h" +#include "ecore_private.h" + +/* FIXME: Getting respawn to work + * + * There is no way that we can do anything about the internal state info of + * an external exe. The same can be said about the state of user code. User + * code in this context means the code that is using ecore_exe to manage exe's + * for it. + * + * Document that the exe must be respawnable, in other words, there is no + * state that it cannot regenerate by just killing it and starting it again. + * This includes state that the user code knows about, as the respawn is + * transparent to that code. On the other hand, maybe a respawn event might + * be useful, or maybe resend the currently non existent add event. For + * consistancy with ecore_con, an add event is good anyway. + * + * The Ecore_exe structure is reused for respawning, so that the (opaque) + * pointer held by the user remains valid. This means that the Ecore_Exe + * init and del functions may need to be split into two parts each to avoid + * duplicating code - common code part, and the rest. This implies that + * the unchanging members mentioned next should NEVER change. + * + * These structure members don't need to change - + * __list_data - we stay on the list + * ECORE_MAGIC - this is a constant + * data - passed in originally + * cmd - passed in originally + * flags - passed in originally + * + * These structure members need to change - + * tag - state that must be regenerated, zap it + * pid - it will be different + * child_fd_write - it will be different + * child_fd_read - it will be different + * child_fd_error - it will be different + * write_fd_handler - we cannot change the fd used by a handler, this changes coz the fd changes. + * read_fd_handler - we cannot change the fd used by a handler, this changes coz the fd changes. + * error_fd_handler - we cannot change the fd used by a handler, this changes coz the fd changes. + * + * Hmm, the read, write, and error buffers could be tricky. + * They are not atomic, and could be in a semi complete state. + * They fall into the "state must be regenerated" mentioned above. + * A respawn/add event should take care of it. + * + * These structure members need to change - + * write_data_buf - state that must be regenerated, zap it + * write_data_size - state that must be regenerated, zap it + * write_data_offset - state that must be regenerated, zap it + * read_data_buf - state that must be regenerated, zap it + * read_data_size - state that must be regenerated, zap it + * error_data_buf - state that must be regenerated, zap it + * error_data_size - state that must be regenerated, zap it + * close_write - state that must be regenerated, zap it + * + * There is the problem that an exe that fell over and needs respawning + * might keep falling over, keep needing to be respawned, and tie up system + * resources with the constant respawning. An exponentially increasing + * timeout (with maximum timeout) between respawns should take care of that. + * Although this is not a "contention for a resource" problem, the exe falling + * over may be, so a random element added to the timeout may help, and won't + * hurt. The user code may need to be informed that a timeout is in progress. + */ + +struct _Ecore_Exe +{ + EINA_INLIST; + ECORE_MAGIC; + pid_t pid; + void *data; + char *tag, *cmd; + Ecore_Exe_Flags flags; + Ecore_Fd_Handler *write_fd_handler; /* the fd_handler to handle write to child - if this was used, or NULL if not */ + Ecore_Fd_Handler *read_fd_handler; /* the fd_handler to handle read from child - if this was used, or NULL if not */ + Ecore_Fd_Handler *error_fd_handler; /* the fd_handler to handle errors from child - if this was used, or NULL if not */ + void *write_data_buf; /* a data buffer for data to write to the child - + * realloced as needed for more data and flushed when the fd handler says writes are possible + */ + int write_data_size; /* the size in bytes of the data buffer */ + int write_data_offset; /* the offset in bytes in the data buffer */ + void *read_data_buf; /* data read from the child awating delivery to an event */ + int read_data_size; /* data read from child in bytes */ + void *error_data_buf; /* errors read from the child awating delivery to an event */ + int error_data_size; /* errors read from child in bytes */ + int child_fd_write; /* fd to write TO to send data to the child */ + int child_fd_read; /* fd to read FROM when child has sent us (the parent) data */ + int child_fd_error; /* fd to read FROM when child has sent us (the parent) errors */ + int child_fd_write_x; /* fd to write TO to send data to the child */ + int child_fd_read_x; /* fd to read FROM when child has sent us (the parent) data */ + int child_fd_error_x; /* fd to read FROM when child has sent us (the parent) errors */ + Eina_Bool close_stdin : 1; + + int start_bytes, end_bytes, start_lines, end_lines; /* Number of bytes/lines to auto pipe at start/end of stdout/stderr. */ + + Ecore_Timer *doomsday_clock; /* The Timer of Death. Muahahahaha. */ + void *doomsday_clock_dead; /* data for the doomsday clock */ + + Ecore_Exe_Cb pre_free_cb; +}; + +/* TODO: Something to let people build a command line and does auto escaping - + * + * ecore_exe_snprintf() + * + * OR + * + * cmd = ecore_exe_comand_parameter_append(cmd, "firefox"); + * cmd = ecore_exe_comand_parameter_append(cmd, "http://www.foo.com/bar.html?baz=yes"); + * each parameter appended is one argument, and it gets escaped, quoted, and + * appended with a preceding space. The first is the command off course. + */ + +struct _ecore_exe_dead_exe +{ + pid_t pid; + char *cmd; +}; + +static inline void _ecore_exe_exec_it(const char *exe_cmd, + Ecore_Exe_Flags flags); +static Eina_Bool _ecore_exe_data_generic_handler(void *data, + Ecore_Fd_Handler *fd_handler, + Ecore_Exe_Flags flags); +static Eina_Bool _ecore_exe_data_error_handler(void *data, + Ecore_Fd_Handler *fd_handler); +static Eina_Bool _ecore_exe_data_read_handler(void *data, + Ecore_Fd_Handler *fd_handler); +static Eina_Bool _ecore_exe_data_write_handler(void *data, + Ecore_Fd_Handler *fd_handler); +static void _ecore_exe_flush(Ecore_Exe *exe); +static void _ecore_exe_event_exe_data_free(void *data __UNUSED__, + void *ev); +static Ecore_Exe *_ecore_exe_is_it_alive(pid_t pid); +static Eina_Bool _ecore_exe_make_sure_its_dead(void *data); +static Eina_Bool _ecore_exe_make_sure_its_really_dead(void *data); +static Ecore_Exe_Event_Add *_ecore_exe_event_add_new(void); +static void _ecore_exe_event_add_free(void *data, + void *ev); +static void _ecore_exe_dead_attach(Ecore_Exe *exe); + +EAPI int ECORE_EXE_EVENT_ADD = 0; +EAPI int ECORE_EXE_EVENT_DEL = 0; +EAPI int ECORE_EXE_EVENT_DATA = 0; +EAPI int ECORE_EXE_EVENT_ERROR = 0; + +static Ecore_Exe *exes = NULL; +static const char *shell = NULL; + +/* FIXME: This errno checking stuff should be put elsewhere for everybody to use. + * For now it lives here though, just to make testing easier. + */ +static int _ecore_exe_check_errno(int result, + const char *file, + int line); + +#define E_IF_NO_ERRNO(result, foo, ok) \ + while (((ok) = _ecore_exe_check_errno((result) = (foo), __FILE__, __LINE__)) == -1) sleep(1); \ + if (ok) + +#define E_NO_ERRNO(result, foo, ok) \ + while (((ok) = _ecore_exe_check_errno((result) = (foo), __FILE__, __LINE__)) == -1) sleep(1) + +#define E_IF_NO_ERRNO_NOLOOP(result, foo, ok) \ + if (((ok) = _ecore_exe_check_errno((result) = (foo), __FILE__, __LINE__))) + +static int +_ecore_exe_check_errno(int result, + const char *file, + int line) +{ + int saved_errno = errno; + + if (result == -1) + { + perror("*** errno reports "); +/* What is currently supported - + * + * pipe + * EFAULT Argument is not valid. + * EMFILE Too many file descriptors used by process. + * ENFILE Too many open files by system. + * read + * EAGAIN No data now, try again. + * EBADF This is not an fd that can be read. + * EFAULT This is not a valid buffer. + * EINTR Interupted by signal, try again. + * EINVAL This is not an fd that can be read. + * EIO I/O error. + * EISDIR This is a directory, and cannot be read. + * others Depending on what sort of thing we are reading from. + * close + * EBADF This is not an fd that can be closed. + * EINTR Interupted by signal, try again. + * EIO I/O error. + * dup2 + * EBADF This is not an fd that can be dup2'ed. + * EBUSY Race condition between open() and dup() + * EINTR Interupted by signal, try again. + * EMFILE Too many file descriptors used by process. + * fcntl + * EACCES, EAGAIN Locked or mapped by something else, try again later. + * EBADF This is not an fd that can be fcntl'ed. + * EDEADLK This will cause a deadlock. + * EFAULT This is not a valid lock. + * EINTR Interupted by signal, try again. + * EINVAL This is not a valid arg. + * EMFILE Too many file descriptors used by process. + * ENOLCK Problem getting a lock. + * EPERM Not allowed to do that. + * fsync + * EBADF This is not an fd that is open for writing. + * EINVAL, EROFS This is not an fd that can be fsynced. + * EIO I/O error. + * + * How to use it - + * int ok = 0; + * int result; + * + * E_IF_NO_ERRNO(result, foo(bar), ok) + * { + * E_IF_NO_ERRNO_NOLOOP(result, foo(bar), ok) + * { + * } + * } + * + * if (!ok) + * { + * // Something failed, cleanup. + * } + */ + switch (saved_errno) + { + case EACCES: + case EAGAIN: + case EINTR: + { /* Not now, try later. */ + ERR("*** Must try again in %s @%u.", file, line); + result = -1; + break; + } + + case EMFILE: + case ENFILE: + case ENOLCK: + { /* Low on resources. */ + ERR("*** Low on resources in %s @%u.", file, + line); + result = 0; + break; + } + + case EIO: + { /* I/O error. */ + ERR("*** I/O error in %s @%u.", file, line); + result = 0; + break; + } + + case EFAULT: + case EBADF: + case EINVAL: + case EROFS: + case EISDIR: + case EDEADLK: + case EPERM: + case EBUSY: + { /* Programmer fucked up. */ + ERR("*** NAUGHTY PROGRAMMER!!!\n" + "*** SPANK SPANK SPANK!!!\n" + "*** Now go fix your code in %s @%u. Tut tut tut!", + file, line); + result = 0; + break; + } + + default: + { /* Unsupported errno code, please add this one. */ + ERR("*** NAUGHTY PROGRAMMER!!!\n" + "*** SPANK SPANK SPANK!!!\n" + "*** Unsupported errno code %d, please add this one.\n" + "*** Now go fix your code in %s @%u, from %s @%u. Tut tut tut!", + saved_errno, __FILE__, __LINE__, file, line); + result = 0; + break; + } + } + } + else /* Everything is fine. */ + result = 1; + + errno = saved_errno; + return result; +} + +/** + * @addtogroup Ecore_Exe_Group + * + * @{ + */ + +static int run_pri = ECORE_EXE_PRIORITY_INHERIT; + +/** + * Sets the priority at which to launch processes + * + * This sets the priority of processes run by ecore_exe_run() and + * ecore_exe_pipe_run(). + * @li On Windows, the child process is created by default with the + * #ECORE_EXE_WIN32_PRIORITY_NORMAL priority, unless the calling + * process is in #ECORE_EXE_WIN32_PRIORITY_IDLE or + * #ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL priority. In that case, the + * child process inherits this priority. + * @li On other platforms, if set to #ECORE_EXE_PRIORITY_INHERIT child + * processes inherits the priority of their parent. This is the default. + * + * @param pri value a Ecore_Exe_Win32_Priority value on Windows, -20 + * to 19 or ECORE_EXE_PRIORITY_INHERIT on other OS. + */ +EAPI void +ecore_exe_run_priority_set(int pri) +{ + run_pri = pri; +} + +/** + * Gets the priority at which to launch processes + * + * This gets ths priority of launched processes. See + * ecore_exe_run_priority_set() for details. This just returns the value set + * by this call. + * + * @return the value set by ecore_exe_run_priority_set() + */ +EAPI int +ecore_exe_run_priority_get(void) +{ + return run_pri; +} + +/** + * Spawns a child process. + * + * This is now just a thin wrapper around ecore_exe_pipe_run() + * + * @param exe_cmd The command to run with @c /bin/sh. + * @param data Data to attach to the returned process handle. + * @return A process handle to the spawned process. + */ +EAPI Ecore_Exe * +ecore_exe_run(const char *exe_cmd, + const void *data) +{ + return ecore_exe_pipe_run(exe_cmd, 0, data); +} + +/** + * Spawns a child process with its stdin/out available for communication. + * + * This function forks and runs the given command using @c /bin/sh. + * + * Note that the process handle is only valid until a child process + * terminated event is received. After all handlers for the child process + * terminated event have been called, the handle will be freed by Ecore. + * + * This function does the same thing as ecore_exe_run(), but also makes the + * standard in and/or out as well as stderr from the child process available + * for reading or writing. To write use ecore_exe_send(). To read listen to + * ECORE_EXE_EVENT_DATA or ECORE_EXE_EVENT_ERROR events (set up handlers). + * Ecore may buffer read and error data until a newline character if asked + * for with the @p flags. All data will be included in the events (newlines + * will be replaced with NULLS if line buffered). ECORE_EXE_EVENT_DATA events + * will only happen if the process is run with ECORE_EXE_PIPE_READ enabled + * in the flags. The same with the error version. Writing will only be + * allowed with ECORE_EXE_PIPE_WRITE enabled in the flags. + * + * @param exe_cmd The command to run with @c /bin/sh. + * @param flags The flag parameters for how to deal with inter-process I/O + * @param data Data to attach to the returned process handle. + * @return A process handle to the spawned process. + */ +EAPI Ecore_Exe * +ecore_exe_pipe_run(const char *exe_cmd, + Ecore_Exe_Flags flags, + const void *data) +{ + Ecore_Exe *exe = NULL; + int statusPipe[2] = { -1, -1 }; + int errorPipe[2] = { -1, -1 }; + int readPipe[2] = { -1, -1 }; + int writePipe[2] = { -1, -1 }; + int n = 0; + int ok = 1; + int result; + + if (!exe_cmd) return NULL; + exe = calloc(1, sizeof(Ecore_Exe)); + if (!exe) return NULL; + + if ((flags & ECORE_EXE_PIPE_AUTO) && (!(flags & ECORE_EXE_PIPE_ERROR)) + && (!(flags & ECORE_EXE_PIPE_READ))) + /* We need something to auto pipe. */ + flags |= ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR; + + exe->child_fd_error = -1; + exe->child_fd_read = -1; + exe->child_fd_write = -1; + exe->child_fd_error_x = -1; + exe->child_fd_read_x = -1; + exe->child_fd_write_x = -1; + + /* Create some pipes. */ + if (ok) + { + E_IF_NO_ERRNO_NOLOOP(result, pipe(statusPipe), ok) + { + } + } + if (ok && (flags & ECORE_EXE_PIPE_ERROR)) + { + E_IF_NO_ERRNO_NOLOOP(result, pipe(errorPipe), ok) + { + exe->child_fd_error = errorPipe[0]; + exe->child_fd_error_x = errorPipe[1]; + } + } + if (ok && (flags & ECORE_EXE_PIPE_READ)) + { + E_IF_NO_ERRNO_NOLOOP(result, pipe(readPipe), ok) + { + exe->child_fd_read = readPipe[0]; + exe->child_fd_read_x = readPipe[1]; + } + } + if (ok && (flags & ECORE_EXE_PIPE_WRITE)) + { + E_IF_NO_ERRNO_NOLOOP(result, pipe(writePipe), ok) + { + exe->child_fd_write = writePipe[1]; + exe->child_fd_write_x = writePipe[0]; + } + } + if (ok) + { + pid_t pid = 0; + volatile int vfork_exec_errno = 0; + + /* FIXME: I should double check this. After a quick look around, this is already done, but via a more modern method. */ + /* signal(SIGPIPE, SIG_IGN); We only want EPIPE on errors */ + pid = fork(); + + if (pid == -1) + { + ERR("Failed to fork process"); + pid = 0; + } + else if (pid == 0) /* child */ + { + if (run_pri != ECORE_EXE_PRIORITY_INHERIT) + { + if ((run_pri >= -20) && (run_pri <= 19)) + setpriority(PRIO_PROCESS, 0, run_pri); + } + /* dup2 STDERR, STDIN, and STDOUT. dup2() allegedly closes the + * second pipe if it's open. On the other hand, there was the + * Great FD Leak Scare of '06, so let's be paranoid. */ + if (ok && (flags & ECORE_EXE_PIPE_ERROR)) + { + E_NO_ERRNO(result, close(STDERR_FILENO), ok); + E_NO_ERRNO(result, dup2(errorPipe[1], STDERR_FILENO), ok); + } + if (ok && (flags & ECORE_EXE_PIPE_READ)) + { + E_NO_ERRNO(result, close(STDOUT_FILENO), ok); + E_NO_ERRNO(result, dup2(readPipe[1], STDOUT_FILENO), ok); + } + if (ok && (flags & ECORE_EXE_PIPE_WRITE)) + { + E_NO_ERRNO(result, close(STDIN_FILENO), ok); + E_NO_ERRNO(result, dup2(writePipe[0], STDIN_FILENO), ok); + } + + if (ok) + { + /* Setup the status pipe. */ + E_NO_ERRNO(result, close(statusPipe[0]), ok); + E_IF_NO_ERRNO(result, fcntl(statusPipe[1], F_SETFD, FD_CLOEXEC), ok) /* close on exec shows success */ + { + /* Run the actual command. */ + _ecore_exe_exec_it(exe_cmd, flags); /* no return */ + } + } + + /* Something went 'orribly wrong. */ + vfork_exec_errno = errno; + + /* Close the pipes. */ + if (flags & ECORE_EXE_PIPE_ERROR) + E_NO_ERRNO(result, close(errorPipe[1]), ok); + if (flags & ECORE_EXE_PIPE_READ) + E_NO_ERRNO(result, close(readPipe[1]), ok); + if (flags & ECORE_EXE_PIPE_WRITE) + E_NO_ERRNO(result, close(writePipe[0]), ok); + E_NO_ERRNO(result, close(statusPipe[1]), ok); + + _exit(-1); + } + else /* parent */ + { + /* Close the unused pipes. */ + E_NO_ERRNO(result, close(statusPipe[1]), ok); + + /* FIXME: after having a good look at the current e fd + * handling, investigate fcntl(dataPipe[x], F_SETSIG, ...) */ + /* FIXME: above F_SETSIG etc. - this is async SIGIO based IO + * which is also linux specific so we probably don't want to + * do this as long as select() is working fine. the only time + * we really want to think of SIGIO async IO is when it all + * actually works basically everywhere and we can turn all + * IO into DMA async activities (i.e. you do a read() then + * the read is complete not on return but when you get a + * SIGIO - the read() just starts the transfer and it is + * completed in the background by DMA (or whatever mechanism + * the kernel choses)) */ + + /* Wait for it to start executing. */ + /* FIXME: this doesn't seem very nice - we sit and block + * waiting on a child process... even though it's just + * the segment between the fork() and the exec) it just feels + * wrong */ + for (;; ) + { + char buf; + + E_NO_ERRNO(result, read(statusPipe[0], &buf, 1), ok); + if (result == 0) + { + if (vfork_exec_errno != 0) + { + n = vfork_exec_errno; + ERR("Could not start \"%s\"", exe_cmd); + pid = 0; + } + break; + } + } + + /* Close the status pipe. */ + E_NO_ERRNO(result, close(statusPipe[0]), ok); + } + + if (pid) + { + /* Setup the exe structure. */ + ECORE_MAGIC_SET(exe, ECORE_MAGIC_EXE); + exe->start_bytes = -1; + exe->end_bytes = -1; + exe->start_lines = -1; + exe->end_lines = -1; + exe->pid = pid; + exe->flags = flags; + exe->data = (void *)data; + if ((exe->cmd = strdup(exe_cmd))) + { + if (flags & ECORE_EXE_PIPE_ERROR) /* Setup the error stuff. */ + { + E_IF_NO_ERRNO(result, + fcntl(exe->child_fd_error, F_SETFL, + O_NONBLOCK), ok) { + } + E_IF_NO_ERRNO(result, + fcntl(exe->child_fd_error, F_SETFD, + FD_CLOEXEC), ok) { + } + E_IF_NO_ERRNO(result, + fcntl(exe->child_fd_error_x, F_SETFD, + FD_CLOEXEC), ok) { + } + { + exe->error_fd_handler = + ecore_main_fd_handler_add(exe->child_fd_error, + ECORE_FD_READ, + _ecore_exe_data_error_handler, + exe, NULL, NULL); + if (!exe->error_fd_handler) + ok = 0; + } + } + if (ok && (flags & ECORE_EXE_PIPE_READ)) /* Setup the read stuff. */ + { + E_IF_NO_ERRNO(result, + fcntl(exe->child_fd_read, F_SETFL, + O_NONBLOCK), ok) { + } + E_IF_NO_ERRNO(result, + fcntl(exe->child_fd_read, F_SETFD, + FD_CLOEXEC), ok) { + } + E_IF_NO_ERRNO(result, + fcntl(exe->child_fd_read_x, F_SETFD, + FD_CLOEXEC), ok) { + } + { + exe->read_fd_handler = + ecore_main_fd_handler_add(exe->child_fd_read, + ECORE_FD_READ, + _ecore_exe_data_read_handler, + exe, NULL, NULL); + if (!exe->read_fd_handler) + ok = 0; + } + } + if (ok && (flags & ECORE_EXE_PIPE_WRITE)) /* Setup the write stuff. */ + { + E_IF_NO_ERRNO(result, + fcntl(exe->child_fd_write, F_SETFL, + O_NONBLOCK), ok) { + } + E_IF_NO_ERRNO(result, + fcntl(exe->child_fd_write, F_SETFD, + FD_CLOEXEC), ok) { + } + E_IF_NO_ERRNO(result, + fcntl(exe->child_fd_write_x, F_SETFD, + FD_CLOEXEC), ok) { + } + { + exe->write_fd_handler = + ecore_main_fd_handler_add(exe->child_fd_write, + ECORE_FD_WRITE, + _ecore_exe_data_write_handler, + exe, NULL, NULL); + if (exe->write_fd_handler) + ecore_main_fd_handler_active_set(exe->write_fd_handler, 0); /* Nothing to write to start with. */ + else + ok = 0; + } + } + + exes = (Ecore_Exe *)eina_inlist_append(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe)); + n = 0; + } + else + ok = 0; + } + else + ok = 0; + } + + if (!ok) /* Something went wrong, so pull down everything. */ + { + if (exe->pid) ecore_exe_terminate(exe); + IF_FN_DEL(ecore_exe_free, exe); + } + else + { + Ecore_Exe_Event_Add *e; + + e = _ecore_exe_event_add_new(); + e->exe = exe; + if (e) /* Send the event. */ + ecore_event_add(ECORE_EXE_EVENT_ADD, e, + _ecore_exe_event_add_free, NULL); + /* INF("Running as %d for %s.\n", exe->pid, exe->cmd); */ + } + + errno = n; + return exe; +} + +/** + * Defines a function to be called before really freeing the handle data. + * + * This might be useful for language bindings such as Python and Perl + * that need to deallocate wrappers associated with this handle. + * + * This handle should never be modified by this call. It should be + * considered informative only. All getters are valid when the given + * function is called back. + * + * @param exe The child process to attach the pre_free function. + * @param func The function to call before @a exe is freed. + */ +EAPI void +ecore_exe_callback_pre_free_set(Ecore_Exe *exe, + Ecore_Exe_Cb func) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, + "ecore_exe_callback_pre_free_set"); + return; + } + exe->pre_free_cb = func; +} + +/** + * Sends data to the given child process which it receives on stdin. + * + * This function writes to a child processes standard in, with unlimited + * buffering. This call will never block. It may fail if the system runs out + * of memory. + * + * @param exe The child process to send to + * @param data The data to send + * @param size The size of the data to send, in bytes + * @return EINA_TRUE if successful, EINA_FALSE on failure. + */ +EAPI Eina_Bool +ecore_exe_send(Ecore_Exe *exe, + const void *data, + int size) +{ + void *buf; + + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_send"); + return EINA_FALSE; + } + + if (exe->close_stdin) + { + ERR("Ecore_Exe %p stdin is closed! Cannot send %d bytes from %p", + exe, size, data); + return EINA_FALSE; + } + + if (exe->child_fd_write == -1) + { + ERR("Ecore_Exe %p created without ECORE_EXE_PIPE_WRITE! " + "Cannot send %d bytes from %p", exe, size, data); + return EINA_FALSE; + } + + buf = realloc(exe->write_data_buf, exe->write_data_size + size); + if (!buf) return EINA_FALSE; + + exe->write_data_buf = buf; + memcpy((char *)exe->write_data_buf + exe->write_data_size, data, size); + exe->write_data_size += size; + + if (exe->write_fd_handler) + ecore_main_fd_handler_active_set(exe->write_fd_handler, ECORE_FD_WRITE); + + return EINA_TRUE; +} + +/** + * The stdin of the given child process will close when the write buffer is empty. + * + * @param exe The child process + */ +EAPI void +ecore_exe_close_stdin(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_close_stdin"); + return; + } + exe->close_stdin = 1; +} + +/** + * Sets the auto pipe limits for the given process handle. On Windows + * this function does nothing. + * + * @param exe The given process handle. + * @param start_bytes limit of bytes at start of output to buffer. + * @param end_bytes limit of bytes at end of output to buffer. + * @param start_lines limit of lines at start of output to buffer. + * @param end_lines limit of lines at end of output to buffer. + */ +EAPI void +ecore_exe_auto_limits_set(Ecore_Exe *exe, + int start_bytes, + int end_bytes, + int start_lines, + int end_lines) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_auto_limits_set"); + return; + } + /* FIXME: sanitize the input. */ + exe->start_bytes = start_bytes; + exe->end_bytes = end_bytes; + exe->start_lines = start_lines; + exe->end_lines = end_lines; + + /* FIXME: get this can of worms working. + * + * capture stderr & stdout internally + * + * raster and onefang keep moving the goal posts on this one. It started out as + * "show users the error output if an exe fails" and is rapidly approaching + * "alternative method of getting the data, poll vs event driven". Some serious + * thinking needs to be applied to this. Do we really want to go that far? If + * so, we should change the names. The basic design will probably remain the + * same which ever way we go. The constant goal post moving is probably due to + * generic design methods leading to feature creep as we inspired each other to + * more generic designs. It does seem like the closer we get to poll driven, + * the more issues and corner cases there are. + * + * Instead of doing the usual register an event handler thing, we are ecore_exe, + * we can take some short cuts. Don't send the events, just leave the exe buffers + * as is until the user asks for them, then return the event. + * + * start = 0, end = 0; clogged arteries get flushed, everything is ignored. + * start = -1, end = -1; clogged arteries get transferred to internal buffers. Actually, either == -1 means buffer everything. + * start = X, end = 0; buffer first X out of clogged arteries, flush and ignore rest. + * start = 0, end = X; circular buffer X + * start = X, end = Y; buffer first X out of clogged arteries, circular buffer Y from beginning. + * + * bytes vs lines, which ever one reaches the limit first. + * Before we go beyond the start+end limit, leave the end buffer empty, and store both in the start buffer, coz they overlap. + * After we pass the the start+end limit, insert "\n...\n" at the end of the start buffer, copy the rest to the end buffer, then store in the end buffer. + * + * Other issues - + * Spank programmer for polling data if polling is not turned on. + * Spank programmer for setting up event callbacks if polling is turned on. + * Spank programmer for freeing the event data if it came from the event system, as that autofrees. + * Spank the programmer if they try to set the limits bigger than what has been gathered & ignored already, coz they just lost data. + * Spank onefang and raster for opening this can of worms. + * Should we have separate out/err limits? + * Should we remove from the internal buffer the data that was delivered already? + * If so, what to do about limits, start, and end? They could loose their meaning. + */ +} + +/** + * Gets the auto pipe data for the given process handle + * + * @param exe The given process handle. + * @param flags Is this a ECORE_EXE_PIPE_READ or ECORE_EXE_PIPE_ERROR? + */ +EAPI Ecore_Exe_Event_Data * +ecore_exe_event_data_get(Ecore_Exe *exe, + Ecore_Exe_Flags flags) +{ + Ecore_Exe_Event_Data *e = NULL; + int is_buffered = 0; + unsigned char *inbuf; + int inbuf_num; + + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_event_data_get"); + return NULL; + } + + /* Sort out what sort of event we are. */ + if (flags & ECORE_EXE_PIPE_READ) + { + flags = ECORE_EXE_PIPE_READ; + if (exe->flags & ECORE_EXE_PIPE_READ_LINE_BUFFERED) + is_buffered = 1; + } + else + { + flags = ECORE_EXE_PIPE_ERROR; + if (exe->flags & ECORE_EXE_PIPE_ERROR_LINE_BUFFERED) + is_buffered = 1; + } + + /* Get the data. */ + if (flags & ECORE_EXE_PIPE_READ) + { + inbuf = exe->read_data_buf; + inbuf_num = exe->read_data_size; + exe->read_data_buf = NULL; + exe->read_data_size = 0; + } + else + { + inbuf = exe->error_data_buf; + inbuf_num = exe->error_data_size; + exe->error_data_buf = NULL; + exe->error_data_size = 0; + } + + e = calloc(1, sizeof(Ecore_Exe_Event_Data)); + if (e) + { + e->exe = exe; + e->data = inbuf; + e->size = inbuf_num; + + if (is_buffered) /* Deal with line buffering. */ + { + int max = 0; + int count = 0; + int i; + int last = 0; + char *c; + + c = (char *)inbuf; + for (i = 0; i < inbuf_num; i++) /* Find the lines. */ + { + if (inbuf[i] == '\n') + { + if (count >= max) + { + /* In testing, the lines seem to arrive in batches of 500 to 1000 lines at most, roughly speaking. */ + max += 10; /* FIXME: Maybe keep track of the largest number of lines ever sent, and add half that many instead of 10. */ + e->lines = realloc(e->lines, sizeof(Ecore_Exe_Event_Data_Line) * (max + 1)); /* Allow room for the NULL termination. */ + } + /* raster said to leave the line endings as line endings, however - + * This is line buffered mode, we are not dealing with binary here, but lines. + * If we are not dealing with binary, we must be dealing with ASCII, unicode, or some other text format. + * Thus the user is most likely gonna deal with this text as strings. + * Thus the user is most likely gonna pass this data to str functions. + * rasters way - the endings are always gonna be '\n'; onefangs way - they will always be '\0' + * We are handing them the string length as a convenience. + * Thus if they really want it in raw format, they can e->lines[i].line[e->lines[i].size - 1] = '\n'; easily enough. + * In the default case, we can do this conversion quicker than the user can, as we already have the index and pointer. + * Let's make it easy on them to use these as standard C strings. + * + * onefang is proud to announce that he has just set a new personal record for the + * most over documentation of a simple assignment statement. B-) + */ + inbuf[i] = '\0'; + e->lines[count].line = c; + e->lines[count].size = i - last; + last = i + 1; + c = (char *)&inbuf[last]; + count++; + } + } + if (i > last) /* Partial line left over, save it for next time. */ + { + if (count != 0) e->size = last; + if (flags & ECORE_EXE_PIPE_READ) + { + exe->read_data_size = i - last; + exe->read_data_buf = malloc(exe->read_data_size); + memcpy(exe->read_data_buf, c, exe->read_data_size); + } + else + { + exe->error_data_size = i - last; + exe->error_data_buf = malloc(exe->error_data_size); + memcpy(exe->error_data_buf, c, exe->error_data_size); + } + } + if (count == 0) /* No lines to send, cancel the event. */ + { + _ecore_exe_event_exe_data_free(NULL, e); + e = NULL; + } + else /* NULL terminate the array, so that people know where the end is. */ + { + e->lines[count].line = NULL; + e->lines[count].size = 0; + } + } + } + + return e; +} + +/** + * Sets the string tag for the given process handle + * + * @param exe The given process handle. + * @param tag The string tag to set on the process handle. + */ +EAPI void +ecore_exe_tag_set(Ecore_Exe *exe, + const char *tag) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_tag_set"); + return; + } + IF_FREE(exe->tag); + if (tag) + exe->tag = strdup(tag); + else + exe->tag = NULL; +} + +/** + * Retrieves the tag attached to the given process handle. There is no need to + * free it as it just returns the internal pointer value. This value is only + * valid as long as the @p exe is valid or until the tag is set to something + * else on this @p exe. + * + * @param exe The given process handle. + * @return The string attached to @p exe. It is a handle to existing + * internal string and should not be modified, use + * ecore_exe_tag_set() to change it. It might be @c NULL. + */ +EAPI const char * +ecore_exe_tag_get(const Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_tag_get"); + return NULL; + } + return exe->tag; +} + +/** + * Frees the given process handle. + * + * Note that the process that the handle represents is unaffected by this + * function. + * + * @param exe The given process handle. + * @return The data attached to the handle when @ref ecore_exe_run was + * called. + */ +EAPI void * +ecore_exe_free(Ecore_Exe *exe) +{ + void *data; + int ok = 0; + int result; + + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_free"); + return NULL; + } + + data = exe->data; + + if (exe->pre_free_cb) + exe->pre_free_cb(data, exe); + + if (exe->doomsday_clock) + { + struct _ecore_exe_dead_exe *dead; + + ecore_timer_del(exe->doomsday_clock); + exe->doomsday_clock = NULL; + dead = exe->doomsday_clock_dead; + if (dead) + { + IF_FREE(dead->cmd); + free(dead); + exe->doomsday_clock_dead = NULL; + } + } + IF_FN_DEL(ecore_main_fd_handler_del, exe->write_fd_handler); + IF_FN_DEL(ecore_main_fd_handler_del, exe->read_fd_handler); + IF_FN_DEL(ecore_main_fd_handler_del, exe->error_fd_handler); + if (exe->child_fd_write_x != -1) + E_NO_ERRNO(result, close(exe->child_fd_write_x), ok); + if (exe->child_fd_read_x != -1) + E_NO_ERRNO(result, close(exe->child_fd_read_x), ok); + if (exe->child_fd_error_x != -1) + E_NO_ERRNO(result, close(exe->child_fd_error_x), ok); + if (exe->child_fd_write != -1) + E_NO_ERRNO(result, close(exe->child_fd_write), ok); + if (exe->child_fd_read != -1) + E_NO_ERRNO(result, close(exe->child_fd_read), ok); + if (exe->child_fd_error != -1) + E_NO_ERRNO(result, close(exe->child_fd_error), ok); + IF_FREE(exe->write_data_buf); + IF_FREE(exe->read_data_buf); + IF_FREE(exe->error_data_buf); + IF_FREE(exe->cmd); + + exes = (Ecore_Exe *)eina_inlist_remove(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe)); + ECORE_MAGIC_SET(exe, ECORE_MAGIC_NONE); + IF_FREE(exe->tag); + free(exe); + return data; +} + +/** + * Frees the given event data. + * + * @param e The given event data. + */ +EAPI void +ecore_exe_event_data_free(Ecore_Exe_Event_Data *e) +{ + if (!e) return; + IF_FREE(e->lines); + IF_FREE(e->data); + free(e); +} + +/** + * Retrieves the process ID of the given spawned process. + * @param exe Handle to the given spawned process. + * @return The process ID on success. @c -1 otherwise. + */ +EAPI pid_t +ecore_exe_pid_get(const Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_pid_get"); + return -1; + } + return exe->pid; +} + +/** + * Retrieves the command of the given spawned process. + * @param exe Handle to the given spawned process. + * @return The command on success. NULL otherwise. This string is the + * pointer to the internal value and must not be modified in + * any way. + */ +EAPI const char * +ecore_exe_cmd_get(const Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_cmd_get"); + return NULL; + } + return exe->cmd; +} + +/** + * Retrieves the data attached to the given process handle. + * @param exe The given process handle. + * @return The data pointer attached to @p exe Given to + * ecore_exe_run() or ecore_exe_pipe_run() + */ +EAPI void * +ecore_exe_data_get(const Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_data_get"); + return NULL; + } + return exe->data; +} + +/** + * Sets the data attached to the given process handle. + * @param exe The given process handle. + * @param data The pointer to attach + * @return The data pointer previously attached to @p exe with + * ecore_exe_run(), ecore_exe_pipe_run(), or ecore_exe_data_set() + * @since 1.1 + */ +EAPI void * +ecore_exe_data_set(Ecore_Exe *exe, + void *data) +{ + void *ret; + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, __func__); + return NULL; + } + ret = exe->data; + exe->data = data; + return ret; +} + +/** + * Retrieves the flags attached to the given process handle. + * @param exe The given process handle. + * @return The flags attached to @p exe. + */ +EAPI Ecore_Exe_Flags +ecore_exe_flags_get(const Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_data_get"); + return 0; + } + return exe->flags; +} + +/** + * Pauses the given process by sending it a @c SIGSTOP signal. + * @param exe Process handle to the given process. + */ +EAPI void +ecore_exe_pause(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_pause"); + return; + } + kill(exe->pid, SIGSTOP); +} + +/** + * Continues the given paused process by sending it a @c SIGCONT signal. + * @param exe Process handle to the given process. + */ +EAPI void +ecore_exe_continue(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_continue"); + return; + } + kill(exe->pid, SIGCONT); +} + +/** + * Sends the given spawned process a interrupt (@c SIGINT) signal. + * @param exe Process handle to the given process. + */ +EAPI void +ecore_exe_interrupt(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_interrupt"); + return; + } + _ecore_exe_dead_attach(exe); + kill(exe->pid, SIGINT); +} + +/** + * Sends the given spawned process a quit (@c SIGQUIT) signal. + * @param exe Process handle to the given process. + */ +EAPI void +ecore_exe_quit(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_quit"); + return; + } + _ecore_exe_dead_attach(exe); + kill(exe->pid, SIGQUIT); +} + +/** + * Sends the given spawned process a terminate (@c SIGTERM) signal. + * @param exe Process handle to the given process. + */ +EAPI void +ecore_exe_terminate(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_terminate"); + return; + } + _ecore_exe_dead_attach(exe); + INF("Sending TERM signal to %s (%d).", exe->cmd, exe->pid); + kill(exe->pid, SIGTERM); +} + +/** + * Kills the given spawned process by sending it a @c SIGKILL signal. + * @param exe Process handle to the given process. + */ +EAPI void +ecore_exe_kill(Ecore_Exe *exe) +{ + struct _ecore_exe_dead_exe *dead; + + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_kill"); + return; + } + + dead = calloc(1, sizeof(struct _ecore_exe_dead_exe)); + if (dead) + { + dead->pid = exe->pid; + dead->cmd = strdup(exe->cmd); + IF_FN_DEL(ecore_timer_del, exe->doomsday_clock); + exe->doomsday_clock = + ecore_timer_add(10.0, _ecore_exe_make_sure_its_really_dead, dead); + } + + INF("Sending KILL signal to %s (%d).", exe->cmd, exe->pid); + kill(exe->pid, SIGKILL); +} + +/** + * Sends a @c SIGUSR signal to the given spawned process. + * @param exe Process handle to the given process. + * @param num The number user signal to send. Must be either 1 or 2, or + * the signal will be ignored. + */ +EAPI void +ecore_exe_signal(Ecore_Exe *exe, + int num) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_signal"); + return; + } + if (num == 1) + kill(exe->pid, SIGUSR1); + else if (num == 2) + kill(exe->pid, SIGUSR2); +} + +/** + * Sends a @c SIGHUP signal to the given spawned process. + * @param exe Process handle to the given process. + */ +EAPI void +ecore_exe_hup(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_hup"); + return; + } + kill(exe->pid, SIGHUP); +} + +/** + * @} + */ + +static Ecore_Exe * +_ecore_exe_is_it_alive(pid_t pid) +{ + Ecore_Exe *exe = NULL; + + /* FIXME: There is no nice, safe, OS independent way to tell if a + * particular PID is still alive. I have written code to do so + * for my urunlevel busybox applet (http://urunlevel.sourceforge.net/), + * but it's for linux only, and still not guaranteed. + * + * So for now, we just check that a valid Ecore_Exe structure + * exists for it. Even that is not a guarantee, as the structure + * can be freed without killing the process. + * + * I think we can safely put exe's into two categories, those users + * that care about the life of the exe, and the run and forget type. + * The run and forget type starts up the exe, then free's the + * Ecore_Exe structure straight away. They can never call any of + * the functions that can call this, so we don't worry about them. + * + * Those user's that care about the life of exe's will keep the + * Ecore_Exe structure around, terminate them eventually, or + * register for exit events. For these ones the assumption + * that valid Ecore_Exe struct == live exe is almost valid. + * + * I will probably copy my urunlevel code into here someday. + */ + exe = _ecore_exe_find(pid); + if (exe) + { + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + exe = NULL; + } + + return exe; +} + +static Eina_Bool +_ecore_exe_make_sure_its_dead(void *data) +{ + struct _ecore_exe_dead_exe *dead; + + dead = data; + if (dead) + { + Ecore_Exe *exe = NULL; + + if ((exe = _ecore_exe_is_it_alive(dead->pid))) + { + if (dead->cmd) + INF("Sending KILL signal to allegedly dead %s (%d).", + dead->cmd, dead->pid); + else + INF("Sending KILL signal to allegedly dead PID %d.", + dead->pid); + exe->doomsday_clock = + ecore_timer_add(10.0, _ecore_exe_make_sure_its_really_dead, + dead); + kill(dead->pid, SIGKILL); + } + else + { + IF_FREE(dead->cmd); + free(dead); + } + } + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_ecore_exe_make_sure_its_really_dead(void *data) +{ + struct _ecore_exe_dead_exe *dead; + + dead = data; + if (dead) + { + Ecore_Exe *exe = NULL; + + if ((exe = _ecore_exe_is_it_alive(dead->pid))) + { + ERR("RUN! The zombie wants to eat your brains! And your CPU!"); + if (dead->cmd) + INF("%s (%d) is not really dead.", dead->cmd, dead->pid); + else + INF("PID %d is not really dead.", dead->pid); + exe->doomsday_clock = NULL; + } + IF_FREE(dead->cmd); + free(dead); + } + return ECORE_CALLBACK_CANCEL; +} + +void +_ecore_exe_init(void) +{ + ECORE_EXE_EVENT_ADD = ecore_event_type_new(); + ECORE_EXE_EVENT_DEL = ecore_event_type_new(); + ECORE_EXE_EVENT_DATA = ecore_event_type_new(); + ECORE_EXE_EVENT_ERROR = ecore_event_type_new(); +} + +void +_ecore_exe_shutdown(void) +{ + while (exes) + ecore_exe_free(exes); +} + +Ecore_Exe * +_ecore_exe_find(pid_t pid) +{ + Ecore_Exe *exe; + + EINA_INLIST_FOREACH(exes, exe) + { + if (exe->pid == pid) + return exe; + } + return NULL; +} + +Ecore_Timer * +_ecore_exe_doomsday_clock_get(Ecore_Exe *exe) +{ + return exe->doomsday_clock; +} + +void +_ecore_exe_doomsday_clock_set(Ecore_Exe *exe, + Ecore_Timer *dc) +{ + exe->doomsday_clock = dc; +} + +static inline void +_ecore_exe_exec_it(const char *exe_cmd, + Ecore_Exe_Flags flags) +{ + char use_sh = 1; + char *buf = NULL; + char **args = NULL; + int save_errno = 0; + + /* So what is this doing? + * + * We are trying to avoid wrapping the exe call with /bin/sh -c. + * We conservatively search for certain shell meta characters, + * If we don't find them, we can call the exe directly. + */ + if (!strpbrk(exe_cmd, "|&;<>()$`\\\"'*?#")) + { + char *token; + char pre_command = 1; + int num_tokens = 0; + + if (!(buf = strdup(exe_cmd))) + return; + + token = strtok(buf, " \t\n\v"); + while (token) + { + if (token[0] == '~') + break; + if (pre_command) + { + if (token[0] == '[') + break; + if (strchr(token, '=')) + break; + else + pre_command = 0; + } + num_tokens++; + token = strtok(NULL, " \t\n\v"); + } + IF_FREE(buf); + if ((!token) && (num_tokens)) + { + int i = 0; + + if (!(buf = strdup(exe_cmd))) + return; + + token = strtok(buf, " \t\n\v"); + use_sh = 0; + if (!(args = (char **)calloc(num_tokens + 1, sizeof(char *)))) + { + IF_FREE(buf); + return; + } + for (i = 0; i < num_tokens; i++) + { + if (token) + args[i] = token; + token = strtok(NULL, " \t\n\v"); + } + args[num_tokens] = NULL; + } + } + +#ifdef HAVE_SYS_PRCTL_H + if ((flags & ECORE_EXE_TERM_WITH_PARENT)) + { + prctl(PR_SET_PDEATHSIG, SIGTERM); + } +#endif + + if (!(flags & ECORE_EXE_NOT_LEADER)) setsid(); + if ((flags & ECORE_EXE_USE_SH)) + { + errno = 0; + execl("/bin/sh", "/bin/sh", "-c", exe_cmd, (char *)NULL); + } + else if (use_sh) /* We have to use a shell to run this. */ + { + if (!shell) /* Find users preferred shell. */ + { + shell = getenv("SHELL"); + if (!shell) + shell = "/bin/sh"; + } + errno = 0; + execl(shell, shell, "-c", exe_cmd, (char *)NULL); + } + else + { /* We can run this directly. */ + if (!args) + { + IF_FREE(buf); + IF_FREE(args); + ERR("arg[0] is NULL!"); + return; + } + errno = 0; + execvp(args[0], args); + } + + save_errno = errno; + IF_FREE(buf); + IF_FREE(args); + errno = save_errno; + return; +} + +static Eina_Bool +_ecore_exe_data_generic_handler(void *data, + Ecore_Fd_Handler *fd_handler, + Ecore_Exe_Flags flags) +{ + Ecore_Exe *exe; + int child_fd; + int event_type; + + exe = data; + + /* Sort out what sort of handler we are. */ + if (flags & ECORE_EXE_PIPE_READ) + { + flags = ECORE_EXE_PIPE_READ; + event_type = ECORE_EXE_EVENT_DATA; + child_fd = exe->child_fd_read; + } + else + { + flags = ECORE_EXE_PIPE_ERROR; + event_type = ECORE_EXE_EVENT_ERROR; + child_fd = exe->child_fd_error; + } + + if ((fd_handler) + && (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))) + { + unsigned char *inbuf; + int inbuf_num; + + /* Get any left over data from last time. */ + if (flags & ECORE_EXE_PIPE_READ) + { + inbuf = exe->read_data_buf; + inbuf_num = exe->read_data_size; + exe->read_data_buf = NULL; + exe->read_data_size = 0; + } + else + { + inbuf = exe->error_data_buf; + inbuf_num = exe->error_data_size; + exe->error_data_buf = NULL; + exe->error_data_size = 0; + } + + for (;; ) + { + int num, lost_exe; + char buf[READBUFSIZ]; + + lost_exe = 0; + errno = 0; + if ((num = read(child_fd, buf, READBUFSIZ)) < 1) + { + /* FIXME: SPEED/SIZE TRADE OFF - add a smaller READBUFSIZE + * (currently 64k) to inbuf, use that instead of buf, and + * save ourselves a memcpy(). */ + lost_exe = ((errno == EIO) || + (errno == EBADF) || + (errno == EPIPE) || + (errno == EINVAL) || (errno == ENOSPC)); + if ((errno != EAGAIN) && (errno != EINTR)) + perror("_ecore_exe_generic_handler() read problem "); + } + if (num > 0) /* data got read. */ + { + inbuf = realloc(inbuf, inbuf_num + num); + memcpy(inbuf + inbuf_num, buf, num); + inbuf_num += num; + } + else + { /* No more data to read. */ + if (inbuf) + { + Ecore_Exe_Event_Data *e; + + /* Stash the data away for later. */ + if (flags & ECORE_EXE_PIPE_READ) + { + exe->read_data_buf = inbuf; + exe->read_data_size = inbuf_num; + } + else + { + exe->error_data_buf = inbuf; + exe->error_data_size = inbuf_num; + } + + if (!(exe->flags & ECORE_EXE_PIPE_AUTO)) + { + e = ecore_exe_event_data_get(exe, flags); + if (e) /* Send the event. */ + ecore_event_add(event_type, e, + _ecore_exe_event_exe_data_free, + NULL); + } + } + if (lost_exe) + { + if (flags & ECORE_EXE_PIPE_READ) + { + if (exe->read_data_size) + INF("There are %d bytes left unsent from the dead exe %s.", + exe->read_data_size, exe->cmd); + } + else + { + if (exe->error_data_size) + INF("There are %d bytes left unsent from the dead exe %s.", + exe->error_data_size, exe->cmd); + } + /* Thought about this a bit. If the exe has actually + * died, this won't do any harm as it must have died + * recently and the pid has not had a chance to recycle. + * It is also a paranoid catchall, coz the usual ecore_signal + * mechenism should kick in. But let's give it a good + * kick in the head anyway. + */ + ecore_exe_terminate(exe); + } + break; + } + } + } + + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_ecore_exe_data_error_handler(void *data, + Ecore_Fd_Handler *fd_handler) +{ + return _ecore_exe_data_generic_handler(data, fd_handler, + ECORE_EXE_PIPE_ERROR); +} + +static Eina_Bool +_ecore_exe_data_read_handler(void *data, + Ecore_Fd_Handler *fd_handler) +{ + return _ecore_exe_data_generic_handler(data, fd_handler, + ECORE_EXE_PIPE_READ); +} + +static Eina_Bool +_ecore_exe_data_write_handler(void *data, + Ecore_Fd_Handler *fd_handler __UNUSED__) +{ + Ecore_Exe *exe; + + exe = data; + if ((exe->write_fd_handler) && + (ecore_main_fd_handler_active_get + (exe->write_fd_handler, ECORE_FD_WRITE))) + _ecore_exe_flush(exe); + + /* If we have sent all there is to send, and we need to close the pipe, then close it. */ + if ((exe->close_stdin == 1) + && (exe->write_data_size == exe->write_data_offset)) + { + int ok = 0; + int result; + + INF("Closing stdin for %s", exe->cmd); + /* if (exe->child_fd_write != -1) E_NO_ERRNO(result, fsync(exe->child_fd_write), ok); This a) doesn't work, and b) isn't needed. */ + IF_FN_DEL(ecore_main_fd_handler_del, exe->write_fd_handler); + if (exe->child_fd_write != -1) + E_NO_ERRNO(result, close(exe->child_fd_write), ok); + exe->child_fd_write = -1; + IF_FREE(exe->write_data_buf); + } + + return ECORE_CALLBACK_RENEW; +} + +static void +_ecore_exe_flush(Ecore_Exe *exe) +{ + int count; + + /* check whether we need to write anything at all. */ + if ((exe->child_fd_write == -1) || (!exe->write_data_buf)) + return; + if (exe->write_data_size == exe->write_data_offset) + return; + + count = write(exe->child_fd_write, + (char *)exe->write_data_buf + exe->write_data_offset, + exe->write_data_size - exe->write_data_offset); + if (count < 1) + { + if (errno == EIO || errno == EBADF || errno == EPIPE || errno == EINVAL || errno == ENOSPC) /* we lost our exe! */ + { + ecore_exe_terminate(exe); + if (exe->write_fd_handler) + ecore_main_fd_handler_active_set(exe->write_fd_handler, 0); + } + } + else + { + exe->write_data_offset += count; + if (exe->write_data_offset >= exe->write_data_size) /* Nothing left to write, clean up. */ + { + exe->write_data_size = 0; + exe->write_data_offset = 0; + IF_FREE(exe->write_data_buf); + if (exe->write_fd_handler) + ecore_main_fd_handler_active_set(exe->write_fd_handler, 0); + } + } +} + +static void +_ecore_exe_event_exe_data_free(void *data __UNUSED__, + void *ev) +{ + Ecore_Exe_Event_Data *e; + + e = ev; + ecore_exe_event_data_free(e); +} + +static Ecore_Exe_Event_Add * +_ecore_exe_event_add_new(void) +{ + Ecore_Exe_Event_Add *e; + + e = calloc(1, sizeof(Ecore_Exe_Event_Add)); + return e; +} + +static void +_ecore_exe_event_add_free(void *data __UNUSED__, + void *ev) +{ + Ecore_Exe_Event_Add *e; + + e = ev; + free(e); +} + +void * +_ecore_exe_event_del_new(void) +{ + Ecore_Exe_Event_Del *e; + + e = calloc(1, sizeof(Ecore_Exe_Event_Del)); + return e; +} + +void +_ecore_exe_event_del_free(void *data __UNUSED__, + void *ev) +{ + Ecore_Exe_Event_Del *e; + + e = ev; + if (e->exe) + ecore_exe_free(e->exe); + free(e); +} + +static void +_ecore_exe_dead_attach(Ecore_Exe *exe) +{ + struct _ecore_exe_dead_exe *dead; + + if (exe->doomsday_clock_dead) return; + dead = calloc(1, sizeof(struct _ecore_exe_dead_exe)); + if (dead) + { + dead->pid = exe->pid; + dead->cmd = strdup(exe->cmd); + IF_FN_DEL(ecore_timer_del, exe->doomsday_clock); + exe->doomsday_clock = + ecore_timer_add(10.0, _ecore_exe_make_sure_its_dead, dead); + exe->doomsday_clock_dead = dead; + } +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_exe_ps3.c b/libraries/ecore/src/lib/ecore/ecore_exe_ps3.c new file mode 100644 index 0000000..1ef1e81 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_exe_ps3.c @@ -0,0 +1,20 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef HAVE_ESCAPE +# include +#endif + +#include "Ecore.h" +#include "ecore_private.h" + +void +_ecore_exe_init(void) +{ +} + +void +_ecore_exe_shutdown(void) +{ +} diff --git a/libraries/ecore/src/lib/ecore/ecore_exe_win32.c b/libraries/ecore/src/lib/ecore/ecore_exe_win32.c new file mode 100644 index 0000000..1f5cb4e --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_exe_win32.c @@ -0,0 +1,1055 @@ +/* + * TODO: + * - manage I/O pipes (several ones, and stdin) + * - manage SetConsoleCtrlHandler ? + * - the child process seems to still run after the DEL event + * - add log messages + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef HAVE_EVIL +# include +#endif + +#include "Ecore.h" +#include "ecore_private.h" + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +#include + +#define ECORE_EXE_WIN32_TIMEOUT 3000 + +typedef enum +{ + ECORE_EXE_WIN32_SIGINT, + ECORE_EXE_WIN32_SIGQUIT, + ECORE_EXE_WIN32_SIGTERM, + ECORE_EXE_WIN32_SIGKILL +} Ecore_Exe_Win32_Signal; + +struct _Ecore_Exe +{ + EINA_INLIST; + ECORE_MAGIC; + + HANDLE process2; + HANDLE process; /* CloseHandle */ + HANDLE process_thread; + DWORD process_id; + DWORD thread_id; + void *data; + char *tag; + char *cmd; + Ecore_Exe_Flags flags; + Ecore_Exe_Win32_Signal sig; + Ecore_Win32_Handler *h_close; + struct + { + HANDLE child_pipe; + HANDLE child_pipe_x; + Ecore_Pipe *p; + HANDLE thread; + void *data_buf; + int data_size; + } pipe_read; + struct + { + HANDLE child_pipe; + HANDLE child_pipe_x; + HANDLE thread; + Ecore_Win32_Handler *h; + void *data_buf; + int data_size; + } pipe_write; + struct + { + HANDLE child_pipe; + HANDLE child_pipe_x; + Ecore_Pipe *p; + HANDLE thread; + void *data_buf; + int data_size; + } pipe_error; + Eina_Bool close_stdin : 1; + Eina_Bool is_suspended : 1; + + Ecore_Exe_Cb pre_free_cb; +}; + +static Ecore_Exe *exes = NULL; + +static int _ecore_exe_win32_pipes_set(Ecore_Exe *exe); +static void _ecore_exe_win32_pipes_close(Ecore_Exe *exe); + +static BOOL CALLBACK _ecore_exe_enum_windows_procedure(HWND window, + LPARAM data); +static void _ecore_exe_event_add_free(void *data, + void *ev); +static void _ecore_exe_event_del_free(void *data, + void *ev); +static void _ecore_exe_event_exe_data_free(void *data, + void *ev); +static int _ecore_exe_win32_pipe_thread_generic_cb(void *data, + Ecore_Exe_Flags flags); +static DWORD WINAPI _ecore_exe_win32_pipe_thread_read_cb(void *data); +static DWORD WINAPI _ecore_exe_win32_pipe_thread_error_cb(void *data); +static Eina_Bool _ecore_exe_close_cb(void *data, + Ecore_Win32_Handler *wh); +static void _ecore_exe_pipe_read_cb(void *data, + void *buf, + unsigned int size); +static int _ecore_exe_pipe_write_cb(void *data, + Ecore_Win32_Handler *wh); +static void _ecore_exe_pipe_error_cb(void *data, + void *buf, + unsigned int size); + +EAPI int ECORE_EXE_EVENT_ADD = 0; +EAPI int ECORE_EXE_EVENT_DEL = 0; +EAPI int ECORE_EXE_EVENT_DATA = 0; +EAPI int ECORE_EXE_EVENT_ERROR = 0; + +void +_ecore_exe_init(void) +{ + ECORE_EXE_EVENT_ADD = ecore_event_type_new(); + ECORE_EXE_EVENT_DEL = ecore_event_type_new(); + ECORE_EXE_EVENT_DATA = ecore_event_type_new(); + ECORE_EXE_EVENT_ERROR = ecore_event_type_new(); +} + +void +_ecore_exe_shutdown(void) +{ + while (exes) + ecore_exe_free(exes); +} + +static int run_pri = NORMAL_PRIORITY_CLASS; + +EAPI void +ecore_exe_run_priority_set(int pri) +{ + switch (pri) + { + case ECORE_EXE_WIN32_PRIORITY_IDLE: + run_pri = IDLE_PRIORITY_CLASS; + break; + + case ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL: + run_pri = BELOW_NORMAL_PRIORITY_CLASS; + break; + + case ECORE_EXE_WIN32_PRIORITY_NORMAL: + run_pri = NORMAL_PRIORITY_CLASS; + break; + + case ECORE_EXE_WIN32_PRIORITY_ABOVE_NORMAL: + run_pri = ABOVE_NORMAL_PRIORITY_CLASS; + break; + + case ECORE_EXE_WIN32_PRIORITY_HIGH: + run_pri = HIGH_PRIORITY_CLASS; + break; + + case ECORE_EXE_WIN32_PRIORITY_REALTIME: + run_pri = REALTIME_PRIORITY_CLASS; + break; + + default: + break; + } +} + +EAPI int +ecore_exe_run_priority_get(void) +{ + switch (run_pri) + { + case IDLE_PRIORITY_CLASS: + return ECORE_EXE_WIN32_PRIORITY_IDLE; + + case BELOW_NORMAL_PRIORITY_CLASS: + return ECORE_EXE_WIN32_PRIORITY_BELOW_NORMAL; + + case NORMAL_PRIORITY_CLASS: + return ECORE_EXE_WIN32_PRIORITY_NORMAL; + + case ABOVE_NORMAL_PRIORITY_CLASS: + return ECORE_EXE_WIN32_PRIORITY_ABOVE_NORMAL; + + case HIGH_PRIORITY_CLASS: + return ECORE_EXE_WIN32_PRIORITY_HIGH; + + case REALTIME_PRIORITY_CLASS: + return ECORE_EXE_WIN32_PRIORITY_REALTIME; + + /* default should not be reached */ + default: + return ECORE_EXE_WIN32_PRIORITY_NORMAL; + } +} + +EAPI Ecore_Exe * +ecore_exe_run(const char *exe_cmd, + const void *data) +{ + return ecore_exe_pipe_run(exe_cmd, 0, data); +} + +EAPI Ecore_Exe * +ecore_exe_pipe_run(const char *exe_cmd, + Ecore_Exe_Flags flags, + const void *data) +{ + STARTUPINFO si; + PROCESS_INFORMATION pi; + Ecore_Exe_Event_Add *e; + Ecore_Exe *exe; + char *ret = NULL; + + exe = calloc(1, sizeof(Ecore_Exe)); + if (!exe) + return NULL; + + if ((flags & ECORE_EXE_PIPE_AUTO) && (!(flags & ECORE_EXE_PIPE_ERROR)) + && (!(flags & ECORE_EXE_PIPE_READ))) + /* We need something to auto pipe. */ + flags |= ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR; + + exe->flags = flags; + if (exe->flags & ECORE_EXE_PIPE_READ) + if (!_ecore_exe_win32_pipes_set(exe)) + goto free_exe; + + if (exe->flags & ECORE_EXE_PIPE_WRITE) + if (!_ecore_exe_win32_pipes_set(exe)) + goto close_pipes; + + if (exe->flags & ECORE_EXE_PIPE_ERROR) + if (!_ecore_exe_win32_pipes_set(exe)) + goto close_pipes; + + if ((exe->flags & ECORE_EXE_USE_SH) || + ((ret = strrstr(exe_cmd, ".bat")) && (ret[4] == '\0'))) + { + char buf[PATH_MAX]; + snprintf(buf, PATH_MAX, "cmd.exe /c %s", exe_cmd); + exe->cmd = strdup(buf); + } + else + exe->cmd = strdup(exe_cmd); + + if (!exe->cmd) + goto close_pipes; + + ZeroMemory(&pi, sizeof(PROCESS_INFORMATION)); + + ZeroMemory(&si, sizeof(STARTUPINFO)); + si.cb = sizeof(STARTUPINFO); + si.hStdOutput = exe->pipe_read.child_pipe_x; + si.hStdInput = exe->pipe_write.child_pipe; + si.hStdError = exe->pipe_error.child_pipe_x; + si.dwFlags |= STARTF_USESTDHANDLES; + + /* FIXME: gerer la priorite */ + + if (!CreateProcess(NULL, exe->cmd, NULL, NULL, EINA_TRUE, + run_pri | CREATE_SUSPENDED, NULL, NULL, &si, &pi)) + goto free_exe_cmd; + + /* be sure that the child process is running */ + /* FIXME: This does not work if the child is an EFL-based app */ + /* if (WaitForInputIdle(pi.hProcess, INFINITE) == WAIT_FAILED) */ + /* goto free_exe_cmd; */ + + ECORE_MAGIC_SET(exe, ECORE_MAGIC_EXE); + exe->process = pi.hProcess; + exe->process_thread = pi.hThread; + exe->process_id = pi.dwProcessId; + exe->thread_id = pi.dwThreadId; + exe->data = (void *)data; + + if (!(exe->process2 = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_SUSPEND_RESUME | PROCESS_TERMINATE | SYNCHRONIZE, + EINA_FALSE, pi.dwProcessId))) + goto close_thread; + + exe->h_close = ecore_main_win32_handler_add(exe->process2, _ecore_exe_close_cb, exe); + if (!exe->h_close) goto close_process2; + + if (ResumeThread(exe->process_thread) == ((DWORD)-1)) + goto close_process2; + + exes = (Ecore_Exe *)eina_inlist_append(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe)); + + e = (Ecore_Exe_Event_Add *)calloc(1, sizeof(Ecore_Exe_Event_Add)); + if (!e) goto delete_h_close; + + e->exe = exe; + ecore_event_add(ECORE_EXE_EVENT_ADD, e, + _ecore_exe_event_add_free, NULL); + + return exe; + +delete_h_close: + ecore_main_win32_handler_del(exe->h_close); +close_process2: + CloseHandle(exe->process2); +close_thread: + CloseHandle(exe->process_thread); + CloseHandle(exe->process); +free_exe_cmd: + free(exe->cmd); +close_pipes: + _ecore_exe_win32_pipes_close(exe); +free_exe: + free(exe); + return NULL; +} + +EAPI void +ecore_exe_callback_pre_free_set(Ecore_Exe *exe, + Ecore_Exe_Cb func) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, + "ecore_exe_callback_pre_free_set"); + return; + } + exe->pre_free_cb = func; +} + +EAPI Eina_Bool +ecore_exe_send(Ecore_Exe *exe, + const void *data, + int size) +{ + void *buf; + + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_send"); + return 0; + } + + if (exe->close_stdin) + { + ERR("Ecore_Exe %p stdin is closed! Cannot send %d bytes from %p", + exe, size, data); + return 0; + } + + if (!exe->pipe_write.child_pipe) + { + ERR("Ecore_Exe %p created without ECORE_EXE_PIPE_WRITE! " + "Cannot send %d bytes from %p", exe, size, data); + return 0; + } + + buf = realloc(exe->pipe_write.data_buf, exe->pipe_write.data_size + size); + if (!buf) return 0; + + exe->pipe_write.data_buf = buf; + memcpy((char *)exe->pipe_write.data_buf + exe->pipe_write.data_size, data, size); + exe->pipe_write.data_size += size; + + /* if (exe->pipe_write.) */ + /* ecore_main_fd_handler_active_set(exe->pipe_write.h, ECORE_FD_WRITE); */ + + return 1; +} + +EAPI void +ecore_exe_close_stdin(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_close_stdin"); + return; + } + exe->close_stdin = 1; +} + +/* Not used on Windows */ +EAPI void +ecore_exe_auto_limits_set(Ecore_Exe *exe __UNUSED__, + int start_bytes __UNUSED__, + int end_bytes __UNUSED__, + int start_lines __UNUSED__, + int end_lines __UNUSED__) +{ +} + +EAPI Ecore_Exe_Event_Data * +ecore_exe_event_data_get(Ecore_Exe *exe, + Ecore_Exe_Flags flags) +{ + Ecore_Exe_Event_Data *e = NULL; + unsigned char *inbuf; + int inbuf_num; + + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_event_data_get"); + return NULL; + } + + /* Sort out what sort of event we are, */ + /* And get the data. */ + if (flags & ECORE_EXE_PIPE_READ) + { + inbuf = exe->pipe_read.data_buf; + inbuf_num = exe->pipe_read.data_size; + exe->pipe_read.data_buf = NULL; + exe->pipe_read.data_size = 0; + } + else + { + inbuf = exe->pipe_error.data_buf; + inbuf_num = exe->pipe_error.data_size; + exe->pipe_error.data_buf = NULL; + exe->pipe_error.data_size = 0; + } + + e = calloc(1, sizeof(Ecore_Exe_Event_Data)); + if (e) + { + e->exe = exe; + e->data = inbuf; + e->size = inbuf_num; + } + + return e; +} + +EAPI void +ecore_exe_event_data_free(Ecore_Exe_Event_Data *e) +{ + if (!e) return; + IF_FREE(e->lines); + IF_FREE(e->data); + free(e); +} + +EAPI void * +ecore_exe_free(Ecore_Exe *exe) +{ + void *data; + + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_free"); + return NULL; + } + + data = exe->data; + + if (exe->pre_free_cb) + exe->pre_free_cb(data, exe); + + CloseHandle(exe->process2); + CloseHandle(exe->process_thread); + CloseHandle(exe->process); + free(exe->cmd); + _ecore_exe_win32_pipes_close(exe); + exes = (Ecore_Exe *)eina_inlist_remove(EINA_INLIST_GET(exes), EINA_INLIST_GET(exe)); + ECORE_MAGIC_SET(exe, ECORE_MAGIC_NONE); + if (exe->tag) free(exe->tag); + free(exe); + + return data; +} + +EAPI pid_t +ecore_exe_pid_get(const Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_pid_get"); + return -1; + } + return exe->process_id; +} + +EAPI void +ecore_exe_tag_set(Ecore_Exe *exe, + const char *tag) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_tag_set"); + return; + } + IF_FREE(exe->tag); + if (tag) + exe->tag = strdup(tag); +} + +EAPI const char * +ecore_exe_tag_get(const Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_tag_get"); + return NULL; + } + return exe->tag; +} + +EAPI const char * +ecore_exe_cmd_get(const Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_cmd_get"); + return NULL; + } + return exe->cmd; +} + +EAPI void * +ecore_exe_data_get(const Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_data_get"); + return NULL; + } + return exe->data; +} + +EAPI Ecore_Exe_Flags +ecore_exe_flags_get(const Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_data_get"); + return 0; + } + return exe->flags; +} + +EAPI void +ecore_exe_pause(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_pause"); + return; + } + + if (exe->is_suspended) + return; + + if (SuspendThread(exe->process_thread) != (DWORD)-1) + exe->is_suspended = 1; +} + +EAPI void +ecore_exe_continue(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_continue"); + return; + } + + if (!exe->is_suspended) + return; + + if (ResumeThread(exe->process_thread) != (DWORD)-1) + exe->is_suspended = 0; +} + +EAPI void +ecore_exe_interrupt(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_interrupt"); + return; + } + + CloseHandle(exe->process_thread); + CloseHandle(exe->process); + exe->sig = ECORE_EXE_WIN32_SIGINT; + while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe)) ; +} + +EAPI void +ecore_exe_quit(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_quit"); + return; + } + + CloseHandle(exe->process_thread); + CloseHandle(exe->process); + exe->sig = ECORE_EXE_WIN32_SIGQUIT; + while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe)) ; +} + +EAPI void +ecore_exe_terminate(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_terminate"); + return; + } + +/* CloseHandle(exe->thread); */ + CloseHandle(exe->process); + exe->sig = ECORE_EXE_WIN32_SIGTERM; + while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe)) ; +} + +EAPI void +ecore_exe_kill(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_kill"); + return; + } + + CloseHandle(exe->process_thread); + CloseHandle(exe->process); + exe->sig = ECORE_EXE_WIN32_SIGKILL; + while (EnumWindows(_ecore_exe_enum_windows_procedure, (LPARAM)exe)) ; +} + +EAPI void +ecore_exe_signal(Ecore_Exe *exe, + int num __UNUSED__) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_signal"); + return; + } + + /* does nothing */ +} + +EAPI void +ecore_exe_hup(Ecore_Exe *exe) +{ + if (!ECORE_MAGIC_CHECK(exe, ECORE_MAGIC_EXE)) + { + ECORE_MAGIC_FAIL(exe, ECORE_MAGIC_EXE, "ecore_exe_hup"); + return; + } + + /* does nothing */ +} + +/* FIXME: manage error mode */ +static int +_ecore_exe_win32_pipe_thread_generic_cb(void *data, + Ecore_Exe_Flags flags) +{ +#define BUFSIZE 2048 + char buf[BUFSIZE]; + Ecore_Exe *exe; + char *current_buf = NULL; + HANDLE child_pipe; + Ecore_Pipe *ecore_pipe; + Ecore_Exe_Event_Data *event; + DWORD size; + DWORD current_size = 0; + BOOL res; + + exe = (Ecore_Exe *)data; + + /* Sort out what sort of handler we are. */ + /* And get any left over data from last time. */ + if ((exe->flags & ECORE_EXE_PIPE_READ) && (flags == ECORE_EXE_PIPE_READ)) + { + child_pipe = exe->pipe_read.child_pipe; + ecore_pipe = exe->pipe_read.p; + flags = ECORE_EXE_PIPE_READ; + } + else if ((exe->flags & ECORE_EXE_PIPE_ERROR) && (flags == ECORE_EXE_PIPE_ERROR)) + { + child_pipe = exe->pipe_error.child_pipe; + ecore_pipe = exe->pipe_error.p; + flags = ECORE_EXE_PIPE_ERROR; + } + else + return 0; + + while (1) + { + if (!PeekNamedPipe(child_pipe, buf, sizeof(buf), &size, ¤t_size, NULL)) + continue; + if (size == 0) + continue; + current_buf = (char *)malloc(current_size); + if (!current_buf) + continue; + res = ReadFile(child_pipe, current_buf, current_size, &size, NULL); + if (!res || (size == 0)) + { + free(current_buf); + current_buf = NULL; + continue; + } + if (current_size != size) + { + free(current_buf); + current_buf = NULL; + continue; + } + current_size = size; + + if (flags == ECORE_EXE_PIPE_READ) + { + exe->pipe_read.data_buf = current_buf; + exe->pipe_read.data_size = current_size; + } + else + { + exe->pipe_error.data_buf = current_buf; + exe->pipe_error.data_size = current_size; + } + + event = ecore_exe_event_data_get(exe, flags); + if (event) + ecore_pipe_write(ecore_pipe, &event, sizeof(event)); + + current_buf = NULL; + current_size = 0; + } + + return 1; +} + +static DWORD WINAPI +_ecore_exe_win32_pipe_thread_read_cb(void *data) +{ + return _ecore_exe_win32_pipe_thread_generic_cb(data, ECORE_EXE_PIPE_READ); +} + +static DWORD WINAPI +_ecore_exe_win32_pipe_thread_error_cb(void *data) +{ + return _ecore_exe_win32_pipe_thread_generic_cb(data, ECORE_EXE_PIPE_ERROR); +} + +static int +_ecore_exe_win32_pipes_set(Ecore_Exe *exe) +{ + SECURITY_ATTRIBUTES sa; + HANDLE child_pipe; + HANDLE child_pipe_x; + + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.bInheritHandle = EINA_TRUE; + sa.lpSecurityDescriptor = NULL; + + if (!CreatePipe(&child_pipe, &child_pipe_x, &sa, 0)) + return 0; + if (exe->flags & ECORE_EXE_PIPE_WRITE) + { + if (!SetHandleInformation(child_pipe_x, HANDLE_FLAG_INHERIT, 0)) + goto close_pipe; + } + else + { + if (!SetHandleInformation(child_pipe, HANDLE_FLAG_INHERIT, 0)) + goto close_pipe; + } + + if (exe->flags & ECORE_EXE_PIPE_READ) + { + exe->pipe_read.child_pipe = child_pipe; + exe->pipe_read.child_pipe_x = child_pipe_x; + exe->pipe_read.p = ecore_pipe_add(_ecore_exe_pipe_read_cb, exe); + exe->pipe_read.thread = CreateThread(NULL, 0, + _ecore_exe_win32_pipe_thread_read_cb, + exe, 0, NULL); + } + else if (exe->flags & ECORE_EXE_PIPE_WRITE) + { + exe->pipe_write.child_pipe = child_pipe; + exe->pipe_write.child_pipe_x = child_pipe_x; +/* exe->pipe_write.thread = CreateThread(NULL, 0, */ +/* _ecore_exe_win32_pipe_thread_cb, */ +/* exe, 0, NULL); */ + } + else + { + exe->pipe_error.child_pipe = child_pipe; + exe->pipe_error.child_pipe_x = child_pipe_x; + exe->pipe_error.p = ecore_pipe_add(_ecore_exe_pipe_error_cb, exe); + exe->pipe_error.thread = CreateThread(NULL, 0, + _ecore_exe_win32_pipe_thread_error_cb, + exe, 0, NULL); + } + + return 1; + +close_pipe: + CloseHandle(child_pipe); + CloseHandle(child_pipe_x); + + return 0; +} + +static void +_ecore_exe_win32_pipes_close(Ecore_Exe *exe) +{ + if (exe->flags & ECORE_EXE_PIPE_READ) + { + if (exe->pipe_read.child_pipe) + { + CloseHandle(exe->pipe_read.child_pipe); + exe->pipe_read.child_pipe = NULL; + } + if (exe->pipe_read.child_pipe_x) + { + CloseHandle(exe->pipe_read.child_pipe_x); + exe->pipe_read.child_pipe_x = NULL; + } + } + + if (exe->flags & ECORE_EXE_PIPE_WRITE) + { + if (exe->pipe_write.child_pipe) + { + CloseHandle(exe->pipe_write.child_pipe); + exe->pipe_write.child_pipe = NULL; + } + if (exe->pipe_write.child_pipe_x) + { + CloseHandle(exe->pipe_write.child_pipe_x); + exe->pipe_write.child_pipe_x = NULL; + } + } + + if (exe->flags & ECORE_EXE_PIPE_ERROR) + { + if (exe->pipe_error.child_pipe) + { + CloseHandle(exe->pipe_error.child_pipe); + exe->pipe_error.child_pipe = NULL; + } + if (exe->pipe_error.child_pipe_x) + { + CloseHandle(exe->pipe_error.child_pipe_x); + exe->pipe_error.child_pipe_x = NULL; + } + } +} + +static DWORD WINAPI +_ecore_exe_thread_procedure(LPVOID data __UNUSED__) +{ + GenerateConsoleCtrlEvent(CTRL_C_EVENT, 0); + GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, 0); + return 1; +} + +static BOOL CALLBACK +_ecore_exe_enum_windows_procedure(HWND window, + LPARAM data) +{ + Ecore_Exe *exe; + DWORD thread_id; + + exe = (Ecore_Exe *)data; + thread_id = GetWindowThreadProcessId(window, NULL); + + if (thread_id == exe->thread_id) + { + /* Ctrl-C or Ctrl-Break */ + if (CreateRemoteThread(exe->process, NULL, 0, + (LPTHREAD_START_ROUTINE)_ecore_exe_thread_procedure, NULL, + 0, NULL)) + { + printf ("remote thread\n"); + return EINA_FALSE; + } + + if ((exe->sig == ECORE_EXE_WIN32_SIGINT) || + (exe->sig == ECORE_EXE_WIN32_SIGQUIT)) + { + printf ("int or quit\n"); + return EINA_FALSE; + } + + /* WM_CLOSE message */ + PostMessage(window, WM_CLOSE, 0, 0); + if (WaitForSingleObject(exe->process, ECORE_EXE_WIN32_TIMEOUT) == WAIT_OBJECT_0) + { + printf ("CLOSE\n"); + return EINA_FALSE; + } + + /* WM_QUIT message */ + PostMessage(window, WM_QUIT, 0, 0); + if (WaitForSingleObject(exe->process, ECORE_EXE_WIN32_TIMEOUT) == WAIT_OBJECT_0) + { + printf ("QUIT\n"); + return EINA_FALSE; + } + + /* Exit process */ + if (CreateRemoteThread(exe->process, NULL, 0, + (LPTHREAD_START_ROUTINE)ExitProcess, NULL, + 0, NULL)) + { + printf ("remote thread 2\n"); + return EINA_FALSE; + } + + if (exe->sig == ECORE_EXE_WIN32_SIGTERM) + { + printf ("term\n"); + return EINA_FALSE; + } + + TerminateProcess(exe->process, 0); + + return EINA_FALSE; + } + + return EINA_TRUE; +} + +static void +_ecore_exe_event_add_free(void *data __UNUSED__, + void *ev) +{ + Ecore_Exe_Event_Add *e; + + e = (Ecore_Exe_Event_Add *)ev; + free(e); +} + +static void +_ecore_exe_event_del_free(void *data __UNUSED__, + void *ev) +{ + Ecore_Exe_Event_Del *e; + + e = (Ecore_Exe_Event_Del *)ev; + if (e->exe) + ecore_exe_free(e->exe); + free(e); +} + +static void +_ecore_exe_event_exe_data_free(void *data __UNUSED__, + void *ev) +{ + Ecore_Exe_Event_Data *e; + + e = (Ecore_Exe_Event_Data *)ev; + ecore_exe_event_data_free(e); +} + +static Eina_Bool +_ecore_exe_close_cb(void *data, + Ecore_Win32_Handler *wh __UNUSED__) +{ + Ecore_Exe_Event_Del *e; + Ecore_Exe *exe; + DWORD exit_code = 0; + + e = calloc(1, sizeof(Ecore_Exe_Event_Del)); + if (!e) return 0; + + exe = (Ecore_Exe *)data; + + if (GetExitCodeProcess(exe->process2, &exit_code)) + { + e->exit_code = exit_code; + e->exited = 1; + } + else + { + char *msg; + + msg = evil_last_error_get(); + printf("%s\n", msg); + free(msg); + } + e->pid = exe->process_id; + e->exe = exe; + + ecore_event_add(ECORE_EXE_EVENT_DEL, e, + _ecore_exe_event_del_free, NULL); + + return 0; +} + +static void +_ecore_exe_pipe_read_cb(void *data, + void *buf, + unsigned int size) +{ + Ecore_Exe_Event_Data *e; + + e = *((Ecore_Exe_Event_Data **)buf); + if (e) + ecore_event_add(ECORE_EXE_EVENT_DATA, e, + _ecore_exe_event_exe_data_free, + NULL); +} + +static int +_ecore_exe_pipe_write_cb(void *data, + Ecore_Win32_Handler *wh __UNUSED__) +{ + char buf[READBUFSIZ]; + Ecore_Exe *exe; + DWORD num_exe; + BOOL res; + + exe = (Ecore_Exe *)data; + + res = WriteFile(exe->pipe_write.child_pipe_x, buf, READBUFSIZ, &num_exe, NULL); + if (!res || num_exe == 0) + { + /* FIXME: what to do here ?? */ + } + + if (exe->close_stdin == 1) + { + if (exe->pipe_write.h) + { + ecore_main_win32_handler_del(exe->pipe_write.h); + exe->pipe_write.h = NULL; + } + exe->pipe_write.h = NULL; + CloseHandle(exe->pipe_write.child_pipe); + exe->pipe_write.child_pipe = NULL; + } + + return 1; +} + +static void +_ecore_exe_pipe_error_cb(void *data, + void *buf, + unsigned int size) +{ + Ecore_Exe_Event_Data *e; + + e = *((Ecore_Exe_Event_Data **)buf); + if (e) + ecore_event_add(ECORE_EXE_EVENT_ERROR, e, + _ecore_exe_event_exe_data_free, + NULL); +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_exe_wince.c b/libraries/ecore/src/lib/ecore/ecore_exe_wince.c new file mode 100644 index 0000000..c07fcbe --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_exe_wince.c @@ -0,0 +1,21 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef HAVE_EVIL +# include +#endif + +#include "Ecore.h" +#include "ecore_private.h" + +void +_ecore_exe_init(void) +{ +} + +void +_ecore_exe_shutdown(void) +{ +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_getopt.c b/libraries/ecore/src/lib/ecore/ecore_getopt.c new file mode 100644 index 0000000..0ce8f6e --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_getopt.c @@ -0,0 +1,1908 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef HAVE_ALLOCA_H +# include +#elif defined __GNUC__ +# define alloca __builtin_alloca +#elif defined _AIX +# define alloca __alloca +#elif defined _MSC_VER +# include +# define alloca _alloca +#else +# include +# ifdef __cplusplus +extern "C" +# endif +void *alloca(size_t); +#endif + +#include +#include +#include +#include + +#ifdef ENABLE_NLS +# include +#else +# define gettext(x) (x) +# define dgettext(domain, x) (x) +#endif + +#define _(x) dgettext("ecore", x) + +#ifdef _WIN32_WCE +# include +#endif + +#include "Ecore.h" +#include "Ecore_Getopt.h" + +static const char *prog = NULL; +static char **argv = NULL; +static int argc = 0; +static int cols = 80; +static int helpcol = 80 / 3; + +static void +_ecore_getopt_help_print_replace_program(FILE *fp, + const Ecore_Getopt *parser __UNUSED__, + const char *text) +{ + do + { + const char *d = strchr(text, '%'); + + if (!d) + { + fputs(text, fp); + break; + } + + if (fwrite(text, 1, d - text, fp) != (size_t)(d - text)) + return; + d++; + if (strncmp(d, "prog", sizeof("prog") - 1) == 0) + { + fputs(prog ? prog : "???", fp); + d += sizeof("prog") - 1; + } + else + { + if (d[0] == '%') + d++; + fputc('%', fp); + } + + text = d; + } + while (text[0] != '\0'); + + fputc('\n', fp); +} + +static void +_ecore_getopt_version(FILE *fp, + const Ecore_Getopt *parser) +{ + fputs(_("Version:"), fp); + fputc(' ', fp); + _ecore_getopt_help_print_replace_program(fp, parser, parser->version); +} + +static void +_ecore_getopt_help_usage(FILE *fp, + const Ecore_Getopt *parser) +{ + fputs(_("Usage:"), fp); + fputc(' ', fp); + + if (!parser->usage) + { + fprintf(fp, _("%s [options]\n"), prog); + return; + } + + _ecore_getopt_help_print_replace_program(fp, parser, gettext(parser->usage)); +} + +static int +_ecore_getopt_help_line(FILE *fp, + const int base, + const int total, + int used, + const char *text, + int len) +{ + int linebreak = 0; + do + { + /* process line considering spaces (new line and tabs are spaces!) */ + while ((used < total) && (len > 0)) + { + const char *space = NULL; + int i, todo; + + todo = total - used; + if (todo > len) + todo = len; + + for (i = 0; i < todo; i++) + if (isspace(text[i])) + { + space = text + i; + break; + } + + if (space) + { + i = fwrite(text, 1, i, fp); + i++; + text += i; + len -= i; + used += i; + + if (linebreak) + { + linebreak = 0; + continue; + } + + if (space[0] == '\n') + break; + else if (space[0] == '\t') + { + int c; + + used--; + c = ((used / 8) + 1) * 8; + if (c < total) + { + for (; used < c; used++) + fputc(' ', fp); + } + else + { + text--; + len++; + break; + } + } + else if (used < total) + fputc(space[0], fp); + } + else + { + i = fwrite(text, 1, i, fp); + text += i; + len -= i; + used += i; + } + linebreak = 0; + } + if (len <= 0) + break; + linebreak = 1; + fputc('\n', fp); + for (used = 0; used < base; used++) + fputc(' ', fp); + } + while (1); + + return used; +} + +static void +_ecore_getopt_help_description(FILE *fp, + const Ecore_Getopt *parser) +{ + const char *p, *prg, *ver; + int used, prglen, verlen; + + p = gettext(parser->description); + if (!p) + return; + + fputc('\n', fp); + + prg = prog ? prog : "???"; + ver = parser->version ? parser->version : "???"; + + prglen = strlen(prg); + verlen = strlen(ver); + + used = 0; + + do + { + const char *d = strchr(p, '%'); + + if (!d) + { + _ecore_getopt_help_line(fp, 0, cols, used, p, strlen(p)); + break; + } + + used = _ecore_getopt_help_line(fp, 0, cols, used, p, d - p); + d++; + if (strncmp(d, "prog", sizeof("prog") - 1) == 0) + { + used = _ecore_getopt_help_line(fp, 0, cols, used, prg, prglen); + d += sizeof("prog") - 1; + } + else if (strncmp(d, "version", sizeof("version") - 1) == 0) + { + used = _ecore_getopt_help_line(fp, 0, cols, used, ver, verlen); + d += sizeof("version") - 1; + } + else + { + if (d[0] == '%') + d++; + used = _ecore_getopt_help_line(fp, 0, cols, used, "%", 1); + } + + p = d; + } + while (p[0] != '\0'); + + fputs("\n\n", fp); +} + +static void +_ecore_getopt_copyright(FILE *fp, + const Ecore_Getopt *parser) +{ + const char *txt = gettext(parser->copyright); + fputs(_("Copyright:"), fp); + fputs("\n ", fp); + _ecore_getopt_help_line + (fp, 3, cols, 3, txt, strlen(txt)); + fputc('\n', fp); +} + +static void +_ecore_getopt_license(FILE *fp, + const Ecore_Getopt *parser) +{ + const char *txt = gettext(parser->license); + fputs(_("License:"), fp); + fputs("\n ", fp); + _ecore_getopt_help_line + (fp, 3, cols, 3, txt, strlen(txt)); + fputc('\n', fp); +} + +static Ecore_Getopt_Desc_Arg_Requirement +_ecore_getopt_desc_arg_requirement(const Ecore_Getopt_Desc *desc) +{ + switch (desc->action) + { + case ECORE_GETOPT_ACTION_STORE: + return desc->action_param.store.arg_req; + + case ECORE_GETOPT_ACTION_STORE_CONST: + return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO; + + case ECORE_GETOPT_ACTION_STORE_TRUE: + return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO; + + case ECORE_GETOPT_ACTION_STORE_FALSE: + return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO; + + case ECORE_GETOPT_ACTION_CHOICE: + return ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES; + + case ECORE_GETOPT_ACTION_APPEND: + return ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES; + + case ECORE_GETOPT_ACTION_COUNT: + return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO; + + case ECORE_GETOPT_ACTION_CALLBACK: + return desc->action_param.callback.arg_req; + + case ECORE_GETOPT_ACTION_HELP: + return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO; + + case ECORE_GETOPT_ACTION_VERSION: + return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO; + + default: + return ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO; + } +} + +static void +_ecore_getopt_help_desc_setup_metavar(const Ecore_Getopt_Desc *desc, + char *metavar, + int *metavarlen, + int maxsize) +{ + if (desc->metavar) + { + const char *txt = gettext(desc->metavar); + *metavarlen = strlen(txt); + if (*metavarlen > maxsize - 1) + *metavarlen = maxsize - 1; + + memcpy(metavar, txt, *metavarlen); + metavar[*metavarlen] = '\0'; + } + else if (desc->longname) + { + int i; + + *metavarlen = strlen(desc->longname); + if (*metavarlen > maxsize - 1) + *metavarlen = maxsize - 1; + + for (i = 0; i < *metavarlen; i++) + metavar[i] = toupper((int) desc->longname[i]); + metavar[i] = '\0'; + } +} + +static int +_ecore_getopt_help_desc_show_arg(FILE *fp, + Ecore_Getopt_Desc_Arg_Requirement requirement, + const char *metavar, + int metavarlen) +{ + int used; + + if (requirement == ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO) + return 0; + + used = 0; + + if (requirement == ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL) + { + fputc('[', fp); + used++; + } + + if (requirement != ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO) + { + fputc('=', fp); + fputs(metavar, fp); + used += metavarlen + 1; + } + + if (requirement == ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL) + { + fputc(']', fp); + used++; + } + + return used; +} + +static int +_ecore_getopt_help_desc_store(FILE *fp, + const int base, + const int total, + int used, + const Ecore_Getopt_Desc *desc) +{ + const Ecore_Getopt_Desc_Store *store = &desc->action_param.store; + char buf[64]; + const char *str; + size_t len; + + fputc('\n', fp); + for (used = 0; used < base; used++) + fputc(' ', fp); + + switch (store->type) + { + case ECORE_GETOPT_TYPE_STR: + str = "STR"; + len = sizeof("STR") - 1; + break; + + case ECORE_GETOPT_TYPE_BOOL: + str = "BOOL"; + len = sizeof("BOOL") - 1; + break; + + case ECORE_GETOPT_TYPE_SHORT: + str = "SHORT"; + len = sizeof("SHORT") - 1; + break; + + case ECORE_GETOPT_TYPE_INT: + str = "INT"; + len = sizeof("INT") - 1; + break; + + case ECORE_GETOPT_TYPE_LONG: + str = "LONG"; + len = sizeof("LONG") - 1; + break; + + case ECORE_GETOPT_TYPE_USHORT: + str = "USHORT"; + len = sizeof("USHORT") - 1; + break; + + case ECORE_GETOPT_TYPE_UINT: + str = "UINT"; + len = sizeof("UINT") - 1; + break; + + case ECORE_GETOPT_TYPE_ULONG: + str = "ULONG"; + len = sizeof("ULONG") - 1; + break; + + case ECORE_GETOPT_TYPE_DOUBLE: + str = "DOUBLE"; + len = sizeof("DOUBLE") - 1; + break; + + default: + str = "???"; + len = sizeof("???") - 1; + } + + used = _ecore_getopt_help_line + (fp, base, total, used, _("Type: "), strlen(_("Type: "))); + used = _ecore_getopt_help_line(fp, base, total, used, str, len); + + if (store->arg_req == ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES) + goto end; + + used = _ecore_getopt_help_line + (fp, base, total, used, ". ", sizeof(". ") - 1); + + switch (store->type) + { + case ECORE_GETOPT_TYPE_STR: + str = store->def.strv; + len = str ? strlen(str) : 0; + break; + + case ECORE_GETOPT_TYPE_BOOL: + str = store->def.boolv ? "true" : "false"; + len = strlen(str); + break; + + case ECORE_GETOPT_TYPE_SHORT: + str = buf; + len = snprintf(buf, sizeof(buf), "%hd", store->def.shortv); + if (len > sizeof(buf) - 1) + len = sizeof(buf) - 1; + break; + + case ECORE_GETOPT_TYPE_INT: + str = buf; + len = snprintf(buf, sizeof(buf), "%d", store->def.intv); + if (len > sizeof(buf) - 1) + len = sizeof(buf) - 1; + break; + + case ECORE_GETOPT_TYPE_LONG: + str = buf; + len = snprintf(buf, sizeof(buf), "%ld", store->def.longv); + if (len > sizeof(buf) - 1) + len = sizeof(buf) - 1; + break; + + case ECORE_GETOPT_TYPE_USHORT: + str = buf; + len = snprintf(buf, sizeof(buf), "%hu", store->def.ushortv); + if (len > sizeof(buf) - 1) + len = sizeof(buf) - 1; + break; + + case ECORE_GETOPT_TYPE_UINT: + str = buf; + len = snprintf(buf, sizeof(buf), "%u", store->def.uintv); + if (len > sizeof(buf) - 1) + len = sizeof(buf) - 1; + break; + + case ECORE_GETOPT_TYPE_ULONG: + str = buf; + len = snprintf(buf, sizeof(buf), "%lu", store->def.ulongv); + if (len > sizeof(buf) - 1) + len = sizeof(buf) - 1; + break; + + case ECORE_GETOPT_TYPE_DOUBLE: + str = buf; + len = snprintf(buf, sizeof(buf), "%f", store->def.doublev); + if (len > sizeof(buf) - 1) + len = sizeof(buf) - 1; + break; + + default: + str = "???"; + len = sizeof("???") - 1; + } + + used = _ecore_getopt_help_line + (fp, base, total, used, _("Default: "), strlen(_("Default: "))); + used = _ecore_getopt_help_line(fp, base, total, used, str, len); + +end: + return _ecore_getopt_help_line(fp, base, total, used, ".", 1); +} + +static int +_ecore_getopt_help_desc_choices(FILE *fp, + const int base, + const int total, + int used, + const Ecore_Getopt_Desc *desc) +{ + const char *const *itr; + const char sep[] = ", "; + const int seplen = sizeof(sep) - 1; + + if (used > 0) + { + fputc('\n', fp); + used = 0; + } + for (; used < base; used++) + fputc(' ', fp); + + used = _ecore_getopt_help_line + (fp, base, total, used, _("Choices: "), strlen(_("Choices: "))); + + for (itr = desc->action_param.choices; *itr; itr++) + { + used = _ecore_getopt_help_line + (fp, base, total, used, *itr, strlen(*itr)); + if (itr[1]) + used = _ecore_getopt_help_line(fp, base, total, used, sep, seplen); + } + + return _ecore_getopt_help_line(fp, base, total, used, ".", 1); +} + +static void +_ecore_getopt_help_desc(FILE *fp, + const Ecore_Getopt_Desc *desc) +{ + Ecore_Getopt_Desc_Arg_Requirement arg_req; + char metavar[32] = "ARG"; + int metavarlen = 3; + int used; + + arg_req = _ecore_getopt_desc_arg_requirement(desc); + if (arg_req != ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO) + _ecore_getopt_help_desc_setup_metavar + (desc, metavar, &metavarlen, sizeof(metavar)); + + fputs(" ", fp); + used = 2; + + if (desc->shortname) + { + fputc('-', fp); + fputc(desc->shortname, fp); + used += 2; + used += _ecore_getopt_help_desc_show_arg + (fp, arg_req, metavar, metavarlen); + } + + if (desc->shortname && desc->longname) + { + fputs(", ", fp); + used += 2; + } + + if (desc->longname) + { + int namelen = strlen(desc->longname); + + fputs("--", fp); + fputs(desc->longname, fp); + used += 2 + namelen; + used += _ecore_getopt_help_desc_show_arg + (fp, arg_req, metavar, metavarlen); + } + + if (!desc->help) + goto end; + + if (used + 3 >= helpcol) + { + fputc('\n', fp); + used = 0; + } + + for (; used < helpcol; used++) + fputc(' ', fp); + + used = _ecore_getopt_help_line + (fp, helpcol, cols, used, desc->help, strlen(desc->help)); + + switch (desc->action) + { + case ECORE_GETOPT_ACTION_STORE: + _ecore_getopt_help_desc_store(fp, helpcol, cols, used, desc); + break; + + case ECORE_GETOPT_ACTION_CHOICE: + _ecore_getopt_help_desc_choices(fp, helpcol, cols, used, desc); + break; + + default: + break; + } + +end: + fputc('\n', fp); +} + +static Eina_Bool +_ecore_getopt_desc_is_sentinel(const Ecore_Getopt_Desc *desc) +{ + return (desc->shortname == '\0') && (!desc->longname); +} + +static void +_ecore_getopt_help_options(FILE *fp, + const Ecore_Getopt *parser) +{ + const Ecore_Getopt_Desc *desc; + + fputs(_("Options:\n"), fp); + + for (desc = parser->descs; !_ecore_getopt_desc_is_sentinel(desc); desc++) + _ecore_getopt_help_desc(fp, desc); + + fputc('\n', fp); +} + +/** + * Show nicely formatted help message for the given parser. + * + * Message will be print to stderr. + */ +void +ecore_getopt_help(FILE *fp, + const Ecore_Getopt *parser) +{ + const char *var; + + if (!parser) return; + + if (argc < 1) + { + ecore_app_args_get(&argc, &argv); + if ((argc > 0) && (argv[0])) + prog = argv[0]; + else + prog = parser->prog; + } + + var = getenv("COLUMNS"); + if (var) + { + cols = atoi(var); + if (cols < 20) + cols = 20; + + helpcol = cols / 3; + } + + _ecore_getopt_help_usage(fp, parser); + _ecore_getopt_help_description(fp, parser); + _ecore_getopt_help_options(fp, parser); +} + +static const Ecore_Getopt_Desc * +_ecore_getopt_parse_find_long(const Ecore_Getopt *parser, + const char *name) +{ + const Ecore_Getopt_Desc *desc = parser->descs; + const char *p = strchr(name, '='); + int len = 0; + + if (p) + len = p - name; + + for (; !_ecore_getopt_desc_is_sentinel(desc); desc++) + { + if (!desc->longname) + continue; + + if (p) + { + if ((strncmp(name, desc->longname, len) == 0) && + (desc->longname[len] == '\0')) + return desc; + } + else + { + if (strcmp(name, desc->longname) == 0) + return desc; + } + } + + return NULL; +} + +static const Ecore_Getopt_Desc * +_ecore_getopt_parse_find_short(const Ecore_Getopt *parser, + char name) +{ + const Ecore_Getopt_Desc *desc = parser->descs; + for (; !_ecore_getopt_desc_is_sentinel(desc); desc++) + if (name == desc->shortname) + return desc; + return NULL; +} + +static int +_ecore_getopt_parse_find_nonargs_base(const Ecore_Getopt *parser, + int argc, + char **argv) +{ + char **nonargs; + int src, dst, used, base; + + nonargs = alloca(sizeof(char *) * argc); + src = 1; + dst = 1; + used = 0; + base = 0; + while (src < argc) + { + const Ecore_Getopt_Desc *desc; + Ecore_Getopt_Desc_Arg_Requirement arg_req; + char *arg = argv[src]; + + if (arg[0] != '-') + goto found_nonarg; + + if (arg[1] == '-') + { + if (arg[2] == '\0') /* explicit end of options, "--" */ + { + base = 1; + break; + } + desc = _ecore_getopt_parse_find_long(parser, arg + 2); + } + else + desc = _ecore_getopt_parse_find_short(parser, arg[1]); + + if (!desc) + { + if (arg[1] == '-') + fprintf(stderr, _("ERROR: unknown option --%s.\n"), arg + 2); + else + fprintf(stderr, _("ERROR: unknown option -%c.\n"), arg[1]); + if (parser->strict) + { + memmove(argv + dst, nonargs, used * sizeof(char *)); + return -1; + } + else + goto found_nonarg; + } + + if (src != dst) + argv[dst] = argv[src]; + src++; + dst++; + + arg_req = _ecore_getopt_desc_arg_requirement(desc); + if (arg_req == ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO) + continue; + + if (strchr(arg, '=')) + continue; + + if ((src >= argc) || (argv[src][0] == '-')) + continue; + + if (src != dst) + argv[dst] = argv[src]; + src++; + dst++; + continue; + +found_nonarg: + nonargs[used] = arg; + used++; + src++; + } + + if (!base) /* '--' not found */ + base = dst; + else + { + base = dst; + if (src != dst) + argv[dst] = argv[src]; + dst++; + } + + memmove(argv + dst, nonargs, used * sizeof(char *)); + return base; +} + +static void +_ecore_getopt_desc_print_error(const Ecore_Getopt_Desc *desc, + const char *fmt, + ...) +{ + va_list ap; + + fputs(_("ERROR: "), stderr); + + if (desc->shortname) + { + fputc('-', stderr); + fputc(desc->shortname, stderr); + } + + if (desc->shortname && desc->longname) + fputs(", ", stderr); + + if (desc->longname) + { + fputs("--", stderr); + fputs(desc->longname, stderr); + } + + fputs(": ", stderr); + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); +} + +static Eina_Bool +_ecore_getopt_parse_bool(const char *str, + Eina_Bool *v) +{ + if ((strcmp(str, "0") == 0) || + (strcasecmp(str, "f") == 0) || + (strcasecmp(str, "false") == 0) || + (strcasecmp(str, "no") == 0) || + (strcasecmp(str, "off") == 0) + ) + { + *v = EINA_FALSE; + return EINA_TRUE; + } + else if ((strcmp(str, "1") == 0) || + (strcasecmp(str, "t") == 0) || + (strcasecmp(str, "true") == 0) || + (strcasecmp(str, "yes") == 0) || + (strcasecmp(str, "on") == 0) + ) + { + *v = EINA_TRUE; + return EINA_TRUE; + } + + return EINA_FALSE; +} + +static Eina_Bool +_ecore_getopt_parse_long(const char *str, + long int *v) +{ + char *endptr = NULL; + *v = strtol(str, &endptr, 0); + return endptr > str; +} + +static Eina_Bool +_ecore_getopt_parse_double(const char *str, + double *v) +{ + char *endptr = NULL; + *v = strtod(str, &endptr); + return endptr > str; +} + +static Eina_Bool +_ecore_getopt_parse_store(const Ecore_Getopt *parser __UNUSED__, + const Ecore_Getopt_Desc *desc, + Ecore_Getopt_Value *value, + const char *arg_val) +{ + const Ecore_Getopt_Desc_Store *store = &desc->action_param.store; + long int v; + double d; + Eina_Bool b; + + if (!value->ptrp) + { + _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n")); + return EINA_FALSE; + } + + switch (store->arg_req) + { + case ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO: + goto use_optional; + + case ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL: + if (!arg_val) + goto use_optional; + + case ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES: + break; + } + + switch (store->type) + { + case ECORE_GETOPT_TYPE_STR: + *value->strp = (char *)arg_val; + return EINA_TRUE; + + case ECORE_GETOPT_TYPE_BOOL: + if (_ecore_getopt_parse_bool(arg_val, &b)) + { + *value->boolp = b; + return EINA_TRUE; + } + else + { + _ecore_getopt_desc_print_error + (desc, _("unknown boolean value %s.\n"), arg_val); + return EINA_FALSE; + } + + case ECORE_GETOPT_TYPE_SHORT: + if (!_ecore_getopt_parse_long(arg_val, &v)) + goto error; + *value->shortp = v; + return EINA_TRUE; + + case ECORE_GETOPT_TYPE_INT: + if (!_ecore_getopt_parse_long(arg_val, &v)) + goto error; + *value->intp = v; + return EINA_TRUE; + + case ECORE_GETOPT_TYPE_LONG: + if (!_ecore_getopt_parse_long(arg_val, &v)) + goto error; + *value->longp = v; + return EINA_TRUE; + + case ECORE_GETOPT_TYPE_USHORT: + if (!_ecore_getopt_parse_long(arg_val, &v)) + goto error; + *value->ushortp = v; + return EINA_TRUE; + + case ECORE_GETOPT_TYPE_UINT: + if (!_ecore_getopt_parse_long(arg_val, &v)) + goto error; + *value->uintp = v; + return EINA_TRUE; + + case ECORE_GETOPT_TYPE_ULONG: + if (!_ecore_getopt_parse_long(arg_val, &v)) + goto error; + *value->ulongp = v; + return EINA_TRUE; + + case ECORE_GETOPT_TYPE_DOUBLE: + if (!_ecore_getopt_parse_double(arg_val, &d)) + goto error; + *value->doublep = d; + break; + } + + return EINA_TRUE; + +error: + _ecore_getopt_desc_print_error + (desc, _("invalid number format %s\n"), arg_val); + return EINA_FALSE; + +use_optional: + switch (store->type) + { + case ECORE_GETOPT_TYPE_STR: + *value->strp = (char *)store->def.strv; + break; + + case ECORE_GETOPT_TYPE_BOOL: + *value->boolp = store->def.boolv; + break; + + case ECORE_GETOPT_TYPE_SHORT: + *value->shortp = store->def.shortv; + break; + + case ECORE_GETOPT_TYPE_INT: + *value->intp = store->def.intv; + break; + + case ECORE_GETOPT_TYPE_LONG: + *value->longp = store->def.longv; + break; + + case ECORE_GETOPT_TYPE_USHORT: + *value->ushortp = store->def.ushortv; + break; + + case ECORE_GETOPT_TYPE_UINT: + *value->uintp = store->def.uintv; + break; + + case ECORE_GETOPT_TYPE_ULONG: + *value->ulongp = store->def.ulongv; + break; + + case ECORE_GETOPT_TYPE_DOUBLE: + *value->doublep = store->def.doublev; + break; + } + + return EINA_TRUE; +} + +static Eina_Bool +_ecore_getopt_parse_store_const(const Ecore_Getopt *parser __UNUSED__, + const Ecore_Getopt_Desc *desc, + Ecore_Getopt_Value *val, + const char *arg_val __UNUSED__) +{ + if (!val->ptrp) + { + _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n")); + return EINA_FALSE; + } + + *val->ptrp = (void *)desc->action_param.store_const; + return EINA_TRUE; +} + +static Eina_Bool +_ecore_getopt_parse_store_true(const Ecore_Getopt *parser __UNUSED__, + const Ecore_Getopt_Desc *desc, + Ecore_Getopt_Value *val, + const char *arg_val __UNUSED__) +{ + if (!val->boolp) + { + _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n")); + return EINA_FALSE; + } + *val->boolp = EINA_TRUE; + return EINA_TRUE; +} + +static Eina_Bool +_ecore_getopt_parse_store_false(const Ecore_Getopt *parser __UNUSED__, + const Ecore_Getopt_Desc *desc, + Ecore_Getopt_Value *val, + const char *arg_val __UNUSED__) +{ + if (!val->boolp) + { + _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n")); + return EINA_FALSE; + } + *val->boolp = EINA_FALSE; + return EINA_TRUE; +} + +static Eina_Bool +_ecore_getopt_parse_choice(const Ecore_Getopt *parser __UNUSED__, + const Ecore_Getopt_Desc *desc, + Ecore_Getopt_Value *val, + const char *arg_val) +{ + const char *const *pchoice; + + if (!val->strp) + { + _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n")); + return EINA_FALSE; + } + + pchoice = desc->action_param.choices; + for (; *pchoice; pchoice++) + if (strcmp(*pchoice, arg_val) == 0) + { + *val->strp = (char *)*pchoice; + return EINA_TRUE; + } + + _ecore_getopt_desc_print_error + (desc, _("invalid choice \"%s\". Valid values are: "), arg_val); + + pchoice = desc->action_param.choices; + for (; *pchoice; pchoice++) + { + fputs(*pchoice, stderr); + if (pchoice[1]) + fputs(", ", stderr); + } + + fputs(".\n", stderr); + return EINA_FALSE; +} + +static Eina_Bool +_ecore_getopt_parse_append(const Ecore_Getopt *parser __UNUSED__, + const Ecore_Getopt_Desc *desc, + Ecore_Getopt_Value *val, + const char *arg_val) +{ + void *data; + long int v; + double d; + Eina_Bool b; + + if (!arg_val) + { + _ecore_getopt_desc_print_error + (desc, _("missing parameter to append.\n")); + return EINA_FALSE; + } + + if (!val->listp) + { + _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n")); + return EINA_FALSE; + } + + switch (desc->action_param.append_type) + { + case ECORE_GETOPT_TYPE_STR: + data = strdup(arg_val); + break; + + case ECORE_GETOPT_TYPE_BOOL: + { + if (_ecore_getopt_parse_bool(arg_val, &b)) + { + data = malloc(sizeof(Eina_Bool)); + if (data) + *(Eina_Bool *)data = b; + } + else + { + _ecore_getopt_desc_print_error(desc, _("unknown boolean value %s.\n"), arg_val); + return EINA_FALSE; + } + } + break; + + case ECORE_GETOPT_TYPE_SHORT: + { + if (!_ecore_getopt_parse_long(arg_val, &v)) + goto error; + data = malloc(sizeof(short)); + if (data) + *(short *)data = (short)v; + } + break; + + case ECORE_GETOPT_TYPE_INT: + { + if (!_ecore_getopt_parse_long(arg_val, &v)) + goto error; + data = malloc(sizeof(int)); + if (data) + *(int *)data = (int)v; + } + break; + + case ECORE_GETOPT_TYPE_LONG: + { + if (!_ecore_getopt_parse_long(arg_val, &v)) + goto error; + data = malloc(sizeof(long)); + if (data) + *(long *)data = v; + } + break; + + case ECORE_GETOPT_TYPE_USHORT: + { + if (!_ecore_getopt_parse_long(arg_val, &v)) + goto error; + data = malloc(sizeof(unsigned short)); + if (data) + *(unsigned short *)data = (unsigned short)v; + } + break; + + case ECORE_GETOPT_TYPE_UINT: + { + if (!_ecore_getopt_parse_long(arg_val, &v)) + goto error; + data = malloc(sizeof(unsigned int)); + if (data) + *(unsigned int *)data = (unsigned int)v; + } + break; + + case ECORE_GETOPT_TYPE_ULONG: + { + if (!_ecore_getopt_parse_long(arg_val, &v)) + goto error; + data = malloc(sizeof(unsigned long)); + if (data) + *(unsigned long *)data = v; + } + break; + + case ECORE_GETOPT_TYPE_DOUBLE: + { + if (!_ecore_getopt_parse_double(arg_val, &d)) + goto error; + data = malloc(sizeof(double)); + if (data) + *(double *)data = d; + } + break; + + default: + { + _ecore_getopt_desc_print_error(desc, _("could not parse value.\n")); + return EINA_FALSE; + } + } + + *val->listp = eina_list_append(*val->listp, data); + return EINA_TRUE; + +error: + _ecore_getopt_desc_print_error + (desc, _("invalid number format %s\n"), arg_val); + return EINA_FALSE; +} + +static Eina_Bool +_ecore_getopt_parse_count(const Ecore_Getopt *parser __UNUSED__, + const Ecore_Getopt_Desc *desc, + Ecore_Getopt_Value *val, + const char *arg_val __UNUSED__) +{ + if (!val->intp) + { + _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n")); + return EINA_FALSE; + } + + (*val->intp)++; + return EINA_TRUE; +} + +static Eina_Bool +_ecore_getopt_parse_callback(const Ecore_Getopt *parser, + const Ecore_Getopt_Desc *desc, + Ecore_Getopt_Value *val, + const char *arg_val) +{ + const Ecore_Getopt_Desc_Callback *cb = &desc->action_param.callback; + + switch (cb->arg_req) + { + case ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO: + arg_val = cb->def; + break; + + case ECORE_GETOPT_DESC_ARG_REQUIREMENT_OPTIONAL: + if (!arg_val) + arg_val = cb->def; + break; + + case ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES: + break; + } + + if (cb->arg_req != ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO) + { + if ((!arg_val) || (arg_val[0] == '\0')) + { + _ecore_getopt_desc_print_error(desc, _("missing parameter.\n")); + return EINA_FALSE; + } + + if (!val->ptrp) + { + _ecore_getopt_desc_print_error(desc, _("value has no pointer set.\n")); + return EINA_FALSE; + } + } + + if (!cb->func) + { + _ecore_getopt_desc_print_error(desc, _("missing callback function!\n")); + return EINA_FALSE; + } + + return cb->func(parser, desc, arg_val, (void *)cb->data, val); +} + +static Eina_Bool +_ecore_getopt_parse_help(const Ecore_Getopt *parser, + const Ecore_Getopt_Desc *desc __UNUSED__, + Ecore_Getopt_Value *val, + const char *arg_val __UNUSED__) +{ + if (val->boolp) + (*val->boolp) = EINA_TRUE; + ecore_getopt_help(stdout, parser); + return EINA_TRUE; +} + +static Eina_Bool +_ecore_getopt_parse_version(const Ecore_Getopt *parser, + const Ecore_Getopt_Desc *desc, + Ecore_Getopt_Value *val, + const char *arg_val __UNUSED__) +{ + if (val->boolp) + (*val->boolp) = EINA_TRUE; + if (!parser->version) + { + _ecore_getopt_desc_print_error(desc, _("no version was defined.\n")); + return EINA_FALSE; + } + _ecore_getopt_version(stdout, parser); + return EINA_TRUE; +} + +static Eina_Bool +_ecore_getopt_parse_copyright(const Ecore_Getopt *parser, + const Ecore_Getopt_Desc *desc, + Ecore_Getopt_Value *val, + const char *arg_val __UNUSED__) +{ + if (val->boolp) + (*val->boolp) = EINA_TRUE; + if (!parser->copyright) + { + _ecore_getopt_desc_print_error(desc, _("no copyright was defined.\n")); + return EINA_FALSE; + } + _ecore_getopt_copyright(stdout, parser); + return EINA_TRUE; +} + +static Eina_Bool +_ecore_getopt_parse_license(const Ecore_Getopt *parser, + const Ecore_Getopt_Desc *desc, + Ecore_Getopt_Value *val, + const char *arg_val __UNUSED__) +{ + if (val->boolp) + (*val->boolp) = EINA_TRUE; + if (!parser->license) + { + _ecore_getopt_desc_print_error(desc, _("no license was defined.\n")); + return EINA_FALSE; + } + _ecore_getopt_license(stdout, parser); + return EINA_TRUE; +} + +static Eina_Bool +_ecore_getopt_desc_handle(const Ecore_Getopt *parser, + const Ecore_Getopt_Desc *desc, + Ecore_Getopt_Value *value, + const char *arg_val) +{ + switch (desc->action) + { + case ECORE_GETOPT_ACTION_STORE: + return _ecore_getopt_parse_store(parser, desc, value, arg_val); + + case ECORE_GETOPT_ACTION_STORE_CONST: + return _ecore_getopt_parse_store_const(parser, desc, value, arg_val); + + case ECORE_GETOPT_ACTION_STORE_TRUE: + return _ecore_getopt_parse_store_true(parser, desc, value, arg_val); + + case ECORE_GETOPT_ACTION_STORE_FALSE: + return _ecore_getopt_parse_store_false(parser, desc, value, arg_val); + + case ECORE_GETOPT_ACTION_CHOICE: + return _ecore_getopt_parse_choice(parser, desc, value, arg_val); + + case ECORE_GETOPT_ACTION_APPEND: + return _ecore_getopt_parse_append(parser, desc, value, arg_val); + + case ECORE_GETOPT_ACTION_COUNT: + return _ecore_getopt_parse_count(parser, desc, value, arg_val); + + case ECORE_GETOPT_ACTION_CALLBACK: + return _ecore_getopt_parse_callback(parser, desc, value, arg_val); + + case ECORE_GETOPT_ACTION_HELP: + return _ecore_getopt_parse_help(parser, desc, value, arg_val); + + case ECORE_GETOPT_ACTION_VERSION: + return _ecore_getopt_parse_version(parser, desc, value, arg_val); + + case ECORE_GETOPT_ACTION_COPYRIGHT: + return _ecore_getopt_parse_copyright(parser, desc, value, arg_val); + + case ECORE_GETOPT_ACTION_LICENSE: + return _ecore_getopt_parse_license(parser, desc, value, arg_val); + + default: + return EINA_FALSE; + } +} + +static Eina_Bool +_ecore_getopt_parse_arg_long(const Ecore_Getopt *parser, + Ecore_Getopt_Value *values, + int argc __UNUSED__, + char **argv, + int *idx, + int *nonargs, + const char *arg) +{ + const Ecore_Getopt_Desc *desc; + Ecore_Getopt_Desc_Arg_Requirement arg_req; + const char *arg_val; + int desc_idx; + Ecore_Getopt_Value *value; + Eina_Bool ret; + + desc = _ecore_getopt_parse_find_long(parser, arg); + if (!desc) + { + fprintf(stderr, _("ERROR: unknown option --%s, ignored.\n"), arg); + if (parser->strict) + return EINA_FALSE; + + (*idx)++; + return EINA_TRUE; + } + + (*idx)++; + + arg_req = _ecore_getopt_desc_arg_requirement(desc); + if (arg_req != ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO) + { + arg_val = strchr(arg, '='); + if (arg_val) + arg_val++; + else + { + if ((*idx < *nonargs) && (argv[*idx][0] != '-')) + { + arg_val = argv[*idx]; + (*idx)++; + } + else + arg_val = NULL; + } + + if (arg_val && arg_val[0] == '\0') + arg_val = NULL; + + if ((!arg_val) && (arg_req == ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES)) + { + fprintf + (stderr, _("ERROR: option --%s requires an argument!\n"), arg); + if (parser->strict) + return EINA_FALSE; + return EINA_TRUE; + } + } + else + arg_val = NULL; + + desc_idx = desc - parser->descs; + value = values + desc_idx; + ret = _ecore_getopt_desc_handle(parser, desc, value, arg_val); + if ((!ret) && parser->strict) + return EINA_FALSE; + + return EINA_TRUE; +} + +static Eina_Bool +_ecore_getopt_parse_arg_short(const Ecore_Getopt *parser, + Ecore_Getopt_Value *values, + int argc __UNUSED__, + char **argv, + int *idx, + int *nonargs, + const char *arg) +{ + int run = 1; + while (run && (arg[0] != '\0')) + { + int opt = arg[0]; + const Ecore_Getopt_Desc *desc; + Ecore_Getopt_Desc_Arg_Requirement arg_req; + const char *arg_val; + int desc_idx; + Ecore_Getopt_Value *value; + Eina_Bool ret; + + desc = _ecore_getopt_parse_find_short(parser, arg[0]); + if (!desc) + { + fprintf + (stderr, _("ERROR: unknown option -%c, ignored.\n"), arg[0]); + if (parser->strict) + return EINA_FALSE; + + arg++; + continue; + } + + arg++; + + arg_req = _ecore_getopt_desc_arg_requirement(desc); + if (arg_req != ECORE_GETOPT_DESC_ARG_REQUIREMENT_NO) + { + (*idx)++; + run = 0; + + if (arg[0] == '=') + arg_val = arg + 1; + else if (arg[0] != '\0') + arg_val = arg; + else + { + if ((*idx < *nonargs) && (argv[*idx][0] != '-')) + { + arg_val = argv[*idx]; + (*idx)++; + } + else + arg_val = NULL; + } + + if (arg_val && arg_val[0] == '\0') + arg_val = NULL; + + if ((!arg_val) && + (arg_req == ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES)) + { + fprintf + (stderr, _("ERROR: option -%c requires an argument!\n"), + opt); + if (parser->strict) + return EINA_FALSE; + return EINA_TRUE; + } + } + else + arg_val = NULL; + + desc_idx = desc - parser->descs; + value = values + desc_idx; + ret = _ecore_getopt_desc_handle(parser, desc, value, arg_val); + if ((!ret) && parser->strict) + return EINA_FALSE; + } + + if (run) + (*idx)++; + + return EINA_TRUE; +} + +static Eina_Bool +_ecore_getopt_parse_arg(const Ecore_Getopt *parser, + Ecore_Getopt_Value *values, + int argc, + char **argv, + int *idx, + int *nonargs) +{ + char *arg = argv[*idx]; + + if (arg[0] != '-') + { + char **dst, **src, **src_end; + + dst = argv + *idx; + src = dst + 1; + src_end = src + *nonargs - *idx - 1; + + for (; src < src_end; src++, dst++) + *dst = *src; + + *dst = arg; + (*nonargs)--; + return EINA_TRUE; + } + + if (arg[1] == '-') + return _ecore_getopt_parse_arg_long(parser, values, argc, argv, idx, nonargs, arg + 2); + else + return _ecore_getopt_parse_arg_short(parser, values, argc, argv, idx, nonargs, arg + 1); +} + +static const Ecore_Getopt_Desc * +_ecore_getopt_parse_find_short_other(const Ecore_Getopt *parser, + const Ecore_Getopt_Desc *orig) +{ + const Ecore_Getopt_Desc *desc = parser->descs; + const char c = orig->shortname; + + for (; !_ecore_getopt_desc_is_sentinel(desc); desc++) + { + if (desc == orig) + return NULL; + + if (c == desc->shortname) + return desc; + } + + return NULL; +} + +static const Ecore_Getopt_Desc * +_ecore_getopt_parse_find_long_other(const Ecore_Getopt *parser, + const Ecore_Getopt_Desc *orig) +{ + const Ecore_Getopt_Desc *desc = parser->descs; + const char *name = orig->longname; + + for (; !_ecore_getopt_desc_is_sentinel(desc); desc++) + { + if (desc == orig) + return NULL; + + if (desc->longname && (strcmp(name, desc->longname) == 0)) + return desc; + } + + return NULL; +} + +/** + * Check parser for duplicate entries, print them out. + * + * @return EINA_TRUE if there are duplicates, EINA_FALSE otherwise. + */ +Eina_Bool +ecore_getopt_parser_has_duplicates(const Ecore_Getopt *parser) +{ + const Ecore_Getopt_Desc *desc = parser->descs; + for (; !_ecore_getopt_desc_is_sentinel(desc); desc++) + { + if (desc->shortname) + { + const Ecore_Getopt_Desc *other; + other = _ecore_getopt_parse_find_short_other(parser, desc); + if (other) + { + _ecore_getopt_desc_print_error(desc, "short name -%c already exists.", desc->shortname); + + if (other->longname) + fprintf(stderr, " Other is --%s.\n", other->longname); + else + fputc('\n', stderr); + return EINA_TRUE; + } + } + + if (desc->longname) + { + const Ecore_Getopt_Desc *other; + other = _ecore_getopt_parse_find_long_other(parser, desc); + if (other) + { + _ecore_getopt_desc_print_error(desc, "long name --%s already exists.", desc->longname); + + if (other->shortname) + fprintf(stderr, " Other is -%c.\n", other->shortname); + else + fputc('\n', stderr); + return EINA_TRUE; + } + } + } + return EINA_FALSE; +} + +static const Ecore_Getopt_Desc * +_ecore_getopt_find_help(const Ecore_Getopt *parser) +{ + const Ecore_Getopt_Desc *desc = parser->descs; + for (; !_ecore_getopt_desc_is_sentinel(desc); desc++) + if (desc->action == ECORE_GETOPT_ACTION_HELP) + return desc; + return NULL; +} + +/** + * Parse command line parameters. + * + * Walks the command line parameters and parse them based on @a parser + * description, doing actions based on @c parser->descs->action, like + * showing help text, license, copyright, storing values in values and + * so on. + * + * It is expected that values is of the same size than @c parser->descs, + * options that do not need a value it will be left untouched. + * + * All values are expected to be initialized before use. Options with + * action @c ECORE_GETOPT_ACTION_STORE and non required arguments + * (others than @c ECORE_GETOPT_DESC_ARG_REQUIREMENT_YES), are expected + * to provide a value in @c def to be used. + * + * The following actions will store 1 on value as a boolean + * (@c value->boolp) if it's not NULL to indicate these actions were executed: + * - @c ECORE_GETOPT_ACTION_HELP + * - @c ECORE_GETOPT_ACTION_VERSION + * - @c ECORE_GETOPT_ACTION_COPYRIGHT + * - @c ECORE_GETOPT_ACTION_LICENSE + * + * Just @c ECORE_GETOPT_ACTION_APPEND will allocate memory and thus + * need to be freed. For consistency between all of appended subtypes, + * @c eina_list->data will contain an allocated memory with the value, + * that is, for @c ECORE_GETOPT_TYPE_STR it will contain a copy of the + * argument, @c ECORE_GETOPT_TYPE_INT a pointer to an allocated + * integer and so on. + * + * If parser is in strict mode (see @c Ecore_Getopt->strict), then any + * error will abort parsing and -1 is returned. Otherwise it will try + * to continue as far as possible. + * + * This function may reorder @a argv elements. + * + * Translation of help strings (description), metavar, usage, license + * and copyright may be translated, standard/global gettext() call + * will be applied on them if ecore was compiled with such support. + * + * @param parser description of how to work. + * @param value where to store values, it is assumed that this is a vector + * of the same size as @c parser->descs. Values should be previously + * initialized. + * @param argc how many elements in @a argv. If not provided it will be + * retrieved with ecore_app_args_get(). + * @param argv command line parameters. + * + * @return index of first non-option parameter or -1 on error. + */ +int +ecore_getopt_parse(const Ecore_Getopt *parser, + Ecore_Getopt_Value *values, + int argc, + char **argv) +{ + int i, nonargs; + + if (!parser) + { + fputs(_("ERROR: no parser provided.\n"), stderr); + return -1; + } + if (!values) + { + fputs(_("ERROR: no values provided.\n"), stderr); + return -1; + } + + if ((argc < 1) || (!argv)) + ecore_app_args_get(&argc, &argv); + + if (argc < 1) + { + fputs(_("ERROR: no arguments provided.\n"), stderr); + return -1; + } + + if (argv[0]) + prog = argv[0]; + else + prog = parser->prog; + + nonargs = _ecore_getopt_parse_find_nonargs_base(parser, argc, argv); + if (nonargs < 0) + goto error; + + if (nonargs > argc) + nonargs = argc; + + i = 1; + while (i < nonargs) + if (!_ecore_getopt_parse_arg(parser, values, argc, argv, &i, &nonargs)) + goto error; + + return nonargs; + +error: + { + const Ecore_Getopt_Desc *help; + fputs(_("ERROR: invalid options found."), stderr); + + help = _ecore_getopt_find_help(parser); + if (!help) + fputc('\n', stderr); + else if (help->longname) + fprintf(stderr, _(" See --%s.\n"), help->longname); + else + fprintf(stderr, _(" See -%c.\n"), help->shortname); + } + + return -1; +} + +/** + * Utility to free list and nodes allocated by @a ECORE_GETOPT_ACTION_APPEND. + * + * @param list pointer to list to be freed. + * @return always NULL, so you can easily make your list head NULL. + */ +Eina_List * +ecore_getopt_list_free(Eina_List *list) +{ + void *data; + + EINA_LIST_FREE(list, data) + free(data); + return NULL; +} + +/** + * Helper ecore_getopt callback to parse geometry (x:y:w:h). + * + * Storage must be a pointer to @c Eina_Rectangle and will be used to + * store the four values passed in the given string. + * + * @c callback_data value is ignored, you can safely use @c NULL. + */ +Eina_Bool +ecore_getopt_callback_geometry_parse(const Ecore_Getopt *parser __UNUSED__, + const Ecore_Getopt_Desc *desc __UNUSED__, + const char *str, + void *data __UNUSED__, + Ecore_Getopt_Value *storage) +{ + Eina_Rectangle *v = (Eina_Rectangle *)storage->ptrp; + + if (sscanf(str, "%d:%d:%d:%d", &v->x, &v->y, &v->w, &v->h) != 4) + { + fprintf(stderr, _("ERROR: incorrect geometry value '%s'\n"), str); + return EINA_FALSE; + } + + return EINA_TRUE; +} + +/** + * Helper ecore_getopt callback to parse geometry size (WxH). + * + * Storage must be a pointer to @c Eina_Rectangle and will be used to + * store the two values passed in the given string and 0 in the x and y + * fields. + * + * @c callback_data value is ignored, you can safely use @c NULL. + */ +Eina_Bool +ecore_getopt_callback_size_parse(const Ecore_Getopt *parser __UNUSED__, + const Ecore_Getopt_Desc *desc __UNUSED__, + const char *str, + void *data __UNUSED__, + Ecore_Getopt_Value *storage) +{ + Eina_Rectangle *v = (Eina_Rectangle *)storage->ptrp; + + if (sscanf(str, "%dx%d", &v->w, &v->h) != 2) + { + fprintf(stderr, _("ERROR: incorrect size value '%s'\n"), str); + return EINA_FALSE; + } + v->x = 0; + v->y = 0; + + return EINA_TRUE; +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_glib.c b/libraries/ecore/src/lib/ecore/ecore_glib.c new file mode 100644 index 0000000..6ddcd36 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_glib.c @@ -0,0 +1,338 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "Ecore.h" +#include "ecore_private.h" + +#ifdef HAVE_GLIB +#include + +static Eina_Bool _ecore_glib_active = EINA_FALSE; +static Ecore_Select_Function _ecore_glib_select_original; +static GCond *_ecore_glib_cond = NULL; +static GPollFD *_ecore_glib_fds = NULL; +static size_t _ecore_glib_fds_size = 0; +static const size_t ECORE_GLIB_FDS_INITIAL = 128; +static const size_t ECORE_GLIB_FDS_STEP = 8; +static const size_t ECORE_GLIB_FDS_MAX_FREE = 256; + +static Eina_Bool +_ecore_glib_fds_resize(size_t size) +{ + void *tmp = realloc(_ecore_glib_fds, sizeof(GPollFD) * size); + + if (!tmp) + { + ERR("Could not realloc from %zu to %zu buckets.", + _ecore_glib_fds_size, size); + return EINA_FALSE; + } + + _ecore_glib_fds = tmp; + _ecore_glib_fds_size = size; + return EINA_TRUE; +} + +static int +_ecore_glib_context_query(GMainContext *ctx, + int priority, + int *p_timer) +{ + int reqfds; + + if (_ecore_glib_fds_size == 0) + { + if (!_ecore_glib_fds_resize(ECORE_GLIB_FDS_INITIAL)) return -1; + } + + while (1) + { + size_t size; + + reqfds = g_main_context_query + (ctx, priority, p_timer, _ecore_glib_fds, _ecore_glib_fds_size); + if (reqfds <= (int)_ecore_glib_fds_size) break; + + size = (1 + reqfds / ECORE_GLIB_FDS_STEP) * ECORE_GLIB_FDS_STEP; + if (!_ecore_glib_fds_resize(size)) return -1; + } + + if (reqfds + ECORE_GLIB_FDS_MAX_FREE < _ecore_glib_fds_size) + { + size_t size; + + size = (1 + reqfds / ECORE_GLIB_FDS_MAX_FREE) * ECORE_GLIB_FDS_MAX_FREE; + _ecore_glib_fds_resize(size); + } + + return reqfds; +} + +static int +_ecore_glib_context_poll_from(const GPollFD *pfds, + int count, + fd_set *rfds, + fd_set *wfds, + fd_set *efds) +{ + const GPollFD *itr = pfds, *itr_end = pfds + count; + int glib_fds = -1; + + for (; itr < itr_end; itr++) + { + if (glib_fds < itr->fd) + glib_fds = itr->fd; + + if (itr->events & G_IO_IN) + FD_SET(itr->fd, rfds); + if (itr->events & G_IO_OUT) + FD_SET(itr->fd, wfds); + if (itr->events & (G_IO_HUP | G_IO_ERR)) + FD_SET(itr->fd, efds); + } + + return glib_fds + 1; +} + +static int +_ecore_glib_context_poll_to(GPollFD *pfds, + int count, + const fd_set *rfds, + const fd_set *wfds, + const fd_set *efds, + int ready) +{ + GPollFD *itr = pfds, *itr_end = pfds + count; + + for (; itr < itr_end && ready > 0; itr++) + { + itr->revents = 0; + if (FD_ISSET(itr->fd, rfds)) + { + itr->revents |= G_IO_IN; + ready--; + } + if (FD_ISSET(itr->fd, wfds)) + { + itr->revents |= G_IO_OUT; + ready--; + } + if (FD_ISSET(itr->fd, efds)) + { + itr->revents |= G_IO_ERR; + ready--; + } + } + return ready; +} + +static int +_ecore_glib_select__locked(GMainContext *ctx, + int ecore_fds, + fd_set *rfds, + fd_set *wfds, + fd_set *efds, + struct timeval *ecore_timeout) +{ + int priority, maxfds, glib_fds, reqfds, reqtimeout, ret; + struct timeval *timeout, glib_timeout; + + g_main_context_prepare(ctx, &priority); + reqfds = _ecore_glib_context_query(ctx, priority, &reqtimeout); + if (reqfds < 0) goto error; + + glib_fds = _ecore_glib_context_poll_from + (_ecore_glib_fds, reqfds, rfds, wfds, efds); + + if (reqtimeout == -1) + timeout = ecore_timeout; + else + { + glib_timeout.tv_sec = reqtimeout / 1000; + glib_timeout.tv_usec = (reqtimeout % 1000) * 1000; + + if (!ecore_timeout || timercmp(ecore_timeout, &glib_timeout, >)) + timeout = &glib_timeout; + else + timeout = ecore_timeout; + } + + maxfds = (ecore_fds >= glib_fds) ? ecore_fds : glib_fds; + ret = _ecore_glib_select_original(maxfds, rfds, wfds, efds, timeout); + + ret = _ecore_glib_context_poll_to + (_ecore_glib_fds, reqfds, rfds, wfds, efds, ret); + + if (g_main_context_check(ctx, priority, _ecore_glib_fds, reqfds)) + g_main_context_dispatch(ctx); + + return ret; + +error: + return _ecore_glib_select_original + (ecore_fds, rfds, wfds, efds, ecore_timeout); +} + +static int +_ecore_glib_select(int ecore_fds, + fd_set *rfds, + fd_set *wfds, + fd_set *efds, + struct timeval *ecore_timeout) +{ + GStaticMutex lock = G_STATIC_MUTEX_INIT; + GMutex *mutex = g_static_mutex_get_mutex(&lock); + GMainContext *ctx = g_main_context_default(); + int ret; + + if (g_main_context_acquire(ctx)) + g_mutex_lock(mutex); + else + { + if (!_ecore_glib_cond) + _ecore_glib_cond = g_cond_new(); + + while (!g_main_context_wait(ctx, _ecore_glib_cond, mutex)) + g_thread_yield(); + } + + ret = _ecore_glib_select__locked + (ctx, ecore_fds, rfds, wfds, efds, ecore_timeout); + + g_mutex_unlock(mutex); + g_main_context_release(ctx); + + return ret; +} + +#endif + +void +_ecore_glib_init(void) +{ +} + +void +_ecore_glib_shutdown(void) +{ +#ifdef HAVE_GLIB + if (!_ecore_glib_active) return; + _ecore_glib_active = EINA_FALSE; + + if (ecore_main_loop_select_func_get() == _ecore_glib_select) + ecore_main_loop_select_func_set(_ecore_glib_select_original); + + if (_ecore_glib_fds) + { + free(_ecore_glib_fds); + _ecore_glib_fds = NULL; + } + _ecore_glib_fds_size = 0; + + if (_ecore_glib_cond) + { + g_cond_free(_ecore_glib_cond); + _ecore_glib_cond = NULL; + } +#endif +} + +/** + * @addtogroup Ecore_Main_Loop_Group + * + * @} + */ + +/** + * Request ecore to integrate GLib's main loop. + * + * This will add a small overhead during every main loop interaction + * by checking glib's default main context (used by its main loop). If + * it have events to be checked (timers, file descriptors or idlers), + * then these will be polled alongside with Ecore's own events, then + * dispatched before Ecore's. This is done by calling + * ecore_main_loop_select_func_set(). + * + * This will cooperate with previously set + * ecore_main_loop_select_func_set() by calling the old + * function. Similarly, if you want to override + * ecore_main_loop_select_func_set() after main loop is integrated, + * call the new select function set by this call (get it by calling + * ecore_main_loop_select_func_get() right after + * ecore_main_loop_glib_integrate()). + * + * This is useful to use GMainLoop libraries, like GTK, GUPnP, + * LibSoup, GConf and more. Adobe Flash plugin and other plugins + * systems depend on this as well. + * + * Once initialized/integrated, it will be valid until Ecore is + * completely shut down. + * + * Example of use: + * @code + * + * int main(void) + * { + * ecore_init(); + * ecore_main_loop_glib_integrate(); + * + * // some code here + * + * ecore_main_loop_begin(); + * + * ecore_shutdown(); + * + * return 0; + * } + * + * @endcode + * + * @note This is only available if Ecore was compiled with GLib support. + * @note You don't need to call this function if Ecore was compiled with + * --enable-glib-integration-always. + * + * @return @c EINA_TRUE on success of @c EINA_FALSE if it failed, + * likely no GLib support in Ecore. + */ +EAPI Eina_Bool +ecore_main_loop_glib_integrate(void) +{ +#ifdef HAVE_GLIB + void *func; + + if (_ecore_glib_active) return EINA_TRUE; + func = ecore_main_loop_select_func_get(); + if (func == _ecore_glib_select) return EINA_TRUE; + _ecore_glib_select_original = func; + ecore_main_loop_select_func_set(_ecore_glib_select); + _ecore_glib_active = EINA_TRUE; + return EINA_TRUE; +#else + fputs("ERROR: no glib support in ecore.\n", stderr); + return EINA_FALSE; +#endif +} + +Eina_Bool _ecore_glib_always_integrate = 1; + +/** + * Disable always integrating glib + * + * If ecore is compiled with --enable-glib-integration-always (to always + * call ecore_main_loop_glib_integrate() when ecore_init() is called), then + * calling this before calling ecore_init() will disable the integration. + * This is for apps that explicitly do not want this to happen for whatever + * reasons they may have. + */ +EAPI void +ecore_main_loop_glib_always_integrate_disable(void) +{ + _ecore_glib_always_integrate = 0; +} + +/** + * @} + */ diff --git a/libraries/ecore/src/lib/ecore/ecore_idle_enterer.c b/libraries/ecore/src/lib/ecore/ecore_idle_enterer.c new file mode 100644 index 0000000..03cd1c4 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_idle_enterer.c @@ -0,0 +1,207 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "Ecore.h" +#include "ecore_private.h" + +struct _Ecore_Idle_Enterer +{ + EINA_INLIST; + ECORE_MAGIC; + Ecore_Task_Cb func; + void *data; + int references; + Eina_Bool delete_me : 1; +}; + +static Ecore_Idle_Enterer *idle_enterers = NULL; +static Ecore_Idle_Enterer *idle_enterer_current = NULL; +static int idle_enterers_delete_me = 0; + +static void * +_ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer); + +/** + * @addtogroup Ecore_Idle_Group + * + * @{ + */ + +/** + * Add an idle enterer handler. + * @param func The function to call when entering an idle state. + * @param data The data to be passed to the @p func call + * @return A handle to the idle enterer callback if successful. Otherwise, + * NULL is returned. + * @note The function func will be called every time the main loop is entering + * idle state, as long as it returns 1 (or ECORE_CALLBACK_RENEW). A return of 0 + * (or ECORE_CALLBACK_CANCEL) deletes the idle enterer. + */ +EAPI Ecore_Idle_Enterer * +ecore_idle_enterer_add(Ecore_Task_Cb func, + const void *data) +{ + Ecore_Idle_Enterer *ie = NULL; + + _ecore_lock(); + + if (!func) goto unlock; + ie = calloc(1, sizeof(Ecore_Idle_Enterer)); + if (!ie) goto unlock; + ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER); + ie->func = func; + ie->data = (void *)data; + idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_append(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie)); +unlock: + _ecore_unlock(); + return ie; +} + +/** + * Add an idle enterer handler at the start of the list so it gets called earlier than others. + * @param func The function to call when entering an idle state. + * @param data The data to be passed to the @p func call + * @return A handle to the idle enterer callback if successful. Otherwise, + * NULL is returned. + * @note The function func will be called every time the main loop is entering + * idle state, as long as it returns 1 (or ECORE_CALLBACK_RENEW). A return of 0 + * (or ECORE_CALLBACK_CANCEL) deletes the idle enterer. + */ +EAPI Ecore_Idle_Enterer * +ecore_idle_enterer_before_add(Ecore_Task_Cb func, + const void *data) +{ + Ecore_Idle_Enterer *ie = NULL; + + _ecore_lock(); + + if (!func) goto unlock; + ie = calloc(1, sizeof(Ecore_Idle_Enterer)); + if (!ie) goto unlock; + ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_ENTERER); + ie->func = func; + ie->data = (void *)data; + idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_prepend(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie)); +unlock: + _ecore_unlock(); + return ie; +} + +/** + * Delete an idle enterer callback. + * @param idle_enterer The idle enterer to delete + * @return The data pointer passed to the idler enterer callback on success. + * NULL otherwise. + */ +EAPI void * +ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer) +{ + void *data; + + if (!ECORE_MAGIC_CHECK(idle_enterer, ECORE_MAGIC_IDLE_ENTERER)) + { + ECORE_MAGIC_FAIL(idle_enterer, ECORE_MAGIC_IDLE_ENTERER, + "ecore_idle_enterer_del"); + return NULL; + } + _ecore_lock(); + data = _ecore_idle_enterer_del(idle_enterer); + _ecore_unlock(); + return data; +} + +/** + * @} + */ + +static void * +_ecore_idle_enterer_del(Ecore_Idle_Enterer *idle_enterer) +{ + EINA_SAFETY_ON_TRUE_RETURN_VAL(idle_enterer->delete_me, NULL); + idle_enterer->delete_me = 1; + idle_enterers_delete_me = 1; + return idle_enterer->data; +} + +void +_ecore_idle_enterer_shutdown(void) +{ + Ecore_Idle_Enterer *ie; + while ((ie = idle_enterers)) + { + idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(idle_enterers)); + ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE); + free(ie); + } + idle_enterers_delete_me = 0; + idle_enterer_current = NULL; +} + +void +_ecore_idle_enterer_call(void) +{ + if (!idle_enterer_current) + { + /* regular main loop, start from head */ + idle_enterer_current = idle_enterers; + } + else + { + /* recursive main loop, continue from where we were */ + idle_enterer_current = + (Ecore_Idle_Enterer *)EINA_INLIST_GET(idle_enterer_current)->next; + } + + while (idle_enterer_current) + { + Ecore_Idle_Enterer *ie = (Ecore_Idle_Enterer *)idle_enterer_current; + if (!ie->delete_me) + { + ie->references++; + if (!_ecore_call_task_cb(ie->func, ie->data)) + { + if (!ie->delete_me) _ecore_idle_enterer_del(ie); + } + ie->references--; + } + if (idle_enterer_current) /* may have changed in recursive main loops */ + idle_enterer_current = + (Ecore_Idle_Enterer *)EINA_INLIST_GET(idle_enterer_current)->next; + } + if (idle_enterers_delete_me) + { + Ecore_Idle_Enterer *l; + int deleted_idler_enterers_in_use = 0; + + for (l = idle_enterers; l; ) + { + Ecore_Idle_Enterer *ie = l; + l = (Ecore_Idle_Enterer *)EINA_INLIST_GET(l)->next; + if (ie->delete_me) + { + if (ie->references) + { + deleted_idler_enterers_in_use++; + continue; + } + + idle_enterers = (Ecore_Idle_Enterer *)eina_inlist_remove(EINA_INLIST_GET(idle_enterers), EINA_INLIST_GET(ie)); + ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE); + free(ie); + } + } + if (!deleted_idler_enterers_in_use) + idle_enterers_delete_me = 0; + } +} + +int +_ecore_idle_enterer_exist(void) +{ + if (idle_enterers) return 1; + return 0; +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_idle_exiter.c b/libraries/ecore/src/lib/ecore/ecore_idle_exiter.c new file mode 100644 index 0000000..70c6a7a --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_idle_exiter.c @@ -0,0 +1,176 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "Ecore.h" +#include "ecore_private.h" + +struct _Ecore_Idle_Exiter +{ + EINA_INLIST; + ECORE_MAGIC; + Ecore_Task_Cb func; + void *data; + int references; + Eina_Bool delete_me : 1; +}; + +static Ecore_Idle_Exiter *idle_exiters = NULL; +static Ecore_Idle_Exiter *idle_exiter_current = NULL; +static int idle_exiters_delete_me = 0; + +static void * +_ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter); + +/** + * @addtogroup Ecore_Idle_Group + * + * @{ + */ + +/** + * Add an idle exiter handler. + * @param func The function to call when exiting an idle state. + * @param data The data to be passed to the @p func call + * @return A handle to the idle exiter callback on success. NULL otherwise. + * @note The function func will be called every time the main loop is exiting + * idle state, as long as it returns 1 (or ECORE_CALLBACK_RENEW). A return of 0 + * (or ECORE_CALLBACK_CANCEL) deletes the idle exiter. + */ +EAPI Ecore_Idle_Exiter * +ecore_idle_exiter_add(Ecore_Task_Cb func, + const void *data) +{ + Ecore_Idle_Exiter *ie = NULL; + + _ecore_lock(); + if (!func) goto unlock; + ie = calloc(1, sizeof(Ecore_Idle_Exiter)); + if (!ie) goto unlock; + ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLE_EXITER); + ie->func = func; + ie->data = (void *)data; + idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_append(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie)); +unlock: + _ecore_unlock(); + return ie; +} + +/** + * Delete an idle exiter handler from the list to be run on exiting idle state. + * @param idle_exiter The idle exiter to delete + * @return The data pointer that was being being passed to the handler if + * successful. NULL otherwise. + */ +EAPI void * +ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter) +{ + void *data; + + if (!ECORE_MAGIC_CHECK(idle_exiter, ECORE_MAGIC_IDLE_EXITER)) + { + ECORE_MAGIC_FAIL(idle_exiter, ECORE_MAGIC_IDLE_EXITER, + "ecore_idle_exiter_del"); + return NULL; + } + _ecore_lock(); + data = _ecore_idle_exiter_del(idle_exiter); + _ecore_unlock(); + return data; +} + +/** + * @} + */ + +static void * +_ecore_idle_exiter_del(Ecore_Idle_Exiter *idle_exiter) +{ + EINA_SAFETY_ON_TRUE_RETURN_VAL(idle_exiter->delete_me, NULL); + idle_exiter->delete_me = 1; + idle_exiters_delete_me = 1; + return idle_exiter->data; +} + +void +_ecore_idle_exiter_shutdown(void) +{ + Ecore_Idle_Exiter *ie; + while ((ie = idle_exiters)) + { + idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(idle_exiters)); + ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE); + free(ie); + } + idle_exiters_delete_me = 0; + idle_exiter_current = NULL; +} + +void +_ecore_idle_exiter_call(void) +{ + if (!idle_exiter_current) + { + /* regular main loop, start from head */ + idle_exiter_current = idle_exiters; + } + else + { + /* recursive main loop, continue from where we were */ + idle_exiter_current = + (Ecore_Idle_Exiter *)EINA_INLIST_GET(idle_exiter_current)->next; + } + + while (idle_exiter_current) + { + Ecore_Idle_Exiter *ie = (Ecore_Idle_Exiter *)idle_exiter_current; + if (!ie->delete_me) + { + ie->references++; + if (!_ecore_call_task_cb(ie->func, ie->data)) + { + if (!ie->delete_me) _ecore_idle_exiter_del(ie); + } + ie->references--; + } + if (idle_exiter_current) /* may have changed in recursive main loops */ + idle_exiter_current = + (Ecore_Idle_Exiter *)EINA_INLIST_GET(idle_exiter_current)->next; + } + if (idle_exiters_delete_me) + { + Ecore_Idle_Exiter *l; + int deleted_idler_exiters_in_use = 0; + + for (l = idle_exiters; l; ) + { + Ecore_Idle_Exiter *ie = l; + + l = (Ecore_Idle_Exiter *)EINA_INLIST_GET(l)->next; + if (ie->delete_me) + { + if (ie->references) + { + deleted_idler_exiters_in_use++; + continue; + } + + idle_exiters = (Ecore_Idle_Exiter *)eina_inlist_remove(EINA_INLIST_GET(idle_exiters), EINA_INLIST_GET(ie)); + ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE); + free(ie); + } + } + if (!deleted_idler_exiters_in_use) + idle_exiters_delete_me = 0; + } +} + +int +_ecore_idle_exiter_exist(void) +{ + if (idle_exiters) return 1; + return 0; +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_idler.c b/libraries/ecore/src/lib/ecore/ecore_idler.c new file mode 100644 index 0000000..6c0cab8 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_idler.c @@ -0,0 +1,158 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "Ecore.h" +#include "ecore_private.h" + +struct _Ecore_Idler +{ + EINA_INLIST; + ECORE_MAGIC; + Ecore_Task_Cb func; + void *data; + int references; + Eina_Bool delete_me : 1; +}; + +static Ecore_Idler *idlers = NULL; +static Ecore_Idler *idler_current = NULL; +static int idlers_delete_me = 0; + +static void * +_ecore_idler_del(Ecore_Idler *idler); + +EAPI Ecore_Idler * +ecore_idler_add(Ecore_Task_Cb func, + const void *data) +{ + Ecore_Idler *ie = NULL; + + _ecore_lock(); + if (!func) goto unlock; + ie = calloc(1, sizeof(Ecore_Idler)); + if (!ie) goto unlock; + ECORE_MAGIC_SET(ie, ECORE_MAGIC_IDLER); + ie->func = func; + ie->data = (void *)data; + idlers = (Ecore_Idler *)eina_inlist_append(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie)); +unlock: + _ecore_unlock(); + return ie; +} + +EAPI void * +ecore_idler_del(Ecore_Idler *idler) +{ + void *data = NULL; + + if (!ECORE_MAGIC_CHECK(idler, ECORE_MAGIC_IDLER)) + { + ECORE_MAGIC_FAIL(idler, ECORE_MAGIC_IDLER, + "ecore_idler_del"); + return NULL; + } + + _ecore_lock(); + data = _ecore_idler_del(idler); + _ecore_unlock(); + return data; +} + +/** + * @} + */ + +/** + * @} + */ + +static void * +_ecore_idler_del(Ecore_Idler *idler) +{ + EINA_SAFETY_ON_TRUE_RETURN_VAL(idler->delete_me, NULL); + idler->delete_me = 1; + idlers_delete_me = 1; + return idler->data; +} + +void +_ecore_idler_shutdown(void) +{ + Ecore_Idler *ie; + while ((ie = idlers)) + { + idlers = (Ecore_Idler *)eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(idlers)); + ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE); + free(ie); + } + idlers_delete_me = 0; + idler_current = NULL; +} + +int +_ecore_idler_all_call(void) +{ + if (!idler_current) + { + /* regular main loop, start from head */ + idler_current = idlers; + } + else + { + /* recursive main loop, continue from where we were */ + idler_current = (Ecore_Idler *)EINA_INLIST_GET(idler_current)->next; + } + + while (idler_current) + { + Ecore_Idler *ie = (Ecore_Idler *)idler_current; + if (!ie->delete_me) + { + ie->references++; + if (!_ecore_call_task_cb(ie->func, ie->data)) + { + if (!ie->delete_me) _ecore_idler_del(ie); + } + ie->references--; + } + if (idler_current) /* may have changed in recursive main loops */ + idler_current = (Ecore_Idler *)EINA_INLIST_GET(idler_current)->next; + } + if (idlers_delete_me) + { + Ecore_Idler *l; + int deleted_idlers_in_use = 0; + for (l = idlers; l; ) + { + Ecore_Idler *ie = l; + l = (Ecore_Idler *)EINA_INLIST_GET(l)->next; + if (ie->delete_me) + { + if (ie->references) + { + deleted_idlers_in_use++; + continue; + } + + idlers = (Ecore_Idler *)eina_inlist_remove(EINA_INLIST_GET(idlers), EINA_INLIST_GET(ie)); + ECORE_MAGIC_SET(ie, ECORE_MAGIC_NONE); + free(ie); + } + } + if (!deleted_idlers_in_use) + idlers_delete_me = 0; + } + if (idlers) return 1; + return 0; +} + +int +_ecore_idler_exist(void) +{ + if (idlers) return 1; + return 0; +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_job.c b/libraries/ecore/src/lib/ecore/ecore_job.c new file mode 100644 index 0000000..481c3f3 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_job.c @@ -0,0 +1,122 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "Ecore.h" +#include "ecore_private.h" + +static Eina_Bool _ecore_job_event_handler(void *data, + int type, + void *ev); +static void _ecore_job_event_free(void *data, + void *ev); + +static int ecore_event_job_type = 0; +static Ecore_Event_Handler *_ecore_job_handler = NULL; + +struct _Ecore_Job +{ + ECORE_MAGIC; + Ecore_Event *event; + Ecore_Cb func; + void *data; +}; + +void +_ecore_job_init(void) +{ + ecore_event_job_type = ecore_event_type_new(); + _ecore_job_handler = ecore_event_handler_add(ecore_event_job_type, _ecore_job_event_handler, NULL); +} + +void +_ecore_job_shutdown(void) +{ + _ecore_event_handler_del(_ecore_job_handler); + _ecore_job_handler = NULL; +} + +/** + * @addtogroup Ecore_Job_Group + * + * @{ + */ + +/** + * Add a job to the event queue. + * @param func The function to call when the job gets handled. + * @param data Data pointer to be passed to the job function when the job is + * handled. + * @return The handle of the job. @c NULL is returned if the job could not be + * added to the queue. + * @note Once the job has been executed, the job handle is invalid. + */ +EAPI Ecore_Job * +ecore_job_add(Ecore_Cb func, + const void *data) +{ + Ecore_Job *job; + + if (!func) return NULL; + + job = calloc(1, sizeof(Ecore_Job)); + if (!job) return NULL; + ECORE_MAGIC_SET(job, ECORE_MAGIC_JOB); + job->event = ecore_event_add(ecore_event_job_type, job, _ecore_job_event_free, NULL); + if (!job->event) + { + free(job); + return NULL; + } + job->func = func; + job->data = (void *)data; + return job; +} + +/** + * Delete a queued job that has not yet been executed. + * @param job Handle of the job to delete. + * @return The data pointer that was to be passed to the job. + */ +EAPI void * +ecore_job_del(Ecore_Job *job) +{ + void *data; + + if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_JOB)) + { + ECORE_MAGIC_FAIL(job, ECORE_MAGIC_JOB, + "ecore_job_del"); + return NULL; + } + data = job->data; + ECORE_MAGIC_SET(job, ECORE_MAGIC_NONE); + ecore_event_del(job->event); + return data; +} + +/** + * @} + */ + +static Eina_Bool +_ecore_job_event_handler(void *data __UNUSED__, + int type __UNUSED__, + void *ev) +{ + Ecore_Job *job; + + job = ev; + job->func(job->data); + return ECORE_CALLBACK_CANCEL; +} + +static void +_ecore_job_event_free(void *data __UNUSED__, + void *ev) +{ + free(ev); +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_main.c b/libraries/ecore/src/lib/ecore/ecore_main.c new file mode 100644 index 0000000..152836a --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_main.c @@ -0,0 +1,2020 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef _WIN32 +# define WIN32_LEAN_AND_MEAN +# include +# undef WIN32_LEAN_AND_MEAN +# ifndef USER_TIMER_MINIMUM +# define USER_TIMER_MINIMUM 0x0a +# endif +#endif + +#ifdef __SUNPRO_C +# include +# include +#endif + +#include +#include +#include +#include +#include +#include + +#ifndef _MSC_VER +# include +# include +#else +# include +#endif + +#ifdef HAVE_ISFINITE +# define ECORE_FINITE(t) isfinite(t) +#else +# ifdef _MSC_VER +# define ECORE_FINITE(t) _finite(t) +# else +# define ECORE_FINITE(t) finite(t) +# endif +#endif + +//#define FIX_HZ 1 + +#ifdef FIX_HZ +# ifndef _MSC_VER +# include +# endif +# ifndef HZ +# define HZ 100 +# endif +#endif + +#ifdef HAVE_EVIL +# include +#endif + +#include "Ecore.h" +#include "ecore_private.h" + +#ifdef HAVE_SYS_EPOLL_H +# define HAVE_EPOLL 1 +# include +#else + +# define HAVE_EPOLL 0 +# define EPOLLIN 1 +# define EPOLLOUT 2 +# define EPOLLERR 8 + +#define EPOLL_CTL_ADD 1 +#define EPOLL_CTL_DEL 2 +#define EPOLL_CTL_MOD 3 + +typedef union epoll_data { + void *ptr; + int fd; + uint32_t u32; + uint64_t u64; +} epoll_data_t; + +struct epoll_event +{ + uint32_t events; + epoll_data_t data; +}; + +static inline int +epoll_create(int size __UNUSED__) +{ + return -1; +} + +static inline int +epoll_wait(int epfd __UNUSED__, + struct epoll_event *events __UNUSED__, + int maxevents __UNUSED__, + int timeout __UNUSED__) +{ + return -1; +} + +static inline int +epoll_ctl(int epfd __UNUSED__, + int op __UNUSED__, + int fd __UNUSED__, + struct epoll_event *event __UNUSED__) +{ + return -1; +} + +#endif + +#ifdef HAVE_SYS_TIMERFD_H +#include +#else +/* fallback code if we don't have real timerfd - reduces number of ifdefs */ +#ifndef CLOCK_MONOTONIC +#define CLOCK_MONOTONIC 0 /* bogus value */ +#endif +#ifndef TFD_NONBLOCK +#define TFD_NONBLOCK 0 /* bogus value */ +#endif +static inline int +timerfd_create(int clockid __UNUSED__, + int flags __UNUSED__) +{ + return -1; +} + +static inline int +timerfd_settime(int fd __UNUSED__, + int flags __UNUSED__, + const struct itimerspec *new_value __UNUSED__, + struct itimerspec *old_value __UNUSED__) +{ + return -1; +} + +#endif /* HAVE_SYS_TIMERFD_H */ + +#ifdef USE_G_MAIN_LOOP +# include +#endif + +#define NS_PER_SEC (1000.0 * 1000.0 * 1000.0) + +struct _Ecore_Fd_Handler +{ + EINA_INLIST; + ECORE_MAGIC; + Ecore_Fd_Handler *next_ready; + int fd; + Ecore_Fd_Handler_Flags flags; + Ecore_Fd_Cb func; + void *data; + Ecore_Fd_Cb buf_func; + void *buf_data; + Ecore_Fd_Prep_Cb prep_func; + void *prep_data; + int references; + Eina_Bool read_active : 1; + Eina_Bool write_active : 1; + Eina_Bool error_active : 1; + Eina_Bool delete_me : 1; +#if defined(USE_G_MAIN_LOOP) + GPollFD gfd; +#endif +}; + +#ifdef _WIN32 +struct _Ecore_Win32_Handler +{ + EINA_INLIST; + ECORE_MAGIC; + HANDLE h; + Ecore_Win32_Handle_Cb func; + void *data; + int references; + Eina_Bool delete_me : 1; +}; +#endif + +#ifndef USE_G_MAIN_LOOP +static int _ecore_main_select(double timeout); +#endif +static void _ecore_main_prepare_handlers(void); +static void _ecore_main_fd_handlers_cleanup(void); +#ifndef _WIN32 +# ifndef USE_G_MAIN_LOOP +static void _ecore_main_fd_handlers_bads_rem(void); +# endif +#endif +static void _ecore_main_fd_handlers_call(void); +static int _ecore_main_fd_handlers_buf_call(void); +#ifndef USE_G_MAIN_LOOP +static void _ecore_main_loop_iterate_internal(int once_only); +#endif + +#ifdef _WIN32 +static int _ecore_main_win32_select(int nfds, + fd_set *readfds, + fd_set *writefds, + fd_set *exceptfds, + struct timeval *timeout); +static void _ecore_main_win32_handlers_cleanup(void); +#endif + +static int in_main_loop = 0; +#ifndef USE_G_MAIN_LOOP +static int do_quit = 0; +#endif +static Ecore_Fd_Handler *fd_handlers = NULL; +static Ecore_Fd_Handler *fd_handler_current = NULL; +static Eina_List *fd_handlers_with_prep = NULL; +static Eina_List *fd_handlers_with_buffer = NULL; +static Eina_List *fd_handlers_to_delete = NULL; + +/* single linked list of ready fdhs, terminated by loop to self */ +static Ecore_Fd_Handler *fd_handlers_to_call; +static Ecore_Fd_Handler *fd_handlers_to_call_current; + +#ifdef _WIN32 +static Ecore_Win32_Handler *win32_handlers = NULL; +static Ecore_Win32_Handler *win32_handler_current = NULL; +static Eina_Bool win32_handlers_delete_me = EINA_FALSE; +#endif + +#ifdef _WIN32 +Ecore_Select_Function main_loop_select = _ecore_main_win32_select; +#else +# ifdef HAVE_SYS_SELECT_H +# include +# endif +Ecore_Select_Function main_loop_select = select; +#endif + +#ifndef USE_G_MAIN_LOOP +static double t1 = 0.0; +static double t2 = 0.0; +#endif + +static int timer_fd = -1; +static int epoll_fd = -1; +static pid_t epoll_pid; + +#ifdef USE_G_MAIN_LOOP +static GPollFD ecore_epoll_fd; +static GPollFD ecore_timer_fd; +static GSource *ecore_glib_source; +static guint ecore_glib_source_id; +static GMainLoop *ecore_main_loop; +static gboolean ecore_idling; +static gboolean _ecore_glib_idle_enterer_called; +static gboolean ecore_fds_ready; +#endif + +static inline void +_ecore_fd_valid(void) +{ + if (HAVE_EPOLL && epoll_fd >= 0) + { + if (fcntl(epoll_fd, F_GETFD) < 0) + { + ERR("arghhh you caught me! report a backtrace to edevel!"); + pause(); + } + } +} + +static inline void +_ecore_try_add_to_call_list(Ecore_Fd_Handler *fdh) +{ + /* check if this fdh is already in the list */ + if (fdh->next_ready) + return; + if (fdh->read_active || fdh->write_active || fdh->error_active) + { + /* + * make sure next_ready is non-null by pointing to ourselves + * use that to indicate this fdh is in the ready list + * insert at the head of the list to avoid trouble + */ + fdh->next_ready = fd_handlers_to_call ? fd_handlers_to_call : fdh; + fd_handlers_to_call = fdh; + } +} + +static inline int +_ecore_get_epoll_fd(void) +{ + if (epoll_pid && epoll_pid != getpid()) + { + /* forked! */ + _ecore_main_loop_shutdown(); + } + if (epoll_pid == 0 && epoll_fd < 0) + { + _ecore_main_loop_init(); + } + return epoll_fd; +} + +static inline int +_ecore_epoll_add(int efd, + int fd, + int events, + void *ptr) +{ + struct epoll_event ev; + + memset(&ev, 0, sizeof (ev)); + ev.events = events; + ev.data.ptr = ptr; + INF("adding poll on %d %08x", fd, events); + return epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ev); +} + +static inline int +_ecore_poll_events_from_fdh(Ecore_Fd_Handler *fdh) +{ + int events = 0; + if (fdh->flags & ECORE_FD_READ) events |= EPOLLIN; + if (fdh->flags & ECORE_FD_WRITE) events |= EPOLLOUT; + if (fdh->flags & ECORE_FD_ERROR) events |= EPOLLERR; + return events; +} + +#ifdef USE_G_MAIN_LOOP +static inline int +_gfd_events_from_fdh(Ecore_Fd_Handler *fdh) +{ + int events = 0; + if (fdh->flags & ECORE_FD_READ) events |= G_IO_IN; + if (fdh->flags & ECORE_FD_WRITE) events |= G_IO_OUT; + if (fdh->flags & ECORE_FD_ERROR) events |= G_IO_ERR; + return events; +} + +#endif + +static inline int +_ecore_main_fdh_poll_add(Ecore_Fd_Handler *fdh) +{ + int r = 0; + + if (HAVE_EPOLL && epoll_fd >= 0) + { + r = _ecore_epoll_add(_ecore_get_epoll_fd(), fdh->fd, + _ecore_poll_events_from_fdh(fdh), fdh); + } + else + { +#ifdef USE_G_MAIN_LOOP + fdh->gfd.fd = fdh->fd; + fdh->gfd.events = _gfd_events_from_fdh(fdh); + fdh->gfd.revents = 0; + INF("adding gpoll on %d %08x", fdh->fd, fdh->gfd.events); + g_source_add_poll(ecore_glib_source, &fdh->gfd); +#endif + } + return r; +} + +static inline void +_ecore_main_fdh_poll_del(Ecore_Fd_Handler *fdh) +{ + if (HAVE_EPOLL && epoll_fd >= 0) + { + struct epoll_event ev; + int efd = _ecore_get_epoll_fd(); + + memset(&ev, 0, sizeof (ev)); + INF("removing poll on %d", fdh->fd); + /* could get an EBADF if somebody closed the FD before removing it */ + if ((epoll_ctl(efd, EPOLL_CTL_DEL, fdh->fd, &ev) < 0)) + { + if (errno == EBADF) + { + WRN("fd %d was closed, can't remove from epoll - reinit!", + fdh->fd); + _ecore_main_loop_shutdown(); + _ecore_main_loop_init(); + } + else + { + ERR("Failed to delete epoll fd %d! (errno=%d)", fdh->fd, errno); + } + } + } + else + { +#ifdef USE_G_MAIN_LOOP + fdh->gfd.fd = fdh->fd; + fdh->gfd.events = _gfd_events_from_fdh(fdh); + fdh->gfd.revents = 0; + INF("adding gpoll on %d %08x", fdh->fd, fdh->gfd.events); + g_source_add_poll(ecore_glib_source, &fdh->gfd); +#endif + } +} + +static inline int +_ecore_main_fdh_poll_modify(Ecore_Fd_Handler *fdh) +{ + int r = 0; + if (HAVE_EPOLL && epoll_fd >= 0) + { + struct epoll_event ev; + int efd = _ecore_get_epoll_fd(); + + memset(&ev, 0, sizeof (ev)); + ev.events = _ecore_poll_events_from_fdh(fdh); + ev.data.ptr = fdh; + INF("modifing epoll on %d to %08x", fdh->fd, ev.events); + r = epoll_ctl(efd, EPOLL_CTL_MOD, fdh->fd, &ev); + } + else + { +#ifdef USE_G_MAIN_LOOP + fdh->gfd.fd = fdh->fd; + fdh->gfd.events = _gfd_events_from_fdh(fdh); + fdh->gfd.revents = 0; + INF("modifing gpoll on %d to %08x", fdh->fd, fdh->gfd.events); +#endif + } + return r; +} + +static inline int +_ecore_main_fdh_epoll_mark_active(void) +{ + struct epoll_event ev[32]; + int i, ret; + int efd = _ecore_get_epoll_fd(); + + memset(&ev, 0, sizeof (ev)); + ret = epoll_wait(efd, ev, sizeof(ev) / sizeof(struct epoll_event), 0); + if (ret < 0) + { + if (errno == EINTR) return -1; + ERR("epoll_wait failed %d", errno); + return -1; + } + + for (i = 0; i < ret; i++) + { + Ecore_Fd_Handler *fdh; + + fdh = ev[i].data.ptr; + if (!ECORE_MAGIC_CHECK(fdh, ECORE_MAGIC_FD_HANDLER)) + { + ECORE_MAGIC_FAIL(fdh, ECORE_MAGIC_FD_HANDLER, + "_ecore_main_fdh_epoll_mark_active"); + continue; + } + if (fdh->delete_me) + { + ERR("deleted fd in epoll"); + continue; + } + + if (ev[i].events & EPOLLIN) + fdh->read_active = EINA_TRUE; + if (ev[i].events & EPOLLOUT) + fdh->write_active = EINA_TRUE; + if (ev[i].events & EPOLLERR) + fdh->error_active = EINA_TRUE; + + _ecore_try_add_to_call_list(fdh); + } + + return ret; +} + +#ifdef USE_G_MAIN_LOOP + +static inline int +_ecore_main_fdh_glib_mark_active(void) +{ + Ecore_Fd_Handler *fdh; + int ret = 0; + + /* call the prepare callback for all handlers */ + EINA_INLIST_FOREACH(fd_handlers, fdh) + { + if (fdh->delete_me) + continue; + + if (fdh->gfd.revents & G_IO_IN) + fdh->read_active = EINA_TRUE; + if (fdh->gfd.revents & G_IO_OUT) + fdh->write_active = EINA_TRUE; + if (fdh->gfd.revents & G_IO_ERR) + fdh->error_active = EINA_TRUE; + + _ecore_try_add_to_call_list(fdh); + + if (fdh->gfd.revents & (G_IO_IN | G_IO_OUT | G_IO_ERR)) ret++; + } + + return ret; +} + +/* like we are about to enter main_loop_select in _ecore_main_select */ +static gboolean +_ecore_main_gsource_prepare(GSource *source __UNUSED__, + gint *next_time) +{ + gboolean ready = FALSE; + + _ecore_lock(); + in_main_loop++; + + if (!ecore_idling && !_ecore_glib_idle_enterer_called) + { + _ecore_time_loop_time = ecore_time_get(); + _ecore_timer_expired_timers_call(_ecore_time_loop_time); + _ecore_timer_cleanup(); + + _ecore_idle_enterer_call(); + _ecore_throttle(); + _ecore_glib_idle_enterer_called = FALSE; + + if (fd_handlers_with_buffer) + _ecore_main_fd_handlers_buf_call(); + } + + _ecore_signal_received_process(); + + /* don't check fds if somebody quit */ + if (g_main_loop_is_running(ecore_main_loop)) + { + /* only set idling state in dispatch */ + if (ecore_idling && !_ecore_idler_exist() && !_ecore_event_exist()) + { + if (_ecore_timers_exists()) + { + int r = -1; + double t = _ecore_timer_next_get(); + if (timer_fd >= 0 && t > 0.0) + { + struct itimerspec ts; + + ts.it_interval.tv_sec = 0; + ts.it_interval.tv_nsec = 0; + ts.it_value.tv_sec = t; + ts.it_value.tv_nsec = fmod(t * NS_PER_SEC, NS_PER_SEC); + + /* timerfd cannot sleep for 0 time */ + if (ts.it_value.tv_sec || ts.it_value.tv_nsec) + { + r = timerfd_settime(timer_fd, 0, &ts, NULL); + if (r < 0) + { + ERR("timer set returned %d (errno=%d)", r, errno); + close(timer_fd); + timer_fd = -1; + } + else + INF("sleeping for %ld s %06ldus", + ts.it_value.tv_sec, + ts.it_value.tv_nsec / 1000); + } + } + if (r == -1) + { + *next_time = ceil(t * 1000.0); + if (t == 0.0) + ready = TRUE; + } + } + else + *next_time = -1; + } + else + { + *next_time = 0; + if (_ecore_event_exist()) + ready = TRUE; + } + + if (fd_handlers_with_prep) + _ecore_main_prepare_handlers(); + } + else + ready = TRUE; + + in_main_loop--; + INF("leave, timeout = %d", *next_time); + _ecore_unlock(); + + /* ready if we're not running (about to quit) */ + return ready; +} + +static gboolean +_ecore_main_gsource_check(GSource *source __UNUSED__) +{ + gboolean ret = FALSE; + + _ecore_lock(); + in_main_loop++; + + /* check if old timers expired */ + if (ecore_idling && !_ecore_idler_exist() && !_ecore_event_exist()) + { + if (timer_fd >= 0) + { + uint64_t count = 0; + int r = read(timer_fd, &count, sizeof count); + if (r == -1 && errno == EAGAIN) + ; + else if (r == sizeof count) + ret = TRUE; + else + { + /* unexpected things happened... fail back to old way */ + ERR("timer read returned %d (errno=%d)", r, errno); + close(timer_fd); + timer_fd = -1; + } + } + } + else + ret = TRUE; + + /* check if fds are ready */ + if (HAVE_EPOLL && epoll_fd >= 0) + ecore_fds_ready = (_ecore_main_fdh_epoll_mark_active() > 0); + else + ecore_fds_ready = (_ecore_main_fdh_glib_mark_active() > 0); + _ecore_main_fd_handlers_cleanup(); + if (ecore_fds_ready) + ret = TRUE; + + /* check timers after updating loop time */ + if (!ret && _ecore_timers_exists()) + ret = (0.0 == _ecore_timer_next_get()); + + in_main_loop--; + _ecore_unlock(); + + return ret; +} + +/* like we just came out of main_loop_select in _ecore_main_select */ +static gboolean +_ecore_main_gsource_dispatch(GSource *source __UNUSED__, + GSourceFunc callback __UNUSED__, + gpointer user_data __UNUSED__) +{ + gboolean events_ready, timers_ready, idlers_ready; + double next_time; + + _ecore_lock(); + _ecore_time_loop_time = ecore_time_get(); + _ecore_timer_enable_new(); + next_time = _ecore_timer_next_get(); + + events_ready = _ecore_event_exist(); + timers_ready = _ecore_timers_exists() && (0.0 == next_time); + idlers_ready = _ecore_idler_exist(); + + in_main_loop++; + INF("enter idling=%d fds=%d events=%d timers=%d (next=%.2f) idlers=%d", + ecore_idling, ecore_fds_ready, events_ready, + timers_ready, next_time, idlers_ready); + + if (ecore_idling && events_ready) + { + _ecore_idle_exiter_call(); + ecore_idling = 0; + } + else if (!ecore_idling && !events_ready) + { + ecore_idling = 1; + } + + if (ecore_idling) + { + _ecore_idler_all_call(); + + events_ready = _ecore_event_exist(); + + if (ecore_fds_ready || events_ready || timers_ready) + { + _ecore_idle_exiter_call(); + ecore_idling = 0; + } + } + + /* process events */ + if (!ecore_idling) + { + _ecore_main_fd_handlers_call(); + if (fd_handlers_with_buffer) + _ecore_main_fd_handlers_buf_call(); + _ecore_signal_received_process(); + _ecore_event_call(); + _ecore_main_fd_handlers_cleanup(); + + _ecore_timer_expired_timers_call(_ecore_time_loop_time); + _ecore_timer_cleanup(); + + _ecore_idle_enterer_call(); + _ecore_throttle(); + _ecore_glib_idle_enterer_called = TRUE; + + if (fd_handlers_with_buffer) + _ecore_main_fd_handlers_buf_call(); + } + + in_main_loop--; + _ecore_unlock(); + + return TRUE; /* what should be returned here? */ +} + +static void +_ecore_main_gsource_finalize(GSource *source __UNUSED__) +{ +} + +static GSourceFuncs ecore_gsource_funcs = +{ + .prepare = _ecore_main_gsource_prepare, + .check = _ecore_main_gsource_check, + .dispatch = _ecore_main_gsource_dispatch, + .finalize = _ecore_main_gsource_finalize, +}; + +#endif + +void +_ecore_main_loop_init(void) +{ + epoll_fd = epoll_create(1); + if (epoll_fd < 0) + WRN("Failed to create epoll fd!"); + epoll_pid = getpid(); + + /* add polls on all our file descriptors */ + Ecore_Fd_Handler *fdh; + EINA_INLIST_FOREACH(fd_handlers, fdh) + { + if (fdh->delete_me) + continue; + _ecore_epoll_add(epoll_fd, fdh->fd, + _ecore_poll_events_from_fdh(fdh), fdh); + _ecore_main_fdh_poll_add(fdh); + } + + /* setup for the g_main_loop only integration */ +#ifdef USE_G_MAIN_LOOP + ecore_glib_source = g_source_new(&ecore_gsource_funcs, sizeof (GSource)); + if (!ecore_glib_source) + CRIT("Failed to create glib source for epoll!"); + else + { + g_source_set_priority(ecore_glib_source, G_PRIORITY_HIGH_IDLE + 20); + if (HAVE_EPOLL && epoll_fd >= 0) + { + /* epoll multiplexes fds into the g_main_loop */ + ecore_epoll_fd.fd = epoll_fd; + ecore_epoll_fd.events = G_IO_IN; + ecore_epoll_fd.revents = 0; + g_source_add_poll(ecore_glib_source, &ecore_epoll_fd); + } + + /* timerfd gives us better than millisecond accuracy in g_main_loop */ + timer_fd = timerfd_create(CLOCK_MONOTONIC, TFD_NONBLOCK); + if (timer_fd < 0) + WRN("failed to create timer fd!"); + else + { + ecore_timer_fd.fd = timer_fd; + ecore_timer_fd.events = G_IO_IN; + ecore_timer_fd.revents = 0; + g_source_add_poll(ecore_glib_source, &ecore_timer_fd); + } + + ecore_glib_source_id = g_source_attach(ecore_glib_source, NULL); + if (ecore_glib_source_id <= 0) + CRIT("Failed to attach glib source to default context"); + } +#endif +} + +void +_ecore_main_loop_shutdown(void) +{ +#ifdef USE_G_MAIN_LOOP + if (ecore_glib_source) + { + g_source_destroy(ecore_glib_source); + ecore_glib_source = NULL; + } +#endif + + if (epoll_fd >= 0) + { + close(epoll_fd); + epoll_fd = -1; + } + epoll_pid = 0; + + if (timer_fd >= 0) + { + close(timer_fd); + timer_fd = -1; + } +} + +void * +_ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler) +{ + if (fd_handler->delete_me) + { + ERR("fdh %p deleted twice", fd_handler); + return NULL; + } + + _ecore_main_fdh_poll_del(fd_handler); + fd_handler->delete_me = EINA_TRUE; + fd_handlers_to_delete = eina_list_append(fd_handlers_to_delete, fd_handler); + if (fd_handler->prep_func && fd_handlers_with_prep) + fd_handlers_with_prep = eina_list_remove(fd_handlers_with_prep, fd_handler); + if (fd_handler->buf_func && fd_handlers_with_buffer) + fd_handlers_with_buffer = eina_list_remove(fd_handlers_with_buffer, fd_handler); + return fd_handler->data; +} + +/** + * @addtogroup Ecore_Main_Loop_Group + * + * @{ + */ + +/** + * Runs a single iteration of the main loop to process everything on the + * queue. + * + * It does everything that is already done inside an @c Ecore main loop, like + * checking for expired timers, idlers, etc. But it will do it only once and + * return, instead of keep watching for new events. + * + * DO NOT use this function unless you are the person God comes to ask for + * advice when He has trouble managing the Universe. + */ +EAPI void +ecore_main_loop_iterate(void) +{ +#ifndef USE_G_MAIN_LOOP + _ecore_lock(); + _ecore_main_loop_iterate_internal(1); + _ecore_unlock(); +#else + g_main_context_iteration(NULL, 0); +#endif +} + +/** + * Runs the application main loop. + * + * This function will not return until @ref ecore_main_loop_quit is called. It + * will check for expired timers, idlers, file descriptors being watched by fd + * handlers, etc. Once everything is done, before entering again on idle state, + * any callback set as @c Idle_Enterer will be called. + * + * Each main loop iteration is done by calling ecore_main_loop_iterate() + * internally. + * + * The polling (select) function used can be changed with + * ecore_main_loop_select_func_set(). + * + * The function used to check for file descriptors, events, and that has a + * timeout for the timers can be changed using + * ecore_main_loop_select_func_set(). + */ +EAPI void +ecore_main_loop_begin(void) +{ +#ifndef USE_G_MAIN_LOOP + _ecore_lock(); + in_main_loop++; + while (do_quit == 0) _ecore_main_loop_iterate_internal(0); + do_quit = 0; + in_main_loop--; + _ecore_unlock(); +#else + ecore_main_loop = g_main_loop_new(NULL, FALSE); + g_main_loop_run(ecore_main_loop); +#endif +} + +/** + * Quits the main loop once all the events currently on the queue have + * been processed. + * + * This function returns immediately, but will mark the ecore_main_loop_begin() + * function to return at the end of the current main loop iteration. + */ +EAPI void +ecore_main_loop_quit(void) +{ +#ifndef USE_G_MAIN_LOOP + do_quit = 1; +#else + g_main_loop_quit(ecore_main_loop); +#endif +} + +/** + * Sets the function to use when monitoring multiple file descriptors, + * and waiting until one of more of the file descriptors before ready + * for some class of I/O operation. + * + * This function will be used instead of the system call select and + * could possible be used to integrate the Ecore event loop with an + * external event loop. + * + * @warning you don't know how to use, don't even try to use it. + * + */ +EAPI void +ecore_main_loop_select_func_set(Ecore_Select_Function func) +{ + main_loop_select = func; +} + +/** + * Gets the select function set by ecore_select_func_set(), + * or the native select function if none was set. + * + */ +EAPI Ecore_Select_Function +ecore_main_loop_select_func_get(void) +{ + return main_loop_select; +} + +/** + * Adds a callback for activity on the given file descriptor. + * + * @p func will be called during the execution of @ref ecore_main_loop_begin + * when the file descriptor is available for reading, or writing, or both. + * + * Normally when @p func returns ECORE_CALLBACK_CANCEL, it indicates that the + * handler should be marked for deletion (identical to calling @ref ecore_main_fd_handler_del). + * However, if the @p buf_func is supplied, then the return value from the @p func indicates that + * @p func should be called repeatedly until it returns ECORE_CALLBACK_CANCEL. + * + * @p buf_func is called during event loop handling to check if data that has + * been read from the file descriptor is in a buffer and is available to + * read. Some systems (notably xlib) handle their own buffering, and would + * otherwise not work with select(). These systems should use a @p buf_func. + * This is a most annoying hack, only ecore_x uses it, so refer to that for + * an example. NOTE - @p func should probably return ECORE_CALLBACK_RENEW always if + * @p buf_func is used, to avoid confusion with the other return value + * semantics. + * + * @param fd The file descriptor to watch. + * @param flags To watch it for read (@c ECORE_FD_READ) and/or + * (@c ECORE_FD_WRITE) write ability. @c ECORE_FD_ERROR + * + * @param func The callback function. + * @param data The data to pass to the callback. + * @param buf_func The function to call to check if any data has been + * buffered and already read from the fd. Can be @c NULL. + * @param buf_data The data to pass to the @p buf_func function. + * @return A fd handler handle if successful. @c NULL otherwise. + * @note This function CANNOT be used for reading/writing to regular files! + * @ingroup Ecore_FD_Handler_Group + */ +EAPI Ecore_Fd_Handler * +ecore_main_fd_handler_add(int fd, + Ecore_Fd_Handler_Flags flags, + Ecore_Fd_Cb func, + const void *data, + Ecore_Fd_Cb buf_func, + const void *buf_data) +{ + Ecore_Fd_Handler *fdh = NULL; + + _ecore_lock(); + + if ((fd < 0) || (flags == 0) || (!func)) goto unlock; + + fdh = calloc(1, sizeof(Ecore_Fd_Handler)); + if (!fdh) goto unlock; + ECORE_MAGIC_SET(fdh, ECORE_MAGIC_FD_HANDLER); + fdh->next_ready = NULL; + fdh->fd = fd; + fdh->flags = flags; + if (_ecore_main_fdh_poll_add(fdh) < 0) + { + int err = errno; + ERR("Failed to add poll on fd %d (errno = %d: %s)!", fd, err, strerror(err)); + free(fdh); + fdh = NULL; + goto unlock; + } + fdh->read_active = EINA_FALSE; + fdh->write_active = EINA_FALSE; + fdh->error_active = EINA_FALSE; + fdh->delete_me = EINA_FALSE; + fdh->func = func; + fdh->data = (void *)data; + fdh->buf_func = buf_func; + if (buf_func) + fd_handlers_with_buffer = eina_list_append(fd_handlers_with_buffer, fdh); + fdh->buf_data = (void *)buf_data; + fd_handlers = (Ecore_Fd_Handler *) + eina_inlist_append(EINA_INLIST_GET(fd_handlers), + EINA_INLIST_GET(fdh)); +unlock: + _ecore_unlock(); + + return fdh; +} + +#ifdef _WIN32 +EAPI Ecore_Win32_Handler * +ecore_main_win32_handler_add(void *h, + Ecore_Win32_Handle_Cb func, + const void *data) +{ + Ecore_Win32_Handler *wh; + + if (!h || !func) return NULL; + + wh = calloc(1, sizeof(Ecore_Win32_Handler)); + if (!wh) return NULL; + ECORE_MAGIC_SET(wh, ECORE_MAGIC_WIN32_HANDLER); + wh->h = (HANDLE)h; + wh->delete_me = EINA_FALSE; + wh->func = func; + wh->data = (void *)data; + win32_handlers = (Ecore_Win32_Handler *) + eina_inlist_append(EINA_INLIST_GET(win32_handlers), + EINA_INLIST_GET(wh)); + return wh; +} + +#else +EAPI Ecore_Win32_Handler * +ecore_main_win32_handler_add(void *h __UNUSED__, + Ecore_Win32_Handle_Cb func __UNUSED__, + const void *data __UNUSED__) +{ + return NULL; +} + +#endif + +/** + * Marks an FD handler for deletion. + * @param fd_handler The FD handler. + * @return The data pointer set using @ref ecore_main_fd_handler_add, + * for @p fd_handler on success. @c NULL otherwise. + * @ingroup Ecore_FD_Handler_Group + * This function marks an fd handler to be deleted during an iteration of the main loop. + * It does NOT close the associated fd! + * + * @note If the underlying fd is already closed ecore may complain if the main loop + * is using epoll internally, and also in some rare cases this may cause + * crashes and instability. Remember to delete your fd handlers before the + * fds they listen to are closed. + */ +EAPI void * +ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler) +{ + void *ret = NULL; + + _ecore_lock(); + + if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER)) + { + ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER, + "ecore_main_fd_handler_del"); + goto unlock; + } + ret = _ecore_main_fd_handler_del(fd_handler); +unlock: + _ecore_unlock(); + return ret; +} + +#ifdef _WIN32 +EAPI void * +ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler) +{ + if (!ECORE_MAGIC_CHECK(win32_handler, ECORE_MAGIC_WIN32_HANDLER)) + { + ECORE_MAGIC_FAIL(win32_handler, ECORE_MAGIC_WIN32_HANDLER, + "ecore_main_win32_handler_del"); + return NULL; + } + win32_handler->delete_me = EINA_TRUE; + win32_handlers_delete_me = EINA_TRUE; + return win32_handler->data; +} + +#else +EAPI void * +ecore_main_win32_handler_del(Ecore_Win32_Handler *win32_handler __UNUSED__) +{ + return NULL; +} + +#endif + +/** + * @brief Set the prepare callback with data for a given #Ecore_Fd_Handler + * + * @param fd_handler The fd handler + * @param func The prep function + * @param data The data to pass to the prep function + * + * This function will be called prior to any fd handler's callback function + * (even the other fd handlers), before entering the main loop select function. + * + * @note Once a prepare callback is set for a fd handler, it cannot be changed. + * You need to delete the fd handler and create a new one, to set another + * callback. + * @note You probably don't need this function. It is only necessary for very + * uncommon cases that need special behavior. + * + * @ingroup Ecore_FD_Handler_Group + */ +EAPI void +ecore_main_fd_handler_prepare_callback_set(Ecore_Fd_Handler *fd_handler, + Ecore_Fd_Prep_Cb func, + const void *data) +{ + _ecore_lock(); + + if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER)) + { + ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER, + "ecore_main_fd_handler_prepare_callback_set"); + goto unlock; + } + fd_handler->prep_func = func; + fd_handler->prep_data = (void *)data; + if ((!fd_handlers_with_prep) || + (fd_handlers_with_prep && (!eina_list_data_find(fd_handlers_with_prep, fd_handler)))) + /* FIXME: THIS WILL NOT SCALE WITH LOTS OF PREP FUNCTIONS!!! */ + fd_handlers_with_prep = eina_list_append(fd_handlers_with_prep, fd_handler); +unlock: + _ecore_unlock(); +} + +/** + * Retrieves the file descriptor that the given handler is handling. + * @param fd_handler The given FD handler. + * @return The file descriptor the handler is watching. + * @ingroup Ecore_FD_Handler_Group + */ +EAPI int +ecore_main_fd_handler_fd_get(Ecore_Fd_Handler *fd_handler) +{ + int fd = -1; + + _ecore_lock(); + + if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER)) + { + ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER, + "ecore_main_fd_handler_fd_get"); + goto unlock; + } + fd = fd_handler->fd; +unlock: + _ecore_unlock(); + return fd; +} + +/** + * Return if read, write or error, or a combination thereof, is active on the + * file descriptor of the given FD handler. + * @param fd_handler The given FD handler. + * @param flags The flags, @c ECORE_FD_READ, @c ECORE_FD_WRITE or + * @c ECORE_FD_ERROR to query. + * @return #EINA_TRUE if any of the given flags are active. #EINA_FALSE otherwise. + * @ingroup Ecore_FD_Handler_Group + */ +EAPI Eina_Bool +ecore_main_fd_handler_active_get(Ecore_Fd_Handler *fd_handler, + Ecore_Fd_Handler_Flags flags) +{ + int ret = EINA_FALSE; + + _ecore_lock(); + + if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER)) + { + ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER, + "ecore_main_fd_handler_active_get"); + goto unlock; + } + if ((flags & ECORE_FD_READ) && (fd_handler->read_active)) ret = EINA_TRUE; + if ((flags & ECORE_FD_WRITE) && (fd_handler->write_active)) ret = EINA_TRUE; + if ((flags & ECORE_FD_ERROR) && (fd_handler->error_active)) ret = EINA_TRUE; +unlock: + _ecore_unlock(); + return ret; +} + +/** + * Set what active streams the given FD handler should be monitoring. + * @param fd_handler The given FD handler. + * @param flags The flags to be watching. + * @ingroup Ecore_FD_Handler_Group + */ +EAPI void +ecore_main_fd_handler_active_set(Ecore_Fd_Handler *fd_handler, + Ecore_Fd_Handler_Flags flags) +{ + int ret; + + _ecore_lock(); + + if (!ECORE_MAGIC_CHECK(fd_handler, ECORE_MAGIC_FD_HANDLER)) + { + ECORE_MAGIC_FAIL(fd_handler, ECORE_MAGIC_FD_HANDLER, + "ecore_main_fd_handler_active_set"); + goto unlock; + } + fd_handler->flags = flags; + ret = _ecore_main_fdh_poll_modify(fd_handler); + if (ret < 0) + { + ERR("Failed to mod epoll fd %d: %s!", fd_handler->fd, strerror(ret)); + } +unlock: + _ecore_unlock(); +} + +/** + * @} + */ + +void +_ecore_main_shutdown(void) +{ + if (in_main_loop) + { + ERR("\n" + "*** ECORE WARINING: Calling ecore_shutdown() while still in the main loop.\n" + "*** Program may crash or behave strangely now."); + return; + } + while (fd_handlers) + { + Ecore_Fd_Handler *fdh; + + fdh = fd_handlers; + fd_handlers = (Ecore_Fd_Handler *)eina_inlist_remove(EINA_INLIST_GET(fd_handlers), + EINA_INLIST_GET(fdh)); + ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE); + free(fdh); + } + if (fd_handlers_with_buffer) + fd_handlers_with_buffer = eina_list_free(fd_handlers_with_buffer); + if (fd_handlers_with_prep) + fd_handlers_with_prep = eina_list_free(fd_handlers_with_prep); + if (fd_handlers_to_delete) + fd_handlers_to_delete = eina_list_free(fd_handlers_to_delete); + + fd_handlers_to_call = NULL; + fd_handlers_to_call_current = NULL; + fd_handlers_to_delete = NULL; + fd_handler_current = NULL; + +#ifdef _WIN32 + while (win32_handlers) + { + Ecore_Win32_Handler *wh; + + wh = win32_handlers; + win32_handlers = (Ecore_Win32_Handler *)eina_inlist_remove(EINA_INLIST_GET(win32_handlers), + EINA_INLIST_GET(wh)); + ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE); + free(wh); + } + win32_handlers_delete_me = EINA_FALSE; + win32_handler_current = NULL; +#endif +} + +static void +_ecore_main_prepare_handlers(void) +{ + Ecore_Fd_Handler *fdh; + Eina_List *l, *l2; + + /* call the prepare callback for all handlers with prep functions */ + EINA_LIST_FOREACH_SAFE(fd_handlers_with_prep, l, l2, fdh) + { + if (!fdh) + { + fd_handlers_with_prep = eina_list_remove_list(l, fd_handlers_with_prep); + continue; + } + if (!fdh->delete_me && fdh->prep_func) + { + fdh->references++; + _ecore_call_prep_cb(fdh->prep_func, fdh->prep_data, fdh); + fdh->references--; + } + else + fd_handlers_with_prep = eina_list_remove_list(fd_handlers_with_prep, l); + } +} + +#ifndef USE_G_MAIN_LOOP +static int +_ecore_main_select(double timeout) +{ + struct timeval tv, *t; + fd_set rfds, wfds, exfds; + int max_fd; + int ret; + + t = NULL; + if ((!ECORE_FINITE(timeout)) || (timeout == 0.0)) /* finite() tests for NaN, too big, too small, and infinity. */ + { + tv.tv_sec = 0; + tv.tv_usec = 0; + t = &tv; + } + else if (timeout > 0.0) + { + int sec, usec; + +#ifdef FIX_HZ + timeout += (0.5 / HZ); + sec = (int)timeout; + usec = (int)((timeout - (double)sec) * 1000000); +#else + sec = (int)timeout; + usec = (int)((timeout - (double)sec) * 1000000); +#endif + tv.tv_sec = sec; + tv.tv_usec = usec; + t = &tv; + } + max_fd = 0; + FD_ZERO(&rfds); + FD_ZERO(&wfds); + FD_ZERO(&exfds); + + /* call the prepare callback for all handlers */ + if (fd_handlers_with_prep) + _ecore_main_prepare_handlers(); + + if (!HAVE_EPOLL || epoll_fd < 0) + { + Ecore_Fd_Handler *fdh; + + EINA_INLIST_FOREACH(fd_handlers, fdh) + { + if (!fdh->delete_me) + { + if (fdh->flags & ECORE_FD_READ) + { + FD_SET(fdh->fd, &rfds); + if (fdh->fd > max_fd) max_fd = fdh->fd; + } + if (fdh->flags & ECORE_FD_WRITE) + { + FD_SET(fdh->fd, &wfds); + if (fdh->fd > max_fd) max_fd = fdh->fd; + } + if (fdh->flags & ECORE_FD_ERROR) + { + FD_SET(fdh->fd, &exfds); + if (fdh->fd > max_fd) max_fd = fdh->fd; + } + } + } + } + else + { + /* polling on the epoll fd will wake when an fd in the epoll set is active */ + max_fd = _ecore_get_epoll_fd(); + FD_SET(max_fd, &rfds); + } + + if (_ecore_signal_count_get()) return -1; + + _ecore_unlock(); + ret = main_loop_select(max_fd + 1, &rfds, &wfds, &exfds, t); + _ecore_lock(); + + _ecore_time_loop_time = ecore_time_get(); + if (ret < 0) + { +#ifndef _WIN32 + if (errno == EINTR) return -1; + else if (errno == EBADF) + _ecore_main_fd_handlers_bads_rem(); +#endif + } + if (ret > 0) + { + if (HAVE_EPOLL && epoll_fd >= 0) + _ecore_main_fdh_epoll_mark_active(); + else + { + Ecore_Fd_Handler *fdh; + + EINA_INLIST_FOREACH(fd_handlers, fdh) + { + if (!fdh->delete_me) + { + if (FD_ISSET(fdh->fd, &rfds)) + fdh->read_active = EINA_TRUE; + if (FD_ISSET(fdh->fd, &wfds)) + fdh->write_active = EINA_TRUE; + if (FD_ISSET(fdh->fd, &exfds)) + fdh->error_active = EINA_TRUE; + _ecore_try_add_to_call_list(fdh); + } + } + } + + _ecore_main_fd_handlers_cleanup(); +#ifdef _WIN32 + _ecore_main_win32_handlers_cleanup(); +#endif + return 1; + } + return 0; +} + +#endif + +#ifndef _WIN32 +# ifndef USE_G_MAIN_LOOP +static void +_ecore_main_fd_handlers_bads_rem(void) +{ + Ecore_Fd_Handler *fdh; + Eina_Inlist *l; + int found = 0; + + ERR("Removing bad fds"); + for (l = EINA_INLIST_GET(fd_handlers); l; ) + { + fdh = (Ecore_Fd_Handler *)l; + l = l->next; + errno = 0; + + if ((fcntl(fdh->fd, F_GETFD) < 0) && (errno == EBADF)) + { + ERR("Found bad fd at index %d", fdh->fd); + if (fdh->flags & ECORE_FD_ERROR) + { + ERR("Fd set for error! calling user"); + fdh->references++; + if (!_ecore_call_fd_cb(fdh->func, fdh->data, fdh)) + { + ERR("Fd function err returned 0, remove it"); + if (!fdh->delete_me) + { + fdh->delete_me = EINA_TRUE; + fd_handlers_to_delete = eina_list_append(fd_handlers_to_delete, fdh); + } + found++; + } + fdh->references--; + } + else + { + ERR("Problematic fd found at %d! setting it for delete", fdh->fd); + if (!fdh->delete_me) + { + fdh->delete_me = EINA_TRUE; + fd_handlers_to_delete = eina_list_append(fd_handlers_to_delete, fdh); + } + + found++; + } + } + } + if (found == 0) + { +# ifdef HAVE_GLIB + ERR("No bad fd found. Maybe a foreign fd from glib?"); +# else + ERR("No bad fd found. EEEK!"); +# endif + } + _ecore_main_fd_handlers_cleanup(); +} + +# endif +#endif + +static void +_ecore_main_fd_handlers_cleanup(void) +{ + Ecore_Fd_Handler *fdh; + Eina_List *l, *l2; + + if (!fd_handlers_to_delete) return; + EINA_LIST_FOREACH_SAFE(fd_handlers_to_delete, l, l2, fdh) + { + if (!fdh) + { + fd_handlers_to_delete = eina_list_remove_list(l, fd_handlers_to_delete); + continue; + } + /* fdh->delete_me should be set for all fdhs at the start of the list */ + if (fdh->references) + continue; + if (fdh->buf_func && fd_handlers_with_buffer) + fd_handlers_with_buffer = eina_list_remove(fd_handlers_with_buffer, fdh); + if (fdh->prep_func && fd_handlers_with_prep) + fd_handlers_with_prep = eina_list_remove(fd_handlers_with_prep, fdh); + fd_handlers = (Ecore_Fd_Handler *) + eina_inlist_remove(EINA_INLIST_GET(fd_handlers), EINA_INLIST_GET(fdh)); + ECORE_MAGIC_SET(fdh, ECORE_MAGIC_NONE); + free(fdh); + fd_handlers_to_delete = eina_list_remove_list(fd_handlers_to_delete, l); + } +} + +#ifdef _WIN32 +static void +_ecore_main_win32_handlers_cleanup(void) +{ + Ecore_Win32_Handler *wh; + Eina_Inlist *l; + int deleted_in_use = 0; + + if (!win32_handlers_delete_me) return; + for (l = EINA_INLIST_GET(win32_handlers); l; ) + { + wh = (Ecore_Win32_Handler *)l; + + l = l->next; + if (wh->delete_me) + { + if (wh->references) + { + deleted_in_use++; + continue; + } + + win32_handlers = (Ecore_Win32_Handler *) + eina_inlist_remove(EINA_INLIST_GET(win32_handlers), + EINA_INLIST_GET(wh)); + ECORE_MAGIC_SET(wh, ECORE_MAGIC_NONE); + free(wh); + } + } + if (!deleted_in_use) win32_handlers_delete_me = EINA_FALSE; +} + +#endif + +static void +_ecore_main_fd_handlers_call(void) +{ + /* grab a new list */ + if (!fd_handlers_to_call_current) + { + fd_handlers_to_call_current = fd_handlers_to_call; + fd_handlers_to_call = NULL; + } + + while (fd_handlers_to_call_current) + { + Ecore_Fd_Handler *fdh = fd_handlers_to_call_current; + + if (!fdh->delete_me) + { + if ((fdh->read_active) || + (fdh->write_active) || + (fdh->error_active)) + { + fdh->references++; + if (!_ecore_call_fd_cb(fdh->func, fdh->data, fdh)) + { + if (!fdh->delete_me) + { + fdh->delete_me = EINA_TRUE; + fd_handlers_to_delete = eina_list_append(fd_handlers_to_delete, fdh); + } + } + fdh->references--; + _ecore_fd_valid(); + + fdh->read_active = EINA_FALSE; + fdh->write_active = EINA_FALSE; + fdh->error_active = EINA_FALSE; + } + } + + /* stop when we point to ourselves */ + if (fdh->next_ready == fdh) + { + fdh->next_ready = NULL; + fd_handlers_to_call_current = NULL; + break; + } + + fd_handlers_to_call_current = fdh->next_ready; + fdh->next_ready = NULL; + } +} + +static int +_ecore_main_fd_handlers_buf_call(void) +{ + Ecore_Fd_Handler *fdh; + Eina_List *l, *l2; + int ret; + + ret = 0; + EINA_LIST_FOREACH_SAFE(fd_handlers_with_buffer, l, l2, fdh) + { + if (!fdh) + { + fd_handlers_with_buffer = eina_list_remove_list(l, fd_handlers_with_buffer); + continue; + } + if ((!fdh->delete_me) && fdh->buf_func) + { + fdh->references++; + if (_ecore_call_fd_cb(fdh->buf_func, fdh->buf_data, fdh)) + { + ret |= _ecore_call_fd_cb(fdh->func, fdh->data, fdh); + fdh->read_active = EINA_TRUE; + _ecore_try_add_to_call_list(fdh); + } + fdh->references--; + } + else + fd_handlers_with_buffer = eina_list_remove_list(fd_handlers_with_buffer, l); + } + return ret; +} + +#ifndef USE_G_MAIN_LOOP + +enum { + SPIN_MORE, + SPIN_RESTART, + LOOP_CONTINUE +}; + +static int +_ecore_main_loop_spin_core(void) +{ + /* as we are spinning we need to update loop time per spin */ + _ecore_time_loop_time = ecore_time_get(); + /* call all idlers, which returns false if no more idelrs exist */ + if (!_ecore_idler_all_call()) return SPIN_RESTART; + /* sneaky - drop through or if checks - the first one to succeed + * drops through and returns "continue" so further ones dont run */ + if ((_ecore_main_select(0.0) > 0) || (_ecore_event_exist()) || + (_ecore_signal_count_get() > 0) || (do_quit)) + return LOOP_CONTINUE; + /* default - spin more */ + return SPIN_MORE; +} + +static int +_ecore_main_loop_spin_no_timers(void) +{ + /* if we have idlers we HAVE to spin and handle everything + * in a polling way - spin in a tight polling loop */ + for (;; ) + { + int action = _ecore_main_loop_spin_core(); + if (action != SPIN_MORE) return action; + /* if an idler has added a timer then we need to go through + * the start of the spin cycle again to handle cases properly */ + if (_ecore_timers_exists()) return SPIN_RESTART; + } + /* just contiune handling events etc. */ + return LOOP_CONTINUE; +} + +static int +_ecore_main_loop_spin_timers(void) +{ + /* if we have idlers we HAVE to spin and handle everything + * in a polling way - spin in a tight polling loop */ + for (;; ) + { + int action = _ecore_main_loop_spin_core(); + if (action != SPIN_MORE) return action; + /* if next timer expires now or in the past - stop spinning and + * continue the mainloop walk as our "select" timeout has + * expired now */ + if (_ecore_timer_next_get() <= 0.0) return LOOP_CONTINUE; + } + /* just contiune handling events etc. */ + return LOOP_CONTINUE; +} + +static void +_ecore_fps_marker_1(void) +{ + if (!_ecore_fps_debug) return; + t2 = ecore_time_get(); + if ((t1 > 0.0) && (t2 > 0.0)) _ecore_fps_debug_runtime_add(t2 - t1); +} + +static void +_ecore_fps_marker_2(void) +{ + if (!_ecore_fps_debug) return; + t1 = ecore_time_get(); +} + +static void +_ecore_main_loop_iterate_internal(int once_only) +{ + double next_time = -1.0; + + in_main_loop++; + /* expire any timers */ + _ecore_timer_expired_timers_call(_ecore_time_loop_time); + _ecore_timer_cleanup(); + + /* process signals into events .... */ + _ecore_signal_received_process(); + /* if as a result of timers/animators or signals we have accumulated + * events, then instantly handle them */ + if (_ecore_event_exist()) + { + /* but first conceptually enter an idle state */ + _ecore_idle_enterer_call(); + _ecore_throttle(); + /* now quickly poll to see which input fd's are active */ + _ecore_main_select(0.0); + /* allow newly queued timers to expire from now on */ + _ecore_timer_enable_new(); + /* go straight to processing the events we had queued */ + goto process_all; + } + + if (once_only) + { + /* in once_only mode we should quickly poll for inputs, signals + * if we got any events or signals, allow new timers to process. + * use bitwise or to force both conditions to be tested and + * merged together */ + if (_ecore_main_select(0.0) | _ecore_signal_count_get()) + { + _ecore_timer_enable_new(); + goto process_all; + } + } + else + { + /* call idle enterers ... */ + _ecore_idle_enterer_call(); + _ecore_throttle(); + } + + /* if these calls caused any buffered events to appear - deal with them */ + if (fd_handlers_with_buffer) + _ecore_main_fd_handlers_buf_call(); + + /* if there are any (buffered fd handling may generate them) + * then jump to processing them */ + if (_ecore_event_exist()) + { + _ecore_main_select(0.0); + _ecore_timer_enable_new(); + goto process_all; + } + + if (once_only) + { + /* in once_only mode enter idle here instead and then return */ + _ecore_idle_enterer_call(); + _ecore_throttle(); + _ecore_timer_enable_new(); + goto done; + } + + _ecore_fps_marker_1(); + + /* start of the sleeping or looping section */ +start_loop: /***************************************************************/ + /* any timers re-added as a result of these are allowed to go */ + _ecore_timer_enable_new(); + /* if we have been asked to quit the mainloop then exit at this point */ + if (do_quit) + { + _ecore_timer_enable_new(); + goto done; + } + if (!_ecore_event_exist()) + { + /* init flags */ + next_time = _ecore_timer_next_get(); + /* no idlers */ + if (!_ecore_idler_exist()) + { + /* sleep until timeout or forever (-1.0) waiting for on fds */ + _ecore_main_select(next_time); + } + else + { + int action = LOOP_CONTINUE; + + /* no timers - spin */ + if (next_time < 0) action = _ecore_main_loop_spin_no_timers(); + /* timers - spin */ + else action = _ecore_main_loop_spin_timers(); + if (action == SPIN_RESTART) goto start_loop; + } + } + _ecore_fps_marker_2(); + + /* actually wake up and deal with input, events etc. */ +process_all: /***********************************************************/ + + /* we came out of our "wait state" so idle has exited */ + if (!once_only) _ecore_idle_exiter_call(); + /* call the fd handler per fd that became alive... */ + /* this should read or write any data to the monitored fd and then */ + /* post events onto the ecore event pipe if necessary */ + _ecore_main_fd_handlers_call(); + if (fd_handlers_with_buffer) _ecore_main_fd_handlers_buf_call(); + /* process signals into events .... */ + _ecore_signal_received_process(); + /* handle events ... */ + _ecore_event_call(); + _ecore_main_fd_handlers_cleanup(); + + if (once_only) + { + /* if in once_only mode handle idle exiting */ + _ecore_idle_enterer_call(); + _ecore_throttle(); + } + +done: /*******************************************************************/ + in_main_loop--; +} + +#endif + +#ifdef _WIN32 +static int +_ecore_main_win32_select(int nfds __UNUSED__, + fd_set *readfds, + fd_set *writefds, + fd_set *exceptfds, + struct timeval *tv) +{ + HANDLE objects[MAXIMUM_WAIT_OBJECTS]; + int sockets[MAXIMUM_WAIT_OBJECTS]; + Ecore_Fd_Handler *fdh; + Ecore_Win32_Handler *wh; + unsigned int objects_nbr = 0; + unsigned int handles_nbr = 0; + unsigned int events_nbr = 0; + DWORD result; + DWORD timeout; + MSG msg; + unsigned int i; + int res; + + /* Create an event object per socket */ + EINA_INLIST_FOREACH(fd_handlers, fdh) + { + WSAEVENT event; + long network_event; + + network_event = 0; + if (FD_ISSET(fdh->fd, readfds)) + network_event |= FD_READ; + if (FD_ISSET(fdh->fd, writefds)) + network_event |= FD_WRITE; + if (FD_ISSET(fdh->fd, exceptfds)) + network_event |= FD_OOB; + + if (network_event) + { + event = WSACreateEvent(); + WSAEventSelect(fdh->fd, event, network_event); + objects[objects_nbr] = event; + sockets[events_nbr] = fdh->fd; + events_nbr++; + objects_nbr++; + } + } + + /* store the HANDLEs in the objects to wait for */ + EINA_INLIST_FOREACH(win32_handlers, wh) + { + objects[objects_nbr] = wh->h; + handles_nbr++; + objects_nbr++; + } + + /* Empty the queue before waiting */ + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + /* Wait for any message sent or posted to this queue */ + /* or for one of the passed handles be set to signaled. */ + if (!tv) + timeout = INFINITE; + else + timeout = (DWORD)((tv->tv_sec * 1000.0) + (tv->tv_usec / 1000.0)); + + if (timeout == 0) return 0; + + result = MsgWaitForMultipleObjects(objects_nbr, (const HANDLE *)objects, EINA_FALSE, + timeout, QS_ALLINPUT); + + FD_ZERO(readfds); + FD_ZERO(writefds); + FD_ZERO(exceptfds); + + /* The result tells us the type of event we have. */ + if (result == WAIT_FAILED) + { + char *m; + + m = evil_last_error_get(); + ERR(" * %s\n", m); + free(m); + res = -1; + } + else if (result == WAIT_TIMEOUT) + { + /* ERR("time out\n"); */ + res = 0; + } + else if (result == (WAIT_OBJECT_0 + objects_nbr)) + { + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + + res = 0; + } + else if ((result >= 0) && (result < WAIT_OBJECT_0 + events_nbr)) + { + WSANETWORKEVENTS network_event; + + WSAEnumNetworkEvents(sockets[result], objects[result], &network_event); + + if (network_event.lNetworkEvents & FD_READ) + FD_SET(sockets[result], readfds); + if (network_event.lNetworkEvents & FD_WRITE) + FD_SET(sockets[result], writefds); + if (network_event.lNetworkEvents & FD_OOB) + FD_SET(sockets[result], exceptfds); + + res = 1; + } + else if ((result >= (WAIT_OBJECT_0 + events_nbr)) && + (result < (WAIT_OBJECT_0 + objects_nbr))) + { + if (!win32_handler_current) + { + /* regular main loop, start from head */ + win32_handler_current = win32_handlers; + } + else + { + /* recursive main loop, continue from where we were */ + win32_handler_current = (Ecore_Win32_Handler *)EINA_INLIST_GET(win32_handler_current)->next; + } + + while (win32_handler_current) + { + wh = win32_handler_current; + + if (objects[result - WAIT_OBJECT_0] == wh->h) + { + if (!wh->delete_me) + { + wh->references++; + if (!wh->func(wh->data, wh)) + { + wh->delete_me = EINA_TRUE; + win32_handlers_delete_me = EINA_TRUE; + } + wh->references--; + } + } + if (win32_handler_current) /* may have changed in recursive main loops */ + win32_handler_current = (Ecore_Win32_Handler *)EINA_INLIST_GET(win32_handler_current)->next; + } + res = 1; + } + else + { + ERR("unknown result...\n"); + res = -1; + } + + /* Remove event objects again */ + for (i = 0; i < events_nbr; i++) WSACloseEvent(objects[i]); + + return res; +} + +#endif diff --git a/libraries/ecore/src/lib/ecore/ecore_pipe.c b/libraries/ecore/src/lib/ecore/ecore_pipe.c new file mode 100644 index 0000000..0ab7dd0 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_pipe.c @@ -0,0 +1,682 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#ifdef HAVE_ISFINITE +# define ECORE_FINITE(t) isfinite(t) +#else +# ifdef _MSC_VER +# define ECORE_FINITE(t) _finite(t) +# else +# define ECORE_FINITE(t) finite(t) +# endif +#endif + +#define FIX_HZ 1 + +#ifdef FIX_HZ +# ifndef _MSC_VER +# include +# endif +# ifndef HZ +# define HZ 100 +# endif +#endif + +#ifdef HAVE_EVIL +# include +#endif + +#ifdef HAVE_ESCAPE +# include +#endif + +#include "Ecore.h" +#include "ecore_private.h" + +#ifdef _WIN32 +# define FMT_SSIZE_T "%Id" +#else +# define FMT_SSIZE_T "%zd" +#endif + +/* How of then we should retry to write to the pipe */ +#define ECORE_PIPE_WRITE_RETRY 6 + +/* + * On Windows, pipe() is implemented with sockets. + * Contrary to Linux, Windows uses different functions + * for sockets and fd's: write() is for fd's and send + * is for sockets. So I need to put some win32 code + * here. I can't think of a solution where the win32 + * code is in Evil and not here. + */ + +#ifdef _WIN32 + +# include + +# define pipe_write(fd, buffer, size) send((fd), (char *)(buffer), size, 0) +# define pipe_read(fd, buffer, size) recv((fd), (char *)(buffer), size, 0) +# define pipe_close(fd) closesocket(fd) +# define PIPE_FD_INVALID INVALID_SOCKET +# define PIPE_FD_ERROR SOCKET_ERROR + +#else + +# include +# include + +# define pipe_write(fd, buffer, size) write((fd), buffer, size) +# define pipe_read(fd, buffer, size) read((fd), buffer, size) +# define pipe_close(fd) close(fd) +# define PIPE_FD_INVALID -1 +# define PIPE_FD_ERROR -1 + +#endif /* ! _WIN32 */ + +struct _Ecore_Pipe +{ + ECORE_MAGIC; + int fd_read; + int fd_write; + Ecore_Fd_Handler *fd_handler; + const void *data; + Ecore_Pipe_Cb handler; + unsigned int len; + int handling; + size_t already_read; + void *passed_data; + int message; + Eina_Bool delete_me : 1; +}; + +static Eina_Bool _ecore_pipe_read(void *data, + Ecore_Fd_Handler *fd_handler); + +/** + * @addtogroup Ecore_Pipe_Group + * + * @{ + */ + +/** + * Create two file descriptors (sockets on Windows). Add + * a callback that will be called when the file descriptor that + * is listened receives data. An event is also put in the event + * queue when data is received. + * + * @param handler The handler called when data is received. + * @param data Data to pass to @p handler when it is called. + * @return A newly created Ecore_Pipe object if successful. + * @c NULL otherwise. + */ +EAPI Ecore_Pipe * +ecore_pipe_add(Ecore_Pipe_Cb handler, + const void *data) +{ + Ecore_Pipe *p; + int fds[2]; + + if (!handler) return NULL; + + p = (Ecore_Pipe *)calloc(1, sizeof(Ecore_Pipe)); + if (!p) return NULL; + + if (pipe(fds)) + { + free(p); + return NULL; + } + + ECORE_MAGIC_SET(p, ECORE_MAGIC_PIPE); + p->fd_read = fds[0]; + p->fd_write = fds[1]; + p->handler = handler; + p->data = data; + + fcntl(p->fd_read, F_SETFL, O_NONBLOCK); + p->fd_handler = ecore_main_fd_handler_add(p->fd_read, + ECORE_FD_READ, + _ecore_pipe_read, + p, + NULL, NULL); + return p; +} + +/** + * Free an Ecore_Pipe object created with ecore_pipe_add(). + * + * @param p The Ecore_Pipe object to be freed. + * @return The pointer to the private data + */ +EAPI void * +ecore_pipe_del(Ecore_Pipe *p) +{ + void *data; + + if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE)) + { + ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_del"); + return NULL; + } + p->delete_me = EINA_TRUE; + if (p->handling > 0) return (void *)p->data; + if (p->fd_handler) _ecore_main_fd_handler_del(p->fd_handler); + if (p->fd_read != PIPE_FD_INVALID) pipe_close(p->fd_read); + if (p->fd_write != PIPE_FD_INVALID) pipe_close(p->fd_write); + data = (void *)p->data; + free(p); + return data; +} + +/** + * Close the read end of an Ecore_Pipe object created with ecore_pipe_add(). + * + * @param p The Ecore_Pipe object. + */ +EAPI void +ecore_pipe_read_close(Ecore_Pipe *p) +{ + if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE)) + { + ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_read_close"); + return; + } + if (p->fd_handler) + { + _ecore_main_fd_handler_del(p->fd_handler); + p->fd_handler = NULL; + } + if (p->fd_read != PIPE_FD_INVALID) + { + pipe_close(p->fd_read); + p->fd_read = PIPE_FD_INVALID; + } +} + +/** + * Stop monitoring if necessary the pipe for reading. See ecore_pipe_thaw() + * for monitoring it again. + * + * @param p The Ecore_Pipe object. + * @since 1.1 + */ +EAPI void +ecore_pipe_freeze(Ecore_Pipe *p) +{ + if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE)) + { + ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_read_freeze"); + return; + } + if (p->fd_handler) + { + _ecore_main_fd_handler_del(p->fd_handler); + p->fd_handler = NULL; + } +} + +/** + * Start monitoring again the pipe for reading. See ecore_pipe_freeze() for + * stopping the monitoring activity. This will not work if + * ecore_pipe_read_close() was previously called on the same pipe. + * + * @param p The Ecore_Pipe object. + * @since 1.1 + */ +EAPI void +ecore_pipe_thaw(Ecore_Pipe *p) +{ + if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE)) + { + ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_read_thaw"); + return; + } + if (!p->fd_handler && p->fd_read != PIPE_FD_INVALID) + { + p->fd_handler = ecore_main_fd_handler_add(p->fd_read, + ECORE_FD_READ, + _ecore_pipe_read, + p, + NULL, NULL); + } +} + +/** + * @brief Wait from another thread on the read side of a pipe. + * + * @param p The pipe to watch on. + * @param message_count The minimal number of message to wait before exiting. + * @param wait The amount of time in second to wait before exiting. + * @return the number of message catched during that wait call. + * @since 1.1 + * + * Negative value for @p wait means infite wait. + */ +EAPI int +ecore_pipe_wait(Ecore_Pipe *p, + int message_count, + double wait) +{ + struct timeval tv, *t; + fd_set rset; + double end = 0.0; + double timeout; + int ret; + int total = 0; + + if (p->fd_read == PIPE_FD_INVALID) + return -1; + + FD_ZERO(&rset); + FD_SET(p->fd_read, &rset); + + if (wait >= 0.0) + end = ecore_time_get() + wait; + timeout = wait; + + while (message_count > 0 && (timeout > 0.0 || wait <= 0.0)) + { + if (wait >= 0.0) + { + /* finite() tests for NaN, too big, too small, and infinity. */ + if ((!ECORE_FINITE(timeout)) || (timeout == 0.0)) + { + tv.tv_sec = 0; + tv.tv_usec = 0; + } + else if (timeout > 0.0) + { + int sec, usec; +#ifdef FIX_HZ + timeout += (0.5 / HZ); + sec = (int)timeout; + usec = (int)((timeout - (double)sec) * 1000000); +#else + sec = (int)timeout; + usec = (int)((timeout - (double)sec) * 1000000); +#endif + tv.tv_sec = sec; + tv.tv_usec = usec; + } + t = &tv; + } + else + { + t = NULL; + } + + ret = main_loop_select(p->fd_read + 1, &rset, NULL, NULL, t); + + if (ret > 0) + { + _ecore_pipe_read(p, NULL); + message_count -= p->message; + total += p->message; + p->message = 0; + } + else if (ret == 0) + { + break; + } + else if (errno != EINTR) + { + close(p->fd_read); + p->fd_read = PIPE_FD_INVALID; + break; + } + + if (wait >= 0.0) + timeout = end - ecore_time_get(); + } + + return total; +} + +/** + * Close the write end of an Ecore_Pipe object created with ecore_pipe_add(). + * + * @param p The Ecore_Pipe object. + */ +EAPI void +ecore_pipe_write_close(Ecore_Pipe *p) +{ + if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE)) + { + ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_write_close"); + return; + } + if (p->fd_write != PIPE_FD_INVALID) + { + pipe_close(p->fd_write); + p->fd_write = PIPE_FD_INVALID; + } +} + +/** + * Write on the file descriptor the data passed as parameter. + * + * @param p The Ecore_Pipe object. + * @param buffer The data to write into the pipe. + * @param nbytes The size of the @p buffer in bytes + * @return Returns EINA_TRUE on a successful write, EINA_FALSE on an error + */ +EAPI Eina_Bool +ecore_pipe_write(Ecore_Pipe *p, + const void *buffer, + unsigned int nbytes) +{ + ssize_t ret; + size_t already_written = 0; + int retry = ECORE_PIPE_WRITE_RETRY; + + if (!ECORE_MAGIC_CHECK(p, ECORE_MAGIC_PIPE)) + { + ECORE_MAGIC_FAIL(p, ECORE_MAGIC_PIPE, "ecore_pipe_write"); + return EINA_FALSE; + } + + if (p->delete_me) return EINA_FALSE; + + if (p->fd_write == PIPE_FD_INVALID) return EINA_FALSE; + + /* First write the len into the pipe */ + do + { + ret = pipe_write(p->fd_write, &nbytes, sizeof(nbytes)); + if (ret == sizeof(nbytes)) + { + retry = ECORE_PIPE_WRITE_RETRY; + break; + } + else if (ret > 0) + { + /* XXX What should we do here? */ + ERR("The length of the data was not written complete" + " to the pipe"); + return EINA_FALSE; + } + else if (ret == PIPE_FD_ERROR && errno == EPIPE) + { + pipe_close(p->fd_write); + p->fd_write = PIPE_FD_INVALID; + return EINA_FALSE; + } + else if (ret == PIPE_FD_ERROR && errno == EINTR) + /* try it again */ + ; + else + { + ERR("An unhandled error (ret: " FMT_SSIZE_T " errno: %d)" + "occurred while writing to the pipe the length", + ret, errno); + } + } + while (retry--); + + if (retry != ECORE_PIPE_WRITE_RETRY) return EINA_FALSE; + + /* and now pass the data to the pipe */ + do + { + ret = pipe_write(p->fd_write, + ((unsigned char *)buffer) + already_written, + nbytes - already_written); + + if (ret == (ssize_t)(nbytes - already_written)) + return EINA_TRUE; + else if (ret >= 0) + { + already_written -= ret; + continue; + } + else if (ret == PIPE_FD_ERROR && errno == EPIPE) + { + pipe_close(p->fd_write); + p->fd_write = PIPE_FD_INVALID; + return EINA_FALSE; + } + else if (ret == PIPE_FD_ERROR && errno == EINTR) + /* try it again */ + ; + else + { + ERR("An unhandled error (ret: " FMT_SSIZE_T " errno: %d)" + "occurred while writing to the pipe the length", + ret, errno); + } + } + while (retry--); + + return EINA_FALSE; +} + +/** + * @} + */ + +/* Private function */ +static void +_ecore_pipe_unhandle(Ecore_Pipe *p) +{ + p->handling--; + if (p->delete_me) + { + ecore_pipe_del(p); + } +} + +static Eina_Bool +_ecore_pipe_read(void *data, + Ecore_Fd_Handler *fd_handler __UNUSED__) +{ + Ecore_Pipe *p = (Ecore_Pipe *)data; + int i; + + p->handling++; + for (i = 0; i < 16; i++) + { + ssize_t ret; + + /* if we already have read some data we don't need to read the len + * but to finish the already started job + */ + if (p->len == 0) + { + /* read the len of the passed data */ + ret = pipe_read(p->fd_read, &p->len, sizeof(p->len)); + + /* catch the non error case first */ + /* read amount ok - nothing more to do */ + if (ret == sizeof(p->len)) + ; + else if (ret > 0) + { + /* we got more data than we asked for - definite error */ + ERR("Only read %i bytes from the pipe, although" + " we need to read %i bytes.", + (int)ret, (int)sizeof(p->len)); + _ecore_pipe_unhandle(p); + return ECORE_CALLBACK_CANCEL; + } + else if (ret == 0) + { + /* we got no data */ + if (i == 0) + { + /* no data on first try through means an error */ + if (!p->delete_me) + p->handler((void *)p->data, NULL, 0); + if (p->passed_data) free(p->passed_data); + p->passed_data = NULL; + p->already_read = 0; + p->len = 0; + p->message++; + pipe_close(p->fd_read); + p->fd_read = PIPE_FD_INVALID; + p->fd_handler = NULL; + _ecore_pipe_unhandle(p); + return ECORE_CALLBACK_CANCEL; + } + else + { + /* no data after first loop try is ok */ + _ecore_pipe_unhandle(p); + return ECORE_CALLBACK_RENEW; + } + } +#ifndef _WIN32 + else if ((ret == PIPE_FD_ERROR) && + ((errno == EINTR) || (errno == EAGAIN))) + { + _ecore_pipe_unhandle(p); + return ECORE_CALLBACK_RENEW; + } + else + { + ERR("An unhandled error (ret: %i errno: %i [%s])" + "occurred while reading from the pipe the length", + (int)ret, errno, strerror(errno)); + _ecore_pipe_unhandle(p); + return ECORE_CALLBACK_RENEW; + } +#else + else /* ret == PIPE_FD_ERROR is the only other case on Windows */ + { + if (WSAGetLastError() != WSAEWOULDBLOCK) + { + if (!p->delete_me) + p->handler((void *)p->data, NULL, 0); + if (p->passed_data) free(p->passed_data); + p->passed_data = NULL; + p->already_read = 0; + p->len = 0; + p->message++; + pipe_close(p->fd_read); + p->fd_read = PIPE_FD_INVALID; + p->fd_handler = NULL; + _ecore_pipe_unhandle(p); + return ECORE_CALLBACK_CANCEL; + } + } +#endif + } + + /* if somehow we got less than or equal to 0 we got an errnoneous + * messages so call callback with null and len we got. this case should + * never happen */ + if (p->len == 0) + { + if (!p->delete_me) + p->handler((void *)p->data, NULL, 0); + /* reset all values to 0 */ + if (p->passed_data) free(p->passed_data); + p->passed_data = NULL; + p->already_read = 0; + p->len = 0; + p->message++; + _ecore_pipe_unhandle(p); + return ECORE_CALLBACK_RENEW; + } + + /* we dont have a buffer to hold the data, so alloc it */ + if (!p->passed_data) + { + p->passed_data = malloc(p->len); + /* alloc failed - error case */ + if (!p->passed_data) + { + if (!p->delete_me) + p->handler((void *)p->data, NULL, 0); + /* close the pipe */ + p->already_read = 0; + p->len = 0; + p->message++; + pipe_close(p->fd_read); + p->fd_read = PIPE_FD_INVALID; + p->fd_handler = NULL; + _ecore_pipe_unhandle(p); + return ECORE_CALLBACK_CANCEL; + } + } + + /* and read the passed data */ + ret = pipe_read(p->fd_read, + ((unsigned char *)p->passed_data) + p->already_read, + p->len - p->already_read); + + /* catch the non error case first */ + /* if we read enough data to finish the message/buffer */ + if (ret == (ssize_t)(p->len - p->already_read)) + { + if (!p->delete_me) + p->handler((void *)p->data, p->passed_data, p->len); + free(p->passed_data); + /* reset all values to 0 */ + p->passed_data = NULL; + p->already_read = 0; + p->len = 0; + p->message++; + } + else if (ret > 0) + { + /* more data left to read */ + p->already_read += ret; + _ecore_pipe_unhandle(p); + return ECORE_CALLBACK_RENEW; + } + else if (ret == 0) + { + /* 0 bytes to read - could be more to read next select wake up */ + _ecore_pipe_unhandle(p); + return ECORE_CALLBACK_RENEW; + } +#ifndef _WIN32 + else if ((ret == PIPE_FD_ERROR) && + ((errno == EINTR) || (errno == EAGAIN))) + { + _ecore_pipe_unhandle(p); + return ECORE_CALLBACK_RENEW; + } + else + { + ERR("An unhandled error (ret: %zd errno: %d)" + "occurred while reading from the pipe the data", + ret, errno); + _ecore_pipe_unhandle(p); + return ECORE_CALLBACK_RENEW; + } +#else + else /* ret == PIPE_FD_ERROR is the only other case on Windows */ + { + if (WSAGetLastError() != WSAEWOULDBLOCK) + { + if (!p->delete_me) + p->handler((void *)p->data, NULL, 0); + if (p->passed_data) free(p->passed_data); + p->passed_data = NULL; + p->already_read = 0; + p->len = 0; + p->message++; + pipe_close(p->fd_read); + p->fd_read = PIPE_FD_INVALID; + p->fd_handler = NULL; + _ecore_pipe_unhandle(p); + return ECORE_CALLBACK_CANCEL; + } + else + break; + } +#endif + } + + _ecore_pipe_unhandle(p); + return ECORE_CALLBACK_RENEW; +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_poll.c b/libraries/ecore/src/lib/ecore/ecore_poll.c new file mode 100644 index 0000000..a283cb5 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_poll.c @@ -0,0 +1,440 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "Ecore.h" +#include "ecore_private.h" + +struct _Ecore_Poller +{ + EINA_INLIST; + ECORE_MAGIC; + int ibit; + unsigned char delete_me : 1; + Ecore_Task_Cb func; + void *data; +}; + +static Ecore_Timer *timer = NULL; +static int min_interval = -1; +static int interval_incr = 0; +static int at_tick = 0; +static int just_added_poller = 0; +static int poller_delete_count = 0; +static int poller_walking = 0; +static double poll_interval = 0.125; +static double poll_cur_interval = 0.0; +static double last_tick = 0.0; +static Ecore_Poller *pollers[16] = +{ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL +}; +static unsigned short poller_counters[16] = +{ + 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0 +}; + +static void _ecore_poller_next_tick_eval(void); +static Eina_Bool _ecore_poller_cb_timer(void *data); + +static void +_ecore_poller_next_tick_eval(void) +{ + int i; + double interval; + + min_interval = -1; + for (i = 0; i < 15; i++) + { + if (pollers[i]) + { + min_interval = i; + break; + } + } + if (min_interval < 0) + { + /* no pollers */ + if (timer) + { + ecore_timer_del(timer); + timer = NULL; + } + return; + } + interval_incr = (1 << min_interval); + interval = interval_incr * poll_interval; + /* we are at the tick callback - so no need to do inter-tick adjustments + * so we can fasttrack this as t -= last_tick in theory is 0.0 (though + * in practice it will be a very very very small value. also the tick + * callback will adjust the timer interval at the end anyway */ + if (at_tick) + { + if (!timer) + timer = ecore_timer_add(interval, _ecore_poller_cb_timer, NULL); + } + else + { + double t; + + if (!timer) + timer = ecore_timer_add(interval, _ecore_poller_cb_timer, NULL); + else + { + t = ecore_time_get(); + if (interval != poll_cur_interval) + { + t -= last_tick; /* time since we last ticked */ + /* delete the timer and reset it to tick off in the new + * time interval. at the tick this will be adjusted */ + ecore_timer_del(timer); + timer = ecore_timer_add(interval - t, + _ecore_poller_cb_timer, NULL); + } + } + } + poll_cur_interval = interval; +} + +static Eina_Bool +_ecore_poller_cb_timer(void *data __UNUSED__) +{ + int i; + Ecore_Poller *poller, *l; + int changes = 0; + + at_tick++; + last_tick = ecore_time_get(); + /* we have 16 counters - each incriments every time the poller counter + * "ticks". it incriments by the minimum interval (which can be 1, 2, 4, + * 7, 16 etc. up to 32768) */ + for (i = 0; i < 15; i++) + { + poller_counters[i] += interval_incr; + /* wrap back to 0 if we exceed out loop count for the counter */ + if (poller_counters[i] >= (1 << i)) poller_counters[i] = 0; + } + + just_added_poller = 0; + /* walk the pollers now */ + poller_walking++; + for (i = 0; i < 15; i++) + { + /* if the counter is @ 0 - this means that counter "went off" this + * tick interval, so run all pollers hooked to that counter */ + if (poller_counters[i] == 0) + { + EINA_INLIST_FOREACH(pollers[i], poller) + { + if (!poller->delete_me) + { + if (!poller->func(poller->data)) + { + if (!poller->delete_me) + { + poller->delete_me = 1; + poller_delete_count++; + } + } + } + } + } + } + poller_walking--; + + /* handle deletes afterwards */ + if (poller_delete_count > 0) + { + /* FIXME: walk all pollers and remove deleted ones */ + for (i = 0; i < 15; i++) + { + for (l = pollers[i]; l; ) + { + poller = l; + l = (Ecore_Poller *)EINA_INLIST_GET(l)->next; + if (poller->delete_me) + { + pollers[i] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(poller)); + free(poller); + poller_delete_count--; + changes++; + if (poller_delete_count <= 0) break; + } + } + if (poller_delete_count <= 0) break; + } + } + /* if we deleted or added any pollers, then we need to re-evaluate our + * minimum poll interval */ + if ((changes > 0) || (just_added_poller > 0)) + _ecore_poller_next_tick_eval(); + + just_added_poller = 0; + poller_delete_count = 0; + + at_tick--; + + /* if the timer was deleted then there is no point returning 1 - ambiguous + * if we do as it im plies "keep running me" but we have been deleted + * anyway */ + if (!timer) return ECORE_CALLBACK_CANCEL; + + /* adjust interval */ + ecore_timer_interval_set(timer, poll_cur_interval); + return ECORE_CALLBACK_RENEW; +} + +/** + * @addtogroup Ecore_Poller_Group + * + * @{ + */ + +/** + * Sets the time between ticks (in seconds) for the given ticker clock. + * @param type The ticker type to adjust + * @param poll_time The time (in seconds) between ticks of the clock + * + * This will adjust the time between ticks of the given ticker type defined + * by @p type to the time period defined by @p poll_time. + */ +EAPI void +ecore_poller_poll_interval_set(Ecore_Poller_Type type __UNUSED__, + double poll_time) +{ + poll_interval = poll_time; + _ecore_poller_next_tick_eval(); +} + +/** + * Gets the time between ticks (in seconds) for the given ticker clock. + * @param type The ticker type to query + * @return The time in seconds between ticks of the ticker clock + * + * This will get the time between ticks of the specifider ticker clock. + */ +EAPI double +ecore_poller_poll_interval_get(Ecore_Poller_Type type __UNUSED__) +{ + return poll_interval; +} + +/** + * Creates a poller to call the given function at a particular tick interval. + * @param type The ticker type to attach the poller to + * @param interval The poll interval + * @param func The given function. If @p func returns 1, the poller is + * rescheduled for the next tick interval. + * @param data Data to pass to @p func when it is called. + * @return A poller object on success. @c NULL on failure. + * + * This function adds a poller callback that is to be called regularly + * along with all other poller callbacks so the pollers are synchronized with + * all other pollers running off the same poller type and at the same tick + * interval. This should be used for polling things when polling is desired + * or required, and you do not have specific requirements on the exact times + * to poll and want to avoid extra process wakeups for polling. This will + * save power as the CPU has more of a chance to go into a low power state + * the longer it is asleep for, so this should be used if you are at all + * power conscious. + * + * The @p type parameter defines the poller tick type (there is a virtual + * clock ticking all the time - though ecore avoids making it tick when + * there will not be any work to do at that tick point). There is only one + * ticker at the moment - that is ECORE_POLLER_CORE. This is here for future + * expansion if multiple clocks with different frequencies are really required. + * The default time between ticks for the ECORE_POLLER_CORE ticker is 0.125 + * seconds. + * + * The @p interval is the number of ticker ticks that will pass by in between + * invocations of the @p func callback. This must be between 1 and 32768 + * inclusive, and must be a power of 2 (i.e. 1, 2, 4, 8, 16, ... 16384, 32768). + * If it is 1, then the function will be called every tick. if it is 2, then it + * will be called every 2nd tick, if it is 8, then every 8th tick etc. Exactly + * which tick is undefined, as only the interval between calls can be defined. + * Ecore will endeavour to keep pollers synchronised and to call as many in + * 1 wakeup event as possible. + * + * This function adds a poller and returns its handle on success and NULL on + * failure. The function @p func will be called at tick intervals described + * above. The function will be passed the @p data pointer as its parameter. + * + * When the poller @p func is called, it must return a value of either + * 1 (or ECORE_CALLBACK_RENEW) or 0 (or ECORE_CALLBACK_CANCEL). If it + * returns 1, it will be called again at the next tick, or if it returns + * 0 it will be deleted automatically making any references/handles for it + * invalid. + */ +EAPI Ecore_Poller * +ecore_poller_add(Ecore_Poller_Type type __UNUSED__, + int interval, + Ecore_Task_Cb func, + const void *data) +{ + Ecore_Poller *poller; + int ibit; + + if (!func) return NULL; + if (interval < 1) interval = 1; + + poller = calloc(1, sizeof(Ecore_Poller)); + if (!poller) return NULL; + ECORE_MAGIC_SET(poller, ECORE_MAGIC_POLLER); + /* interval MUST be a power of 2, so enforce it */ + if (interval < 1) interval = 1; + ibit = -1; + while (interval != 0) + { + ibit++; + interval >>= 1; + } + /* only allow up to 32768 - i.e. ibit == 15, so limit it */ + if (ibit > 15) ibit = 15; + + poller->ibit = ibit; + poller->func = func; + poller->data = (void *)data; + pollers[poller->ibit] = (Ecore_Poller *)eina_inlist_prepend(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller)); + if (poller_walking) + just_added_poller++; + else + _ecore_poller_next_tick_eval(); + return poller; +} + +/** + * Changes the polling interval rate of @p poller. + * + * @param poller The Ecore_Poller to change the interval of + * @param interval The tick interval to set; must be a power of 2 but <= 32768 + * @return Returns true on success, false on failure + * + * This allows the changing of a poller's polling interval. It is useful when you want to alter + * a poll rate without deleting and re-creating a poller. + */ +EAPI Eina_Bool +ecore_poller_poller_interval_set(Ecore_Poller *poller, + int interval) +{ + int ibit; + + if (!ECORE_MAGIC_CHECK(poller, ECORE_MAGIC_POLLER)) + { + ECORE_MAGIC_FAIL(poller, ECORE_MAGIC_POLLER, + "ecore_poller_poller_interval_set"); + return EINA_FALSE; + } + + /* interval MUST be a power of 2, so enforce it */ + if (interval < 1) interval = 1; + ibit = -1; + while (interval != 0) + { + ibit++; + interval >>= 1; + } + /* only allow up to 32768 - i.e. ibit == 15, so limit it */ + if (ibit > 15) ibit = 15; + /* if interval specified is the same as interval set, return true without wasting time */ + if (poller->ibit == ibit) + return EINA_TRUE; + pollers[poller->ibit] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller)); + poller->ibit = ibit; + pollers[poller->ibit] = (Ecore_Poller *)eina_inlist_prepend(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller)); + if (poller_walking) + just_added_poller++; + else + _ecore_poller_next_tick_eval(); + return EINA_TRUE; +} + +/** + * Gets the polling interval rate of @p poller. + * + * @param poller The Ecore_Poller to change the interval of + * @return Returns the interval, in ticks, that @p poller polls at + * + * This returns a poller's polling interval, or 0 on error. + */ +EAPI int +ecore_poller_poller_interval_get(Ecore_Poller *poller) +{ + int ibit, interval = 1; + + if (!ECORE_MAGIC_CHECK(poller, ECORE_MAGIC_POLLER)) + { + ECORE_MAGIC_FAIL(poller, ECORE_MAGIC_POLLER, + "ecore_poller_poller_interval_get"); + return 0; + } + + ibit = poller->ibit; + while (ibit != 0) + { + ibit--; + interval <<= 1; + } + return interval; +} + +/** + * Delete the specified poller from the timer list. + * @param poller The poller to delete. + * @return The data pointer set for the timer when @ref ecore_poller_add was + * called. @c NULL is returned if the function is unsuccessful. + * + * Note: @p poller must be a valid handle. If the poller function has already + * returned 0, the handle is no longer valid (and does not need to be delete). + */ +EAPI void * +ecore_poller_del(Ecore_Poller *poller) +{ + void *data; + + if (!ECORE_MAGIC_CHECK(poller, ECORE_MAGIC_POLLER)) + { + ECORE_MAGIC_FAIL(poller, ECORE_MAGIC_POLLER, + "ecore_poller_del"); + return NULL; + } + /* we are walking the poller list - a bad idea to remove from it while + * walking it, so just flag it as delete_me and come back to it after + * the loop has finished */ + if (poller_walking > 0) + { + poller_delete_count++; + poller->delete_me = 1; + return poller->data; + } + /* not in loop so safe - delete immediately */ + data = poller->data; + pollers[poller->ibit] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[poller->ibit]), EINA_INLIST_GET(poller)); + free(poller); + _ecore_poller_next_tick_eval(); + return data; +} + +/** + * @} + */ + +void +_ecore_poller_shutdown(void) +{ + int i; + Ecore_Poller *poller; + + for (i = 0; i < 15; i++) + { + while ((poller = pollers[i])) + { + pollers[i] = (Ecore_Poller *)eina_inlist_remove(EINA_INLIST_GET(pollers[i]), EINA_INLIST_GET(pollers[i])); + free(poller); + } + } +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_private.h b/libraries/ecore/src/lib/ecore/ecore_private.h new file mode 100644 index 0000000..f328605 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_private.h @@ -0,0 +1,353 @@ +#ifndef _ECORE_PRIVATE_H +#define _ECORE_PRIVATE_H + +#include + +extern int _ecore_log_dom; +#ifdef _ECORE_DEFAULT_LOG_DOM +# undef _ECORE_DEFAULT_LOG_DOM +#endif +#define _ECORE_DEFAULT_LOG_DOM _ecore_log_dom + +#ifdef ECORE_DEFAULT_LOG_COLOR +# undef ECORE_DEFAULT_LOG_COLOR +#endif +#define ECORE_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__) + +#ifdef DBG +# undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__) + +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__) + +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__) + +#ifdef CRIT +# undef CRIT +#endif +#define CRIT(...) EINA_LOG_DOM_CRIT(_ECORE_DEFAULT_LOG_DOM, __VA_ARGS__) + +#ifndef PATH_MAX +# define PATH_MAX 4096 +#endif + +#ifndef MIN +# define MIN(x, y) (((x) > (y)) ? (y) : (x)) +#endif + +#ifndef MAX +# define MAX(x, y) (((x) > (y)) ? (x) : (y)) +#endif + +#ifndef ABS +# define ABS(x) ((x) < 0 ? -(x) : (x)) +#endif + +#ifndef CLAMP +# define CLAMP(x, min, max) (((x) > (max)) ? (max) : (((x) < (min)) ? (min) : (x))) +#endif + +#define EVAS_FRAME_QUEUING 1 /* for test */ + +#define READBUFSIZ 65536 + +#define ECORE_MAGIC_NONE 0x1234fedc +#define ECORE_MAGIC_EXE 0xf7e812f5 +#define ECORE_MAGIC_TIMER 0xf7d713f4 +#define ECORE_MAGIC_IDLER 0xf7c614f3 +#define ECORE_MAGIC_IDLE_ENTERER 0xf7b515f2 +#define ECORE_MAGIC_IDLE_EXITER 0xf7601afd +#define ECORE_MAGIC_FD_HANDLER 0xf7a416f1 +#define ECORE_MAGIC_EVENT_HANDLER 0xf79317f0 +#define ECORE_MAGIC_EVENT_FILTER 0xf78218ff +#define ECORE_MAGIC_EVENT 0xf77119fe +#define ECORE_MAGIC_ANIMATOR 0xf7643ea5 +#define ECORE_MAGIC_POLLER 0xf7568127 +#define ECORE_MAGIC_PIPE 0xf7458226 +#define ECORE_MAGIC_WIN32_HANDLER 0xf7e8f1a3 +#define ECORE_MAGIC_JOB 0x76543210 + +#define ECORE_MAGIC Ecore_Magic __magic + +#define ECORE_MAGIC_SET(d, m) (d)->__magic = (m) +#define ECORE_MAGIC_CHECK(d, m) ((d) && ((d)->__magic == (m))) +#define ECORE_MAGIC_FAIL(d, m, fn) _ecore_magic_fail((d), (d) ? (d)->__magic : 0, (m), (fn)); + +/* undef the following, we want our version */ +#undef FREE +#define FREE(ptr) free(ptr); ptr = NULL; + +#undef IF_FREE +#define IF_FREE(ptr) if (ptr) free(ptr); ptr = NULL; + +#undef IF_FN_DEL +#define IF_FN_DEL(_fn, ptr) if (ptr) { _fn(ptr); ptr = NULL; } + +EAPI void +ecore_print_warning(const char *function, + const char *sparam); + +/* convenience macros for checking pointer parameters for non-NULL */ +#undef CHECK_PARAM_POINTER_RETURN +#define CHECK_PARAM_POINTER_RETURN(sparam, param, ret) \ + if (!(param)) \ + { \ + ecore_print_warning(__FUNCTION__, sparam); \ + return ret; \ + } + +#undef CHECK_PARAM_POINTER +#define CHECK_PARAM_POINTER(sparam, param) \ + if (!(param)) \ + { \ + ecore_print_warning(__FUNCTION__, sparam); \ + return; \ + } + +typedef unsigned int Ecore_Magic; + +EAPI void _ecore_magic_fail(const void *d, + Ecore_Magic m, + Ecore_Magic req_m, + const char *fname); + +void _ecore_time_init(void); + +Ecore_Timer *_ecore_timer_loop_add(double in, + Ecore_Task_Cb func, + const void *data); +void *_ecore_timer_del(Ecore_Timer *timer); +void _ecore_timer_delay(Ecore_Timer *timer, + double add); +void _ecore_timer_shutdown(void); +void _ecore_timer_cleanup(void); +void _ecore_timer_enable_new(void); +double _ecore_timer_next_get(void); +void _ecore_timer_expired_timers_call(double when); +int _ecore_timers_exists(void); + +int _ecore_timer_expired_call(double when); + +void _ecore_idler_shutdown(void); +int _ecore_idler_all_call(void); +int _ecore_idler_exist(void); + +void _ecore_idle_enterer_shutdown(void); +void _ecore_idle_enterer_call(void); +int _ecore_idle_enterer_exist(void); + +void _ecore_idle_exiter_shutdown(void); +void _ecore_idle_exiter_call(void); +int _ecore_idle_exiter_exist(void); + +void _ecore_event_shutdown(void); +int _ecore_event_exist(void); +Ecore_Event *_ecore_event_add(int type, + void *ev, + Ecore_End_Cb func_free, + void *data); +void _ecore_event_call(void); +void *_ecore_event_handler_del(Ecore_Event_Handler *event_handler); + +Ecore_Timer *_ecore_exe_doomsday_clock_get(Ecore_Exe *exe); +void _ecore_exe_doomsday_clock_set(Ecore_Exe *exe, + Ecore_Timer *dc); + +EAPI void *_ecore_event_signal_user_new(void); +void *_ecore_event_signal_hup_new(void); +void *_ecore_event_signal_exit_new(void); +void *_ecore_event_signal_power_new(void); +void *_ecore_event_signal_realtime_new(void); + +void *_ecore_main_fd_handler_del(Ecore_Fd_Handler *fd_handler); + +void _ecore_main_shutdown(void); + +#if defined (_WIN32) || defined (__lv2ppu__) +static inline void _ecore_signal_shutdown(void) { } + +static inline void _ecore_signal_init(void) { } + +static inline void _ecore_signal_received_process(void) { } + +static inline int _ecore_signal_count_get(void) { return 0; } + +static inline void _ecore_signal_call(void) { } + +#else +void _ecore_signal_shutdown(void); +void _ecore_signal_init(void); +void _ecore_signal_received_process(void); +int _ecore_signal_count_get(void); +void _ecore_signal_call(void); +#endif + +void _ecore_exe_init(void); +void _ecore_exe_shutdown(void); +#ifndef _WIN32 +Ecore_Exe *_ecore_exe_find(pid_t pid); +void *_ecore_exe_event_del_new(void); +void _ecore_exe_event_del_free(void *data, + void *ev); +#endif + +void _ecore_animator_shutdown(void); + +void _ecore_poller_shutdown(void); + +void _ecore_fps_debug_init(void); +void _ecore_fps_debug_shutdown(void); +void _ecore_fps_debug_runtime_add(double t); + +void _ecore_thread_init(void); +void _ecore_thread_shutdown(void); + +void _ecore_glib_init(void); +void _ecore_glib_shutdown(void); + +void _ecore_job_init(void); +void _ecore_job_shutdown(void); + +void _ecore_main_loop_init(void); +void _ecore_main_loop_shutdown(void); + +void _ecore_throttle(void); + +extern int _ecore_main_lock_count; +extern Eina_Lock _ecore_main_loop_lock; + +static inline void +_ecore_lock(void) +{ +#ifdef HAVE_THREAD_SAFETY + eina_lock_take(&_ecore_main_loop_lock); +#else + /* at least check we're not being called from a thread */ + EINA_MAIN_LOOP_CHECK_RETURN; +#endif + _ecore_main_lock_count++; + assert(_ecore_main_lock_count == 1); +} + +static inline void +_ecore_unlock(void) +{ + _ecore_main_lock_count--; + assert(_ecore_main_lock_count == 0); +#ifdef HAVE_THREAD_SAFETY + eina_lock_release(&_ecore_main_loop_lock); +#endif +} + +/* + * Callback wrappers all assume that ecore _ecore_lock has been called + */ +static inline Eina_Bool +_ecore_call_task_cb(Ecore_Task_Cb func, + void *data) +{ + Eina_Bool r; + + _ecore_unlock(); + r = func(data); + _ecore_lock(); + + return r; +} + +static inline void * +_ecore_call_data_cb(Ecore_Data_Cb func, + void *data) +{ + void *r; + + _ecore_unlock(); + r = func(data); + _ecore_lock(); + + return r; +} + +static inline void +_ecore_call_end_cb(Ecore_End_Cb func, + void *user_data, + void *func_data) +{ + _ecore_unlock(); + func(user_data, func_data); + _ecore_lock(); +} + +static inline Eina_Bool +_ecore_call_filter_cb(Ecore_Filter_Cb func, + void *data, + void *loop_data, + int type, + void *event) +{ + Eina_Bool r; + + _ecore_unlock(); + r = func(data, loop_data, type, event); + _ecore_lock(); + + return r; +} + +static inline Eina_Bool +_ecore_call_handler_cb(Ecore_Event_Handler_Cb func, + void *data, + int type, + void *event) +{ + Eina_Bool r; + + _ecore_unlock(); + r = func(data, type, event); + _ecore_lock(); + + return r; +} + +static inline void +_ecore_call_prep_cb(Ecore_Fd_Prep_Cb func, + void *data, + Ecore_Fd_Handler *fd_handler) +{ + _ecore_unlock(); + func(data, fd_handler); + _ecore_lock(); +} + +static inline Eina_Bool +_ecore_call_fd_cb(Ecore_Fd_Cb func, + void *data, + Ecore_Fd_Handler *fd_handler) +{ + Eina_Bool r; + + _ecore_unlock(); + r = func(data, fd_handler); + _ecore_lock(); + + return r; +} + +extern int _ecore_fps_debug; +extern double _ecore_time_loop_time; +extern Eina_Bool _ecore_glib_always_integrate; +extern Ecore_Select_Function main_loop_select; + +#endif diff --git a/libraries/ecore/src/lib/ecore/ecore_signal.c b/libraries/ecore/src/lib/ecore/ecore_signal.c new file mode 100644 index 0000000..78edb8c --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_signal.c @@ -0,0 +1,565 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#include "Ecore.h" +#include "ecore_private.h" + +/* make mono happy - this is evil though... */ +#undef SIGPWR +/* valgrind in some versions/setups uses SIGRT's... hmmm */ + +typedef void (*Signal_Handler)(int sig, siginfo_t *si, void *foo); + +static void _ecore_signal_callback_set(int sig, + Signal_Handler func); +static void _ecore_signal_callback_ignore(int sig, + siginfo_t *si, + void *foo); +static void _ecore_signal_callback_sigchld(int sig, + siginfo_t *si, + void *foo); +static void _ecore_signal_callback_sigusr1(int sig, + siginfo_t *si, + void *foo); +static void _ecore_signal_callback_sigusr2(int sig, + siginfo_t *si, + void *foo); +static void _ecore_signal_callback_sighup(int sig, + siginfo_t *si, + void *foo); +static void _ecore_signal_callback_sigquit(int sig, + siginfo_t *si, + void *foo); +static void _ecore_signal_callback_sigint(int sig, + siginfo_t *si, + void *foo); +static void _ecore_signal_callback_sigterm(int sig, + siginfo_t *si, + void *foo); +#ifdef SIGPWR +static void _ecore_signal_callback_sigpwr(int sig, + siginfo_t *si, + void *foo); +#endif + +static Eina_Bool _ecore_signal_exe_exit_delay(void *data); + +//#define MAXSIGQ 256 // 32k +#define MAXSIGQ 64 // 8k + +static volatile sig_atomic_t sig_count = 0; +static volatile sig_atomic_t sigchld_count = 0; +static volatile sig_atomic_t sigusr1_count = 0; +static volatile sig_atomic_t sigusr2_count = 0; +static volatile sig_atomic_t sighup_count = 0; +static volatile sig_atomic_t sigquit_count = 0; +static volatile sig_atomic_t sigint_count = 0; +static volatile sig_atomic_t sigterm_count = 0; +#ifdef SIGPWR +static volatile sig_atomic_t sigpwr_count = 0; +#endif + +static volatile siginfo_t sigchld_info[MAXSIGQ]; +static volatile siginfo_t sigusr1_info[MAXSIGQ]; +static volatile siginfo_t sigusr2_info[MAXSIGQ]; +static volatile siginfo_t sighup_info[MAXSIGQ]; +static volatile siginfo_t sigquit_info[MAXSIGQ]; +static volatile siginfo_t sigint_info[MAXSIGQ]; +static volatile siginfo_t sigterm_info[MAXSIGQ]; +#ifdef SIGPWR +static volatile siginfo_t sigpwr_info[MAXSIGQ]; +#endif + +void +_ecore_signal_shutdown(void) +{ + _ecore_signal_callback_set(SIGPIPE, (Signal_Handler)SIG_DFL); + _ecore_signal_callback_set(SIGALRM, (Signal_Handler)SIG_DFL); + _ecore_signal_callback_set(SIGCHLD, (Signal_Handler)SIG_DFL); + _ecore_signal_callback_set(SIGUSR1, (Signal_Handler)SIG_DFL); + _ecore_signal_callback_set(SIGUSR2, (Signal_Handler)SIG_DFL); + _ecore_signal_callback_set(SIGHUP, (Signal_Handler)SIG_DFL); + _ecore_signal_callback_set(SIGQUIT, (Signal_Handler)SIG_DFL); + _ecore_signal_callback_set(SIGINT, (Signal_Handler)SIG_DFL); + _ecore_signal_callback_set(SIGTERM, (Signal_Handler)SIG_DFL); +#ifdef SIGPWR + _ecore_signal_callback_set(SIGPWR, (Signal_Handler)SIG_DFL); + sigpwr_count = 0; +#endif + sigchld_count = 0; + sigusr1_count = 0; + sigusr2_count = 0; + sighup_count = 0; + sigquit_count = 0; + sigint_count = 0; + sigterm_count = 0; + sig_count = 0; +} + +void +_ecore_signal_init(void) +{ + _ecore_signal_callback_set(SIGPIPE, _ecore_signal_callback_ignore); + _ecore_signal_callback_set(SIGALRM, _ecore_signal_callback_ignore); + _ecore_signal_callback_set(SIGCHLD, _ecore_signal_callback_sigchld); + _ecore_signal_callback_set(SIGUSR1, _ecore_signal_callback_sigusr1); + _ecore_signal_callback_set(SIGUSR2, _ecore_signal_callback_sigusr2); + _ecore_signal_callback_set(SIGHUP, _ecore_signal_callback_sighup); + _ecore_signal_callback_set(SIGQUIT, _ecore_signal_callback_sigquit); + _ecore_signal_callback_set(SIGINT, _ecore_signal_callback_sigint); + _ecore_signal_callback_set(SIGTERM, _ecore_signal_callback_sigterm); +#ifdef SIGPWR + _ecore_signal_callback_set(SIGPWR, _ecore_signal_callback_sigpwr); +#endif +} + +void +_ecore_signal_received_process(void) +{ + while (_ecore_signal_count_get()) _ecore_signal_call(); +} + +int +_ecore_signal_count_get(void) +{ + return sig_count; +} + +void +_ecore_signal_call(void) +{ + volatile sig_atomic_t n; + sigset_t oldset, newset; + + if (sig_count == 0) return; + sigemptyset(&newset); + sigaddset(&newset, SIGPIPE); + sigaddset(&newset, SIGALRM); + sigaddset(&newset, SIGCHLD); + sigaddset(&newset, SIGUSR1); + sigaddset(&newset, SIGUSR2); + sigaddset(&newset, SIGHUP); + sigaddset(&newset, SIGQUIT); + sigaddset(&newset, SIGINT); + sigaddset(&newset, SIGTERM); +#ifdef SIGPWR + sigaddset(&newset, SIGPWR); +#endif + sigprocmask(SIG_BLOCK, &newset, &oldset); + if (sigchld_count > MAXSIGQ) + WRN("%i SIGCHLD in queue. max queue size %i. losing " + "siginfo for extra signals.", sigchld_count, MAXSIGQ); + for (n = 0; n < sigchld_count; n++) + { + pid_t pid; + int status; + + while ((pid = waitpid(-1, &status, WNOHANG)) > 0) + { + Ecore_Exe_Event_Del *e; + + /* FIXME: If this process is set respawn, respawn with a suitable backoff + * period for those that need too much respawning. + */ + e = _ecore_exe_event_del_new(); + if (e) + { + if (WIFEXITED(status)) + { + e->exit_code = WEXITSTATUS(status); + e->exited = 1; + } + else if (WIFSIGNALED(status)) + { + e->exit_signal = WTERMSIG(status); + e->signalled = 1; + } + e->pid = pid; + e->exe = _ecore_exe_find(pid); + + if ((n < MAXSIGQ) && (sigchld_info[n].si_signo)) + e->data = sigchld_info[n]; /* No need to clone this. */ + + if ((e->exe) && (ecore_exe_flags_get(e->exe) & (ECORE_EXE_PIPE_READ | ECORE_EXE_PIPE_ERROR))) + { + /* We want to report the Last Words of the exe, so delay this event. + * This is twice as relevant for stderr. + * There are three possibilities here - + * 1 There are no Last Words. + * 2 There are Last Words, they are not ready to be read. + * 3 There are Last Words, they are ready to be read. + * + * For 1 we don't want to delay, for 3 we want to delay. + * 2 is the problem. If we check for data now and there + * is none, then there is no way to differentiate 1 and 2. + * If we don't delay, we may loose data, but if we do delay, + * there may not be data and the exit event never gets sent. + * + * Any way you look at it, there has to be some time passed + * before the exit event gets sent. So the strategy here is + * to setup a timer event that will send the exit event after + * an arbitrary, but brief, time. + * + * This is probably paranoid, for the less paraniod, we could + * check to see for Last Words, and only delay if there are any. + * This has it's own set of problems. + */ + Ecore_Timer *doomsday_clock; + + doomsday_clock = _ecore_exe_doomsday_clock_get(e->exe); + IF_FN_DEL(ecore_timer_del, doomsday_clock); + _ecore_unlock(); + doomsday_clock = ecore_timer_add + (0.1, _ecore_signal_exe_exit_delay, e); + _ecore_lock(); + _ecore_exe_doomsday_clock_set(e->exe, doomsday_clock); + } + else + { + _ecore_event_add(ECORE_EXE_EVENT_DEL, e, + _ecore_exe_event_del_free, NULL); + } + } + } + sig_count--; + } + sigchld_count = 0; + + if (sigusr1_count > MAXSIGQ) + WRN("%i SIGUSR1 in queue. max queue size %i. losing " + "siginfo for extra signals.", sigusr1_count, MAXSIGQ); + for (n = 0; n < sigusr1_count; n++) + { + Ecore_Event_Signal_User *e; + + e = _ecore_event_signal_user_new(); + if (e) + { + e->number = 1; + + if ((n < MAXSIGQ) && (sigusr1_info[n].si_signo)) + e->data = sigusr1_info[n]; + + _ecore_event_add(ECORE_EVENT_SIGNAL_USER, e, NULL, NULL); + } + sig_count--; + } + sigusr1_count = 0; + + if (sigusr2_count > MAXSIGQ) + WRN("%i SIGUSR2 in queue. max queue size %i. losing " + "siginfo for extra signals.", sigusr2_count, MAXSIGQ); + for (n = 0; n < sigusr2_count; n++) + { + Ecore_Event_Signal_User *e; + + e = _ecore_event_signal_user_new(); + if (e) + { + e->number = 2; + + if ((n < MAXSIGQ) && (sigusr2_info[n].si_signo)) + e->data = sigusr2_info[n]; + + _ecore_event_add(ECORE_EVENT_SIGNAL_USER, e, NULL, NULL); + } + sig_count--; + } + sigusr2_count = 0; + + if (sighup_count > MAXSIGQ) + WRN("%i SIGHUP in queue. max queue size %i. losing " + "siginfo for extra signals.", sighup_count, MAXSIGQ); + for (n = 0; n < sighup_count; n++) + { + Ecore_Event_Signal_Hup *e; + + e = _ecore_event_signal_hup_new(); + if (e) + { + if ((n < MAXSIGQ) && (sighup_info[n].si_signo)) + e->data = sighup_info[n]; + + _ecore_event_add(ECORE_EVENT_SIGNAL_HUP, e, NULL, NULL); + } + sig_count--; + } + sighup_count = 0; + + if (sigquit_count > MAXSIGQ) + WRN("%i SIGQUIT in queue. max queue size %i. losing " + "siginfo for extra signals.", sigquit_count, MAXSIGQ); + for (n = 0; n < sigquit_count; n++) + { + Ecore_Event_Signal_Exit *e; + + e = _ecore_event_signal_exit_new(); + if (e) + { + e->quit = 1; + + if ((n < MAXSIGQ) && (sigquit_info[n].si_signo)) + e->data = sigquit_info[n]; + + _ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL); + } + sig_count--; + } + sigquit_count = 0; + + if (sigint_count > MAXSIGQ) + WRN("%i SIGINT in queue. max queue size %i. losing " + "siginfo for extra signals.", sigint_count, MAXSIGQ); + for (n = 0; n < sigint_count; n++) + { + Ecore_Event_Signal_Exit *e; + + e = _ecore_event_signal_exit_new(); + if (e) + { + e->interrupt = 1; + + if ((n < MAXSIGQ) && (sigint_info[n].si_signo)) + e->data = sigint_info[n]; + + _ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL); + } + sig_count--; + } + sigint_count = 0; + + if (sigterm_count > MAXSIGQ) + WRN("%i SIGTERM in queue. max queue size %i. losing " + "siginfo for extra signals.", sigterm_count, MAXSIGQ); + for (n = 0; n < sigterm_count; n++) + { + Ecore_Event_Signal_Exit *e; + + e = _ecore_event_signal_exit_new(); + if (e) + { + e->terminate = 1; + + if ((n < MAXSIGQ) && (sigterm_info[n].si_signo)) + e->data = sigterm_info[n]; + + _ecore_event_add(ECORE_EVENT_SIGNAL_EXIT, e, NULL, NULL); + } + sig_count--; + } + sigterm_count = 0; + +#ifdef SIGPWR + if (sigpwr_count > MAXSIGQ) + WRN("%i SIGPWR in queue. max queue size %i. losing " + "siginfo for extra signals.", sigpwr_count, MAXSIGQ); + for (n = 0; n < sigpwr_count; n++) + { + Ecore_Event_Signal_Power *e; + + e = _ecore_event_signal_power_new(); + if (e) + { + if ((n < MAXSIGQ) && (sigpwr_info[n].si_signo)) + e->data = sigpwr_info[n]; + + _ecore_event_add(ECORE_EVENT_SIGNAL_POWER, e, NULL, NULL); + } + sig_count--; + } + sigpwr_count = 0; +#endif + + sigprocmask(SIG_SETMASK, &oldset, NULL); +} + +static void +_ecore_signal_callback_set(int sig, + Signal_Handler func) +{ + struct sigaction sa; + + sa.sa_sigaction = func; + sa.sa_flags = SA_RESTART | SA_SIGINFO; + sigemptyset(&sa.sa_mask); + sigaction(sig, &sa, NULL); +} + +static void +_ecore_signal_callback_ignore(int sig __UNUSED__, + siginfo_t *si __UNUSED__, + void *foo __UNUSED__) +{ +} + +static void +_ecore_signal_callback_sigchld(int sig __UNUSED__, + siginfo_t *si, + void *foo __UNUSED__) +{ + volatile sig_atomic_t n; + n = sigchld_count; + if (n < MAXSIGQ) + { + if (si) + sigchld_info[n] = *si; + else + sigchld_info[n].si_signo = 0; + } + + sigchld_count++; + sig_count++; +} + +static void +_ecore_signal_callback_sigusr1(int sig __UNUSED__, + siginfo_t *si, + void *foo __UNUSED__) +{ + volatile sig_atomic_t n; + n = sigusr1_count; + if (n < MAXSIGQ) + { + if (si) + sigusr1_info[n] = *si; + else + sigusr1_info[n].si_signo = 0; + } + sigusr1_count++; + sig_count++; +} + +static void +_ecore_signal_callback_sigusr2(int sig __UNUSED__, + siginfo_t *si, + void *foo __UNUSED__) +{ + volatile sig_atomic_t n; + n = sigusr2_count; + if (n < MAXSIGQ) + { + if (si) + sigusr2_info[n] = *si; + else + sigusr2_info[n].si_signo = 0; + } + sigusr2_count++; + sig_count++; +} + +static void +_ecore_signal_callback_sighup(int sig __UNUSED__, + siginfo_t *si, + void *foo __UNUSED__) +{ + volatile sig_atomic_t n; + n = sighup_count; + if (n < MAXSIGQ) + { + if (si) + sighup_info[n] = *si; + else + sighup_info[n].si_signo = 0; + } + sighup_count++; + sig_count++; +} + +static void +_ecore_signal_callback_sigquit(int sig __UNUSED__, + siginfo_t *si, + void *foo __UNUSED__) +{ + volatile sig_atomic_t n; + n = sigquit_count; + if (n < MAXSIGQ) + { + if (si) + sigquit_info[n] = *si; + else + sigquit_info[n].si_signo = 0; + } + sigquit_count++; + sig_count++; +} + +static void +_ecore_signal_callback_sigint(int sig __UNUSED__, + siginfo_t *si, + void *foo __UNUSED__) +{ + volatile sig_atomic_t n; + n = sigint_count; + if (n < MAXSIGQ) + { + if (si) + sigint_info[n] = *si; + else + sigint_info[n].si_signo = 0; + } + sigint_count++; + sig_count++; +} + +static void +_ecore_signal_callback_sigterm(int sig __UNUSED__, + siginfo_t *si, + void *foo __UNUSED__) +{ + volatile sig_atomic_t n; + n = sigterm_count; + if (n < MAXSIGQ) + { + if (si) + sigterm_info[n] = *si; + else + sigterm_info[n].si_signo = 0; + } + sigterm_count++; + sig_count++; +} + +#ifdef SIGPWR +static void +_ecore_signal_callback_sigpwr(int sig __UNUSED__, + siginfo_t *si, + void *foo __UNUSED__) +{ + volatile sig_atomic_t n; + n = sigpwr_count; + if (n < MAXSIGQ) + { + if (si) + sigpwr_info[n] = *si; + else + sigpwr_info[n].si_signo = 0; + } + sigpwr_count++; + sig_count++; +} + +#endif + +static Eina_Bool +_ecore_signal_exe_exit_delay(void *data) +{ + Ecore_Exe_Event_Del *e; + + e = data; + if (e) + { + _ecore_exe_doomsday_clock_set(e->exe, NULL); + _ecore_event_add(ECORE_EXE_EVENT_DEL, e, + _ecore_exe_event_del_free, NULL); + } + return ECORE_CALLBACK_CANCEL; +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_thread.c b/libraries/ecore/src/lib/ecore/ecore_thread.c new file mode 100644 index 0000000..2a8ea76 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_thread.c @@ -0,0 +1,1666 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#ifdef HAVE_EVIL +# include +#endif + +#include "Ecore.h" +#include "ecore_private.h" + +#ifdef EFL_HAVE_THREADS + +# ifdef EFL_HAVE_POSIX_THREADS +# include +# ifdef __linux__ +# include +# include +# include +# include +# include +# endif + +# define PH(x) pthread_t x +# define PHE(x, y) pthread_equal(x, y) +# define PHS() pthread_self() +# define PHC(x, f, d) pthread_create(&(x), NULL, (void *)f, d) +# define PHJ(x, p) pthread_join(x, (void **)(&(p))) +# define PHA(x) pthread_cancel(x) + +# define CD(x) pthread_cond_t x +# define CDI(x) pthread_cond_init(&(x), NULL); +# define CDD(x) pthread_cond_destroy(&(x)); +# define CDB(x) pthread_cond_broadcast(&(x)); +# define CDW(x, y, t) pthread_cond_timedwait(&(x), &(y), t); + +# define LK(x) pthread_mutex_t x +# define LKI(x) pthread_mutex_init(&(x), NULL); +# define LKD(x) pthread_mutex_destroy(&(x)); +# define LKL(x) pthread_mutex_lock(&(x)); +# define LKU(x) pthread_mutex_unlock(&(x)); + +# define LRWK(x) pthread_rwlock_t x +# define LRWKI(x) pthread_rwlock_init(&(x), NULL); +# define LRWKD(x) pthread_rwlock_destroy(&(x)); +# define LRWKWL(x) pthread_rwlock_wrlock(&(x)); +# define LRWKRL(x) pthread_rwlock_rdlock(&(x)); +# define LRWKU(x) pthread_rwlock_unlock(&(x)); + +# else /* EFL_HAVE_WIN32_THREADS */ + +# define WIN32_LEAN_AND_MEAN +# include +# undef WIN32_LEAN_AND_MEAN + +typedef struct +{ + HANDLE thread; + void *val; +} win32_thread; + +# define PH(x) win32_thread * x +# define PHE(x, y) ((x) == (y)) +# define PHS() (HANDLE)GetCurrentThreadId() + +int +_ecore_thread_win32_create(win32_thread **x, + LPTHREAD_START_ROUTINE f, + void *d) +{ + win32_thread *t; + t = (win32_thread *)calloc(1, sizeof(win32_thread)); + if (!t) + return -1; + + (t)->thread = CreateThread(NULL, 0, f, d, 0, NULL); + if (!t->thread) + { + free(t); + return -1; + } + t->val = d; + *x = t; + + return 0; +} + +# define PHC(x, f, d) _ecore_thread_win32_create(&(x), (LPTHREAD_START_ROUTINE)f, d) + +int +_ecore_thread_win32_join(win32_thread *x, + void **res) +{ + if (!PHE(x, PHS())) + { + WaitForSingleObject(x->thread, INFINITE); + CloseHandle(x->thread); + } + if (res) *res = x->val; + free(x); + + return 0; +} + +# define PHJ(x, p) _ecore_thread_win32_join(x, (void **)(&(p))) +# define PHA(x) TerminateThread(x->thread, 0) + +# define LK(x) HANDLE x +# define LKI(x) x = CreateMutex(NULL, FALSE, NULL) +# define LKD(x) CloseHandle(x) +# define LKL(x) WaitForSingleObject(x, INFINITE) +# define LKU(x) ReleaseMutex(x) + +typedef struct +{ + HANDLE semaphore; + LONG threads_count; + CRITICAL_SECTION threads_count_lock; +} win32_cond; + +# define CD(x) win32_cond * x + +# define CDI(x) \ + do { \ + x = (win32_cond *)calloc(1, sizeof(win32_cond)); \ + if (x) \ + { \ + x->semaphore = CreateSemaphore(NULL, 0, 0x7fffffff, NULL); \ + if (x->semaphore) \ + InitializeCriticalSection(&x->threads_count_lock); \ + else \ + { \ + free(x); \ + x = NULL; \ + } \ + } \ + } while (0) + +# define CDD(x) \ + do { \ + CloseHandle(x->semaphore); \ + free(x); \ + x = NULL; \ + } while (0) + +# define CDB(x) \ + do { \ + EnterCriticalSection(&x->threads_count_lock); \ + if (x->threads_count > 0) \ + ReleaseSemaphore(x->semaphore, x->threads_count, NULL); \ + LeaveCriticalSection (&x->threads_count_lock); \ + } while (0) + +int +_ecore_thread_win32_cond_timedwait(win32_cond *c, + HANDLE *external_mutex, + struct timeval *t) +{ + DWORD res; + DWORD val = t->tv_sec * 1000 + (t->tv_usec / 1000); + LKL(external_mutex); + EnterCriticalSection (&c->threads_count_lock); + c->threads_count++; + LeaveCriticalSection (&c->threads_count_lock); + LKU(external_mutex); + res = WaitForSingleObject(c->semaphore, val); + if (res == WAIT_OBJECT_0) + return 0; + else + return -1; +} + +# define CDW(x, y, t) _ecore_thread_win32_cond_timedwait(x, y, t) + +typedef struct +{ + LONG readers_count; + LONG writers_count; + int readers; + int writers; + LK(mutex); + CD(cond_read); + CD(cond_write); +} win32_rwl; + +# define LRWK(x) win32_rwl * x +# define LRWKI(x) \ + do { \ + x = (win32_rwl *)calloc(1, sizeof(win32_rwl)); \ + if (x) \ + { \ + LKI(x->mutex); \ + if (x->mutex) \ + { \ + CDI(x->cond_read); \ + if (x->cond_read) \ + { \ + CDI(x->cond_write); \ + if (!x->cond_write) \ + { \ + CDD(x->cond_read); \ + LKD(x->mutex); \ + free(x); \ + x = NULL; \ + } \ + } \ + else \ + { \ + LKD(x->mutex); \ + free(x); \ + x = NULL; \ + } \ + } \ + else \ + { \ + free(x); \ + x = NULL; \ + } \ + } \ + } while (0) + +# define LRWKD(x) \ + do { \ + LKU(x->mutex); \ + LKD(x->mutex); \ + CDD(x->cond_write); \ + CDD(x->cond_read); \ + free(x); \ + } while (0) +# define LRWKWL(x) \ + do { \ + DWORD res; \ + LKU(x->mutex); \ + if (x->writers || x->readers > 0) \ + { \ + x->writers_count++; \ + while (x->writers || x->readers > 0) \ + { \ + EnterCriticalSection(&x->cond_write->threads_count_lock); \ + x->cond_read->threads_count++; \ + LeaveCriticalSection(&x->cond_write->threads_count_lock); \ + res = WaitForSingleObject(x->cond_write->semaphore, INFINITE); \ + if (res != WAIT_OBJECT_0) break; \ + } \ + x->writers_count--; \ + } \ + if (res == 0) x->writers_count = 1; \ + LKU(x->mutex); \ + } while (0) +# define LRWKRL(x) \ + do { \ + DWORD res; \ + LKL(x->mutex); \ + if (x->writers) \ + { \ + x->readers_count++; \ + while (x->writers) \ + { \ + EnterCriticalSection(&x->cond_write->threads_count_lock); \ + x->cond_read->threads_count++; \ + LeaveCriticalSection(&x->cond_write->threads_count_lock); \ + res = WaitForSingleObject(x->cond_write->semaphore, INFINITE); \ + if (res != WAIT_OBJECT_0) break; \ + } \ + x->readers_count--; \ + } \ + if (res == 0) \ + x->readers++; \ + LKU(x->mutex); \ + } while (0) +# define LRWKU(x) \ + do { \ + LKL(x->mutex); \ + if (x->writers) \ + { \ + x->writers = 0; \ + if (x->readers_count == 1) \ + { \ + EnterCriticalSection(&x->cond_read->threads_count_lock); \ + if (x->cond_read->threads_count > 0) \ + ReleaseSemaphore(x->cond_read->semaphore, 1, 0); \ + LeaveCriticalSection(&x->cond_read->threads_count_lock); \ + } \ + else if (x->readers_count > 0) \ + CDB(x->cond_read); \ + else if (x->writers_count > 0) \ + { \ + EnterCriticalSection (&x->cond_write->threads_count_lock); \ + if (x->cond_write->threads_count > 0) \ + ReleaseSemaphore(x->cond_write->semaphore, 1, 0); \ + LeaveCriticalSection (&x->cond_write->threads_count_lock); \ + } \ + } \ + else if (x->readers > 0) \ + { \ + x->readers--; \ + if (x->readers == 0 && x->writers_count > 0) \ + { \ + EnterCriticalSection (&x->cond_write->threads_count_lock); \ + if (x->cond_write->threads_count > 0) \ + ReleaseSemaphore(x->cond_write->semaphore, 1, 0); \ + LeaveCriticalSection (&x->cond_write->threads_count_lock); \ + } \ + } \ + LKU(x->mutex); \ + } while (0) + +# endif + +#endif + +typedef struct _Ecore_Pthread_Worker Ecore_Pthread_Worker; +typedef struct _Ecore_Pthread Ecore_Pthread; +typedef struct _Ecore_Thread_Data Ecore_Thread_Data; + +struct _Ecore_Thread_Data +{ + void *data; + Eina_Free_Cb cb; +}; + +struct _Ecore_Pthread_Worker +{ + union { + struct + { + Ecore_Thread_Cb func_blocking; + } short_run; + struct + { + Ecore_Thread_Cb func_heavy; + Ecore_Thread_Notify_Cb func_notify; + Ecore_Pipe *notify; + + Ecore_Pipe *direct_pipe; + Ecore_Pthread_Worker *direct_worker; + + int send; + int received; + } feedback_run; + } u; + + Ecore_Thread_Cb func_cancel; + Ecore_Thread_Cb func_end; +#ifdef EFL_HAVE_THREADS + PH(self); + Eina_Hash *hash; + CD(cond); + LK(mutex); +#endif + + const void *data; + + Eina_Bool cancel : 1; + Eina_Bool feedback_run : 1; + Eina_Bool kill : 1; + Eina_Bool reschedule : 1; + Eina_Bool no_queue : 1; +}; + +#ifdef EFL_HAVE_THREADS +typedef struct _Ecore_Pthread_Data Ecore_Pthread_Data; + +struct _Ecore_Pthread_Data +{ + Ecore_Pthread_Worker *death_job; + Ecore_Pipe *p; + void *data; + PH(thread); +}; +#endif + +static int _ecore_thread_count_max = 0; +static int ECORE_THREAD_PIPE_DEL = 0; +static Eina_Array *_ecore_thread_pipe = NULL; + +#ifdef EFL_HAVE_THREADS + +static void _ecore_thread_handler(void *data __UNUSED__, + void *buffer, + unsigned int nbyte); + +static Ecore_Pipe * +_ecore_thread_pipe_get(void) +{ + if (eina_array_count_get(_ecore_thread_pipe) > 0) + return eina_array_pop(_ecore_thread_pipe); + + return ecore_pipe_add(_ecore_thread_handler, NULL); +} + +static int _ecore_thread_count = 0; + +static Ecore_Event_Handler *del_handler = NULL; +static Eina_List *_ecore_active_job_threads = NULL; +static Eina_List *_ecore_pending_job_threads = NULL; +static Eina_List *_ecore_pending_job_threads_feedback = NULL; +static LK(_ecore_pending_job_threads_mutex); + +static Eina_Hash *_ecore_thread_global_hash = NULL; +static LRWK(_ecore_thread_global_hash_lock); +static LK(_ecore_thread_global_hash_mutex); +static CD(_ecore_thread_global_hash_cond); + +static Eina_Bool have_main_loop_thread = 0; + +static Eina_Trash *_ecore_thread_worker_trash = NULL; +static int _ecore_thread_worker_count = 0; + +static void *_ecore_thread_worker(Ecore_Pthread_Data *pth); +static Ecore_Pthread_Worker *_ecore_thread_worker_new(void); + +static PH(get_main_loop_thread) (void) +{ + static PH(main_loop_thread); + static pid_t main_loop_pid; + pid_t pid = getpid(); + + if (pid != main_loop_pid) + { + main_loop_pid = pid; + main_loop_thread = PHS(); + have_main_loop_thread = 1; + } + + return main_loop_thread; +} + +static void +_ecore_thread_worker_free(Ecore_Pthread_Worker *worker) +{ + if (_ecore_thread_worker_count > (_ecore_thread_count_max + 1) * 16) + { + free(worker); + return; + } + + eina_trash_push(&_ecore_thread_worker_trash, worker); +} + +static void +_ecore_thread_data_free(void *data) +{ + Ecore_Thread_Data *d = data; + + if (d->cb) d->cb(d->data); + free(d); +} + +static void +_ecore_thread_pipe_free(void *data __UNUSED__, + void *event) +{ + Ecore_Pipe *p = event; + + if (eina_array_count_get(_ecore_thread_pipe) < 50) + eina_array_push(_ecore_thread_pipe, p); + else + ecore_pipe_del(p); + eina_threads_shutdown(); +} + +static Eina_Bool +_ecore_thread_pipe_del(void *data __UNUSED__, + int type __UNUSED__, + void *event __UNUSED__) +{ + /* This is a hack to delay pipe destruction until we are out of its internal loop. */ + return ECORE_CALLBACK_CANCEL; +} + +static void +_ecore_thread_end(Ecore_Pthread_Data *pth, + Ecore_Thread *work) +{ + Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)work; + Ecore_Pipe *p; + + if (!worker->feedback_run || (worker->feedback_run && !worker->no_queue)) + _ecore_thread_count--; + + if (PHJ(pth->thread, p) != 0) + return; + + if (eina_list_count(_ecore_pending_job_threads) > 0 + && (unsigned int)_ecore_thread_count < eina_list_count(_ecore_pending_job_threads) + && _ecore_thread_count < _ecore_thread_count_max) + { + /* One more thread should be created. */ + INF("spawning threads because of still pending jobs."); + + pth->death_job = _ecore_thread_worker_new(); + if (!pth->p || !pth->death_job) goto end; + + eina_threads_init(); + + if (PHC(pth->thread, _ecore_thread_worker, pth) == 0) + { + _ecore_thread_count++; + return; + } + + eina_threads_shutdown(); + +end: + if (pth->death_job) _ecore_thread_worker_free(pth->death_job); + } + + _ecore_active_job_threads = eina_list_remove(_ecore_active_job_threads, pth); + + ecore_event_add(ECORE_THREAD_PIPE_DEL, pth->p, _ecore_thread_pipe_free, NULL); + free(pth); +} + +static void +_ecore_thread_kill(Ecore_Pthread_Worker *work) +{ + if (work->cancel) + { + if (work->func_cancel) + work->func_cancel((void *)work->data, (Ecore_Thread *)work); + } + else + { + if (work->func_end) + work->func_end((void *)work->data, (Ecore_Thread *)work); + } + + if (work->feedback_run) + { + ecore_pipe_del(work->u.feedback_run.notify); + + if (work->u.feedback_run.direct_pipe) + eina_array_push(_ecore_thread_pipe, work->u.feedback_run.direct_pipe); + if (work->u.feedback_run.direct_worker) + _ecore_thread_worker_free(work->u.feedback_run.direct_worker); + } + CDD(work->cond); + LKD(work->mutex); + if (work->hash) + eina_hash_free(work->hash); + free(work); +} + +static void +_ecore_thread_handler(void *data __UNUSED__, + void *buffer, + unsigned int nbyte) +{ + Ecore_Pthread_Worker *work; + + if (nbyte != sizeof (Ecore_Pthread_Worker *)) return; + + work = *(Ecore_Pthread_Worker **)buffer; + + if (work->feedback_run) + { + if (work->u.feedback_run.send != work->u.feedback_run.received) + { + work->kill = EINA_TRUE; + return; + } + } + + _ecore_thread_kill(work); +} + +static void +_ecore_notify_handler(void *data, + void *buffer, + unsigned int nbyte) +{ + Ecore_Pthread_Worker *work = data; + void *user_data; + + if (nbyte != sizeof (Ecore_Pthread_Worker *)) return; + + user_data = *(void **)buffer; + work->u.feedback_run.received++; + + if (work->u.feedback_run.func_notify) + work->u.feedback_run.func_notify((void *)work->data, (Ecore_Thread *)work, user_data); + + /* Force reading all notify event before killing the thread */ + if (work->kill && work->u.feedback_run.send == work->u.feedback_run.received) + { + _ecore_thread_kill(work); + } +} + +static void +_ecore_short_job(Ecore_Pipe *end_pipe) +{ + Ecore_Pthread_Worker *work; + + while (_ecore_pending_job_threads) + { + LKL(_ecore_pending_job_threads_mutex); + + if (!_ecore_pending_job_threads) + { + LKU(_ecore_pending_job_threads_mutex); + break; + } + + work = eina_list_data_get(_ecore_pending_job_threads); + _ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads, + _ecore_pending_job_threads); + + LKU(_ecore_pending_job_threads_mutex); + + if (!work->cancel) + work->u.short_run.func_blocking((void *)work->data, (Ecore_Thread *)work); + + if (work->reschedule) + { + work->reschedule = EINA_FALSE; + + LKL(_ecore_pending_job_threads_mutex); + _ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work); + LKU(_ecore_pending_job_threads_mutex); + } + else + { + ecore_pipe_write(end_pipe, &work, sizeof (Ecore_Pthread_Worker *)); + } + } +} + +static void +_ecore_feedback_job(Ecore_Pipe *end_pipe, + PH(thread)) +{ + Ecore_Pthread_Worker *work; + + while (_ecore_pending_job_threads_feedback) + { + LKL(_ecore_pending_job_threads_mutex); + + if (!_ecore_pending_job_threads_feedback) + { + LKU(_ecore_pending_job_threads_mutex); + break; + } + + work = eina_list_data_get(_ecore_pending_job_threads_feedback); + _ecore_pending_job_threads_feedback = eina_list_remove_list(_ecore_pending_job_threads_feedback, + _ecore_pending_job_threads_feedback); + + LKU(_ecore_pending_job_threads_mutex); + + work->self = thread; + if (!work->cancel) + work->u.feedback_run.func_heavy((void *)work->data, (Ecore_Thread *)work); + + if (work->reschedule) + { + work->reschedule = EINA_FALSE; + + LKL(_ecore_pending_job_threads_mutex); + _ecore_pending_job_threads_feedback = eina_list_append(_ecore_pending_job_threads_feedback, work); + LKU(_ecore_pending_job_threads_mutex); + } + else + { + ecore_pipe_write(end_pipe, &work, sizeof (Ecore_Pthread_Worker *)); + } + } +} + +static void * +_ecore_direct_worker(Ecore_Pthread_Worker *work) +{ + Ecore_Pthread_Data *pth; + +#ifdef EFL_POSIX_THREADS + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); +#endif + + eina_sched_prio_drop(); + + pth = malloc(sizeof (Ecore_Pthread_Data)); + if (!pth) return NULL; + + pth->p = work->u.feedback_run.direct_pipe; + if (!pth->p) + { + free(pth); + return NULL; + } + pth->thread = PHS(); + + work->self = pth->thread; + work->u.feedback_run.func_heavy((void *)work->data, (Ecore_Thread *)work); + + ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *)); + + work = work->u.feedback_run.direct_worker; + if (!work) + { + free(pth); + return NULL; + } + + work->data = pth; + work->u.short_run.func_blocking = NULL; + work->func_end = (void *)_ecore_thread_end; + work->func_cancel = NULL; + work->cancel = EINA_FALSE; + work->feedback_run = EINA_FALSE; + work->kill = EINA_FALSE; + work->hash = NULL; + CDI(work->cond); + LKI(work->mutex); + + ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *)); + + return pth->p; +} + +static void * +_ecore_thread_worker(Ecore_Pthread_Data *pth) +{ + Ecore_Pthread_Worker *work; + +#ifdef EFL_POSIX_THREADS + pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); + pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL); +#endif + + eina_sched_prio_drop(); + +restart: + if (_ecore_pending_job_threads) _ecore_short_job(pth->p); + if (_ecore_pending_job_threads_feedback) _ecore_feedback_job(pth->p, pth->thread); + + /* FIXME: Check if there is feedback running task todo, and switch to feedback run handler. */ + + LKL(_ecore_pending_job_threads_mutex); + if (_ecore_pending_job_threads || _ecore_pending_job_threads_feedback) + { + LKU(_ecore_pending_job_threads_mutex); + goto restart; + } + LKU(_ecore_pending_job_threads_mutex); + + /* Sleep a little to prevent premature death */ +#ifdef _WIN32 + Sleep(1); /* around 50ms */ +#else + usleep(200); +#endif + + LKL(_ecore_pending_job_threads_mutex); + if (_ecore_pending_job_threads || _ecore_pending_job_threads_feedback) + { + LKU(_ecore_pending_job_threads_mutex); + goto restart; + } + LKU(_ecore_pending_job_threads_mutex); + + work = pth->death_job; + if (!work) return NULL; + + work->data = pth; + work->u.short_run.func_blocking = NULL; + work->func_end = (void *)_ecore_thread_end; + work->func_cancel = NULL; + work->cancel = EINA_FALSE; + work->feedback_run = EINA_FALSE; + work->kill = EINA_FALSE; + work->hash = NULL; + CDI(work->cond); + LKI(work->mutex); + + ecore_pipe_write(pth->p, &work, sizeof (Ecore_Pthread_Worker *)); + + return pth->p; +} + +#endif + +static Ecore_Pthread_Worker * +_ecore_thread_worker_new(void) +{ +#ifdef EFL_HAVE_THREADS + Ecore_Pthread_Worker *result; + + result = eina_trash_pop(&_ecore_thread_worker_trash); + + if (!result) result = malloc(sizeof (Ecore_Pthread_Worker)); + else _ecore_thread_worker_count--; + + return result; +#else + return malloc(sizeof (Ecore_Pthread_Worker)); +#endif +} + +void +_ecore_thread_init(void) +{ + _ecore_thread_count_max = eina_cpu_count(); + if (_ecore_thread_count_max <= 0) + _ecore_thread_count_max = 1; + + ECORE_THREAD_PIPE_DEL = ecore_event_type_new(); + _ecore_thread_pipe = eina_array_new(8); + +#ifdef EFL_HAVE_THREADS + del_handler = ecore_event_handler_add(ECORE_THREAD_PIPE_DEL, _ecore_thread_pipe_del, NULL); + + LKI(_ecore_pending_job_threads_mutex); + LRWKI(_ecore_thread_global_hash_lock); + LKI(_ecore_thread_global_hash_mutex); + CDI(_ecore_thread_global_hash_cond); +#endif +} + +void +_ecore_thread_shutdown(void) +{ + /* FIXME: If function are still running in the background, should we kill them ? */ + Ecore_Pipe *p; + Eina_Array_Iterator it; + unsigned int i; + +#ifdef EFL_HAVE_THREADS + Ecore_Pthread_Worker *work; + Ecore_Pthread_Data *pth; + + LKL(_ecore_pending_job_threads_mutex); + + EINA_LIST_FREE(_ecore_pending_job_threads, work) + { + if (work->func_cancel) + work->func_cancel((void *)work->data, (Ecore_Thread *)work); + free(work); + } + + EINA_LIST_FREE(_ecore_pending_job_threads_feedback, work) + { + if (work->func_cancel) + work->func_cancel((void *)work->data, (Ecore_Thread *)work); + free(work); + } + + LKU(_ecore_pending_job_threads_mutex); + + /* Improve emergency shutdown */ + EINA_LIST_FREE(_ecore_active_job_threads, pth) + { + Ecore_Pipe *ep; + + PHA(pth->thread); + PHJ(pth->thread, ep); + + ecore_pipe_del(pth->p); + } + if (_ecore_thread_global_hash) + eina_hash_free(_ecore_thread_global_hash); + _ecore_event_handler_del(del_handler); + have_main_loop_thread = 0; + del_handler = NULL; + + LKD(_ecore_pending_job_threads_mutex); + LRWKD(_ecore_thread_global_hash_lock); + LKD(_ecore_thread_global_hash_mutex); + CDD(_ecore_thread_global_hash_cond); +#endif + + EINA_ARRAY_ITER_NEXT(_ecore_thread_pipe, i, p, it) + ecore_pipe_del(p); + + eina_array_free(_ecore_thread_pipe); + _ecore_thread_pipe = NULL; +} + +void +_ecore_thread_assert_main_loop_thread(const char *function) +{ + Eina_Bool good; +#ifdef EFL_HAVE_THREADS + good = PHE(get_main_loop_thread(), PHS()); +#else + good = EINA_TRUE; +#endif + if (!good) + { + EINA_LOG_CRIT("Call to %s from wrong thread!", function); + abort(); + } +} + +EAPI Ecore_Thread * +ecore_thread_run(Ecore_Thread_Cb func_blocking, + Ecore_Thread_Cb func_end, + Ecore_Thread_Cb func_cancel, + const void *data) +{ + Ecore_Pthread_Worker *work; +#ifdef EFL_HAVE_THREADS + Ecore_Pthread_Data *pth = NULL; +#endif + + if (!func_blocking) return NULL; + + work = _ecore_thread_worker_new(); + if (!work) + { + if (func_cancel) + func_cancel((void *)data, NULL); + return NULL; + } + + work->u.short_run.func_blocking = func_blocking; + work->func_end = func_end; + work->func_cancel = func_cancel; + work->cancel = EINA_FALSE; + work->feedback_run = EINA_FALSE; + work->kill = EINA_FALSE; + work->reschedule = EINA_FALSE; + work->data = data; + +#ifdef EFL_HAVE_THREADS + work->hash = NULL; + CDI(work->cond); + LKI(work->mutex); + + LKL(_ecore_pending_job_threads_mutex); + _ecore_pending_job_threads = eina_list_append(_ecore_pending_job_threads, work); + + if (_ecore_thread_count == _ecore_thread_count_max) + { + LKU(_ecore_pending_job_threads_mutex); + return (Ecore_Thread *)work; + } + + LKU(_ecore_pending_job_threads_mutex); + + /* One more thread could be created. */ + pth = malloc(sizeof (Ecore_Pthread_Data)); + if (!pth) goto on_error; + + pth->p = _ecore_thread_pipe_get(); + pth->death_job = _ecore_thread_worker_new(); + if (!pth->p || !pth->death_job) goto on_error; + + eina_threads_init(); + + if (PHC(pth->thread, _ecore_thread_worker, pth) == 0) + { + _ecore_thread_count++; + return (Ecore_Thread *)work; + } + + eina_threads_shutdown(); + +on_error: + if (pth) + { + if (pth->p) eina_array_push(_ecore_thread_pipe, pth->p); + if (pth->death_job) _ecore_thread_worker_free(pth->death_job); + free(pth); + } + + if (_ecore_thread_count == 0) + { + LKL(_ecore_pending_job_threads_mutex); + _ecore_pending_job_threads = eina_list_remove(_ecore_pending_job_threads, work); + LKU(_ecore_pending_job_threads_mutex); + + if (work->func_cancel) + work->func_cancel((void *)work->data, (Ecore_Thread *)work); + free(work); + work = NULL; + } + return (Ecore_Thread *)work; +#else + /* + If no thread and as we don't want to break app that rely on this + facility, we will lock the interface until we are done. + */ + do { + /* Handle reschedule by forcing it here. That would mean locking the app, + * would be better with an idler, but really to complex for a case where + * thread should really exist. + */ + work->reschedule = EINA_FALSE; + + func_blocking((void *)data, (Ecore_Thread *)work); + if (work->cancel == EINA_FALSE) func_end((void *)data, (Ecore_Thread *)work); + else func_cancel((void *)data, (Ecore_Thread *)work); + } while (work->reschedule == EINA_TRUE); + + free(work); + + return NULL; +#endif +} + +EAPI Eina_Bool +ecore_thread_cancel(Ecore_Thread *thread) +{ +#ifdef EFL_HAVE_THREADS + Ecore_Pthread_Worker *work = (Ecore_Pthread_Worker *)thread; + Eina_List *l; + + if (!work) + return EINA_TRUE; + if (work->cancel) + return EINA_FALSE; + + if (work->feedback_run) + { + if (work->kill) + return EINA_TRUE; + if (work->u.feedback_run.send != work->u.feedback_run.received) + goto on_exit; + } + + LKL(_ecore_pending_job_threads_mutex); + + if ((have_main_loop_thread) && + (PHE(get_main_loop_thread(), PHS()))) + { + if (!work->feedback_run) + EINA_LIST_FOREACH(_ecore_pending_job_threads, l, work) + { + if ((void *)work == (void *)thread) + { + _ecore_pending_job_threads = eina_list_remove_list(_ecore_pending_job_threads, l); + + LKU(_ecore_pending_job_threads_mutex); + + if (work->func_cancel) + work->func_cancel((void *)work->data, (Ecore_Thread *)work); + free(work); + + return EINA_TRUE; + } + } + else + EINA_LIST_FOREACH(_ecore_pending_job_threads_feedback, l, work) + { + if ((void *)work == (void *)thread) + { + _ecore_pending_job_threads_feedback = eina_list_remove_list(_ecore_pending_job_threads_feedback, l); + + LKU(_ecore_pending_job_threads_mutex); + + if (work->func_cancel) + work->func_cancel((void *)work->data, (Ecore_Thread *)work); + free(work); + + return EINA_TRUE; + } + } + } + + LKU(_ecore_pending_job_threads_mutex); + + /* Delay the destruction */ +on_exit: + ((Ecore_Pthread_Worker *)thread)->cancel = EINA_TRUE; + return EINA_FALSE; +#else + (void) thread; + return EINA_TRUE; +#endif +} + +EAPI Eina_Bool +ecore_thread_check(Ecore_Thread *thread) +{ + Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread; + + if (!worker) return EINA_TRUE; + return worker->cancel; +} + +EAPI Ecore_Thread * +ecore_thread_feedback_run(Ecore_Thread_Cb func_heavy, + Ecore_Thread_Notify_Cb func_notify, + Ecore_Thread_Cb func_end, + Ecore_Thread_Cb func_cancel, + const void *data, + Eina_Bool try_no_queue) +{ +#ifdef EFL_HAVE_THREADS + Ecore_Pthread_Worker *worker; + Ecore_Pthread_Data *pth = NULL; + + if (!func_heavy) return NULL; + + worker = _ecore_thread_worker_new(); + if (!worker) goto on_error; + + worker->u.feedback_run.func_heavy = func_heavy; + worker->u.feedback_run.func_notify = func_notify; + worker->hash = NULL; + CDI(worker->cond); + LKI(worker->mutex); + worker->func_cancel = func_cancel; + worker->func_end = func_end; + worker->data = data; + worker->cancel = EINA_FALSE; + worker->feedback_run = EINA_TRUE; + worker->kill = EINA_FALSE; + worker->reschedule = EINA_FALSE; + + worker->u.feedback_run.send = 0; + worker->u.feedback_run.received = 0; + + worker->u.feedback_run.notify = ecore_pipe_add(_ecore_notify_handler, worker); + worker->u.feedback_run.direct_pipe = NULL; + worker->u.feedback_run.direct_worker = NULL; + + if (!try_no_queue) + { + PH(t); + + worker->u.feedback_run.direct_pipe = _ecore_thread_pipe_get(); + worker->u.feedback_run.direct_worker = _ecore_thread_worker_new(); + worker->no_queue = EINA_TRUE; + + eina_threads_init(); + + if (PHC(t, _ecore_direct_worker, worker) == 0) + return (Ecore_Thread *)worker; + + eina_threads_shutdown(); + } + + worker->no_queue = EINA_FALSE; + + LKL(_ecore_pending_job_threads_mutex); + _ecore_pending_job_threads_feedback = eina_list_append(_ecore_pending_job_threads_feedback, worker); + + if (_ecore_thread_count == _ecore_thread_count_max) + { + LKU(_ecore_pending_job_threads_mutex); + return (Ecore_Thread *)worker; + } + + LKU(_ecore_pending_job_threads_mutex); + + /* One more thread could be created. */ + pth = malloc(sizeof (Ecore_Pthread_Data)); + if (!pth) goto on_error; + + pth->p = _ecore_thread_pipe_get(); + pth->death_job = _ecore_thread_worker_new(); + if (!pth->p || !pth->death_job) goto on_error; + + eina_threads_init(); + + if (PHC(pth->thread, _ecore_thread_worker, pth) == 0) + { + _ecore_thread_count++; + return (Ecore_Thread *)worker; + } + + eina_threads_shutdown(); + +on_error: + if (pth) + { + if (pth->p) eina_array_push(_ecore_thread_pipe, pth->p); + if (pth->death_job) _ecore_thread_worker_free(pth->death_job); + free(pth); + } + + if (_ecore_thread_count == 0) + { + LKL(_ecore_pending_job_threads_mutex); + _ecore_pending_job_threads_feedback = eina_list_remove(_ecore_pending_job_threads_feedback, + worker); + LKU(_ecore_pending_job_threads_mutex); + + if (func_cancel) func_cancel((void *)data, NULL); + + if (worker) + { + ecore_pipe_del(worker->u.feedback_run.notify); + free(worker); + worker = NULL; + } + } + + return (Ecore_Thread *)worker; +#else + Ecore_Pthread_Worker worker; + + (void)try_no_queue; + + /* + If no thread and as we don't want to break app that rely on this + facility, we will lock the interface until we are done. + */ + worker.u.feedback_run.func_heavy = func_heavy; + worker.u.feedback_run.func_notify = func_notify; + worker.u.feedback_run.notify = NULL; + worker.u.feedback_run.send = 0; + worker.u.feedback_run.received = 0; + worker.func_cancel = func_cancel; + worker.func_end = func_end; + worker.data = data; + worker.cancel = EINA_FALSE; + worker.feedback_run = EINA_TRUE; + worker.kill = EINA_FALSE; + + do { + worker.reschedule = EINA_FALSE; + + func_heavy((void *)data, (Ecore_Thread *)&worker); + + if (worker.cancel) func_cancel((void *)data, (Ecore_Thread *)&worker); + else func_end((void *)data, (Ecore_Thread *)&worker); + } while (worker.reschedule == EINA_TRUE); + + return NULL; +#endif +} + +EAPI Eina_Bool +ecore_thread_feedback(Ecore_Thread *thread, + const void *data) +{ + Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread; + + if (!worker) return EINA_FALSE; + if (!worker->feedback_run) return EINA_FALSE; + +#ifdef EFL_HAVE_THREADS + if (!PHE(worker->self, PHS())) return EINA_FALSE; + + worker->u.feedback_run.send++; + ecore_pipe_write(worker->u.feedback_run.notify, &data, sizeof (void *)); + + return EINA_TRUE; +#else + worker->u.feedback_run.func_notify((void *)worker->data, thread, (void *)data); + + return EINA_TRUE; +#endif +} + +EAPI Eina_Bool +ecore_thread_reschedule(Ecore_Thread *thread) +{ + Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread; + + if (!worker) return EINA_FALSE; + +#ifdef EFL_HAVE_THREADS + if (!PHE(worker->self, PHS())) return EINA_FALSE; +#endif + + worker->reschedule = EINA_TRUE; + return EINA_TRUE; +} + +EAPI int +ecore_thread_active_get(void) +{ +#ifdef EFL_HAVE_THREADS + return _ecore_thread_count; +#else + return 0; +#endif +} + +EAPI int +ecore_thread_pending_get(void) +{ +#ifdef EFL_HAVE_THREADS + int ret; + + LKL(_ecore_pending_job_threads_mutex); + ret = eina_list_count(_ecore_pending_job_threads); + LKU(_ecore_pending_job_threads_mutex); + return ret; +#else + return 0; +#endif +} + +EAPI int +ecore_thread_pending_feedback_get(void) +{ +#ifdef EFL_HAVE_THREADS + int ret; + + LKL(_ecore_pending_job_threads_mutex); + ret = eina_list_count(_ecore_pending_job_threads_feedback); + LKU(_ecore_pending_job_threads_mutex); + return ret; +#else + return 0; +#endif +} + +EAPI int +ecore_thread_pending_total_get(void) +{ +#ifdef EFL_HAVE_THREADS + int ret; + + LKL(_ecore_pending_job_threads_mutex); + ret = eina_list_count(_ecore_pending_job_threads) + eina_list_count(_ecore_pending_job_threads_feedback); + LKU(_ecore_pending_job_threads_mutex); + return ret; +#else + return 0; +#endif +} + +EAPI int +ecore_thread_max_get(void) +{ + return _ecore_thread_count_max; +} + +EAPI void +ecore_thread_max_set(int num) +{ + if (num < 1) return; + /* avoid doing something hilarious by blocking dumb users */ + if (num >= (2 * eina_cpu_count())) return; + + _ecore_thread_count_max = num; +} + +EAPI void +ecore_thread_max_reset(void) +{ + _ecore_thread_count_max = eina_cpu_count(); +} + +EAPI int +ecore_thread_available_get(void) +{ +#ifdef EFL_HAVE_THREADS + int ret; + + LKL(_ecore_pending_job_threads_mutex); + ret = _ecore_thread_count_max - _ecore_thread_count; + LKU(_ecore_pending_job_threads_mutex); + return ret; +#else + return 0; +#endif +} + +EAPI Eina_Bool +ecore_thread_local_data_add(Ecore_Thread *thread, + const char *key, + void *value, + Eina_Free_Cb cb, + Eina_Bool direct) +{ +#ifdef EFL_HAVE_THREADS + Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread; + Ecore_Thread_Data *d; + Eina_Bool ret; +#endif + + if ((!thread) || (!key) || (!value)) + return EINA_FALSE; +#ifdef EFL_HAVE_THREADS + if (!PHE(worker->self, PHS())) return EINA_FALSE; + + if (!worker->hash) + worker->hash = eina_hash_string_small_new(_ecore_thread_data_free); + + if (!worker->hash) + return EINA_FALSE; + + if (!(d = malloc(sizeof(Ecore_Thread_Data)))) + return EINA_FALSE; + + d->data = value; + d->cb = cb; + + if (direct) + ret = eina_hash_direct_add(worker->hash, key, d); + else + ret = eina_hash_add(worker->hash, key, d); + CDB(worker->cond); + return ret; +#else + (void) cb; + (void) direct; + return EINA_FALSE; +#endif +} + +EAPI void * +ecore_thread_local_data_set(Ecore_Thread *thread, + const char *key, + void *value, + Eina_Free_Cb cb) +{ +#ifdef EFL_HAVE_THREADS + Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread; + Ecore_Thread_Data *d, *r; + void *ret; +#endif + + if ((!thread) || (!key) || (!value)) + return NULL; +#ifdef EFL_HAVE_THREADS + if (!PHE(worker->self, PHS())) return NULL; + + if (!worker->hash) + worker->hash = eina_hash_string_small_new(_ecore_thread_data_free); + + if (!worker->hash) + return NULL; + + if (!(d = malloc(sizeof(Ecore_Thread_Data)))) + return NULL; + + d->data = value; + d->cb = cb; + + r = eina_hash_set(worker->hash, key, d); + CDB(worker->cond); + ret = r->data; + free(r); + return ret; +#else + (void) cb; + return NULL; +#endif +} + +EAPI void * +ecore_thread_local_data_find(Ecore_Thread *thread, + const char *key) +{ +#ifdef EFL_HAVE_THREADS + Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread; + Ecore_Thread_Data *d; +#endif + + if ((!thread) || (!key)) + return NULL; +#ifdef EFL_HAVE_THREADS + if (!PHE(worker->self, PHS())) return NULL; + + if (!worker->hash) + return NULL; + + d = eina_hash_find(worker->hash, key); + if (d) + return d->data; + return NULL; +#else + return NULL; +#endif +} + +EAPI Eina_Bool +ecore_thread_local_data_del(Ecore_Thread *thread, + const char *key) +{ +#ifdef EFL_HAVE_THREADS + Ecore_Pthread_Worker *worker = (Ecore_Pthread_Worker *)thread; +#endif + + if ((!thread) || (!key)) + return EINA_FALSE; +#ifdef EFL_HAVE_THREADS + if (!PHE(worker->self, PHS())) return EINA_FALSE; + + if (!worker->hash) + return EINA_FALSE; + return eina_hash_del_by_key(worker->hash, key); +#else + return EINA_TRUE; +#endif +} + +EAPI Eina_Bool +ecore_thread_global_data_add(const char *key, + void *value, + Eina_Free_Cb cb, + Eina_Bool direct) +{ +#ifdef EFL_HAVE_THREADS + Ecore_Thread_Data *d; + Eina_Bool ret; +#endif + + if ((!key) || (!value)) + return EINA_FALSE; +#ifdef EFL_HAVE_THREADS + LRWKWL(_ecore_thread_global_hash_lock); + if (!_ecore_thread_global_hash) + _ecore_thread_global_hash = eina_hash_string_small_new(_ecore_thread_data_free); + LRWKU(_ecore_thread_global_hash_lock); + + if (!(d = malloc(sizeof(Ecore_Thread_Data)))) + return EINA_FALSE; + + d->data = value; + d->cb = cb; + + if (!_ecore_thread_global_hash) + return EINA_FALSE; + LRWKWL(_ecore_thread_global_hash_lock); + if (direct) + ret = eina_hash_direct_add(_ecore_thread_global_hash, key, d); + else + ret = eina_hash_add(_ecore_thread_global_hash, key, d); + LRWKU(_ecore_thread_global_hash_lock); + CDB(_ecore_thread_global_hash_cond); + return ret; +#else + (void) cb; + (void) direct; + return EINA_TRUE; +#endif +} + +EAPI void * +ecore_thread_global_data_set(const char *key, + void *value, + Eina_Free_Cb cb) +{ +#ifdef EFL_HAVE_THREADS + Ecore_Thread_Data *d, *r; + void *ret; +#endif + + if ((!key) || (!value)) + return NULL; +#ifdef EFL_HAVE_THREADS + LRWKWL(_ecore_thread_global_hash_lock); + if (!_ecore_thread_global_hash) + _ecore_thread_global_hash = eina_hash_string_small_new(_ecore_thread_data_free); + LRWKU(_ecore_thread_global_hash_lock); + + if (!_ecore_thread_global_hash) + return NULL; + + if (!(d = malloc(sizeof(Ecore_Thread_Data)))) + return NULL; + + d->data = value; + d->cb = cb; + + LRWKWL(_ecore_thread_global_hash_lock); + r = eina_hash_set(_ecore_thread_global_hash, key, d); + LRWKU(_ecore_thread_global_hash_lock); + CDB(_ecore_thread_global_hash_cond); + + ret = r->data; + free(r); + return ret; +#else + (void) cb; + return NULL; +#endif +} + +EAPI void * +ecore_thread_global_data_find(const char *key) +{ +#ifdef EFL_HAVE_THREADS + Ecore_Thread_Data *ret; +#endif + + if (!key) + return NULL; +#ifdef EFL_HAVE_THREADS + if (!_ecore_thread_global_hash) return NULL; + + LRWKRL(_ecore_thread_global_hash_lock); + ret = eina_hash_find(_ecore_thread_global_hash, key); + LRWKU(_ecore_thread_global_hash_lock); + if (ret) + return ret->data; + return NULL; +#else + return NULL; +#endif +} + +EAPI Eina_Bool +ecore_thread_global_data_del(const char *key) +{ +#ifdef EFL_HAVE_THREADS + Eina_Bool ret; +#endif + + if (!key) + return EINA_FALSE; +#ifdef EFL_HAVE_THREADS + if (!_ecore_thread_global_hash) + return EINA_FALSE; + + LRWKWL(_ecore_thread_global_hash_lock); + ret = eina_hash_del_by_key(_ecore_thread_global_hash, key); + LRWKU(_ecore_thread_global_hash_lock); + return ret; +#else + return EINA_TRUE; +#endif +} + +EAPI void * +ecore_thread_global_data_wait(const char *key, + double seconds) +{ +#ifdef EFL_HAVE_THREADS + double tm = 0; + Ecore_Thread_Data *ret = NULL; +#endif + + if (!key) + return NULL; +#ifdef EFL_HAVE_THREADS + if (!_ecore_thread_global_hash) + return NULL; + if (seconds > 0) + tm = ecore_time_get() + seconds; + + while (1) + { +#ifndef _WIN32 + struct timespec t = { 0, 0 }; + + t.tv_sec = (long int)tm; + t.tv_nsec = (long int)((tm - (double)t.tv_sec) * 1000000000); +#else + struct timeval t = { 0, 0 }; + + t.tv_sec = (long int)tm; + t.tv_usec = (long int)((tm - (double)t.tv_sec) * 1000000); +#endif + LRWKRL(_ecore_thread_global_hash_lock); + ret = eina_hash_find(_ecore_thread_global_hash, key); + LRWKU(_ecore_thread_global_hash_lock); + if ((ret) || (!seconds) || ((seconds > 0) && (tm <= ecore_time_get()))) + break; + LKL(_ecore_thread_global_hash_mutex); + CDW(_ecore_thread_global_hash_cond, _ecore_thread_global_hash_mutex, &t); + LKU(_ecore_thread_global_hash_mutex); + } + if (ret) return ret->data; + return NULL; +#else + (void) seconds; + return NULL; +#endif +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_throttle.c b/libraries/ecore/src/lib/ecore/ecore_throttle.c new file mode 100644 index 0000000..b5e3133 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_throttle.c @@ -0,0 +1,99 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include "Ecore.h" +#include "ecore_private.h" + +static int throttle_val = 0; + +/** + * @addtogroup Ecore_Throttle_Group Ecore Throttle functions + * + * @{ + */ + +/** + * Increase throttle amount + * + * This will increase or decrease (if @p amount is positive or negative) the + * amount of "voluntary throttling" ecore will do to its main loop while + * running. This is intended to be used to limit animations and wakeups when + * in a strict power management state. The higher the current throttle value + * (which can be retrieved by ecore_throttle_get() ), the more throttling + * takes place. If the current throttle value is 0, then no throttling takes + * place at all. + * + * The value represents how long the ecore main loop will sleep (in seconds) + * before it goes into a fully idle state waiting for events, input or + * timing events to wake it up. For example, if the current throttle level + * is 0.5, then after every time the main loop cycles and goes into idle + * affter processing all events, the main loop will explicitly sleep for 0.5 + * seconds before sitting and waiting for incoming events or timeouts, thus + * preventing animation, async IO and network handling etc. for that period + * of time. Of course these events, data and timeouts will be buffered, + * thus not losing anything, simply delaying when they get handled by the + * throttle value. + * + * Example: + * @code + * void enter_powersave(void) { + * ecore_throttle_adjust(0.2); + * printf("Now at throttle level: %1.3f\n", ecore_throttle_get()); + * } + * + * void enter_deep_powersave(void) { + * ecore_throttle_adjust(0.5); + * printf("Now at throttle level: %1.3f\n", ecore_throttle_get()); + * } + * + * void exit_powersave(void) { + * ecore_throttle_adjust(-0.2); + * printf("Now at throttle level: %1.3f\n", ecore_throttle_get()); + * } + * + * void exit_deep_powersave(void) { + * ecore_throttle_adjust(-0.5); + * printf("Now at throttle level: %1.3f\n", ecore_throttle_get()); + * } + * @endcode + * + * @param amount Amount (in seconds) to adjust by + */ +EAPI void +ecore_throttle_adjust(double amount) +{ + int adj = amount * 1000000.0; + throttle_val += adj; + if (throttle_val < 0) throttle_val = 0; +} + +/** + * Get current throttle level + * + * This gets the current throttling level, which can be adjusted by + * ecore_throttle_adjust(). The value is in seconds. Please see + * ecore_throttle_adjust() for more information. + * + * @return The current throttle level + */ +EAPI double +ecore_throttle_get(void) +{ + return (double)throttle_val / 1000000.0; +} + +/** + * @} + */ + +void +_ecore_throttle(void) +{ + if (throttle_val <= 0) return; + usleep(throttle_val); +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_time.c b/libraries/ecore/src/lib/ecore/ecore_time.c new file mode 100644 index 0000000..8e7611b --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_time.c @@ -0,0 +1,184 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#ifdef HAVE_SYS_TIME_H +# include +#endif + +#ifdef HAVE_EVIL +# include +#endif + +#if defined(__APPLE__) && defined(__MACH__) +# include +#endif + +#include "Ecore.h" +#include "ecore_private.h" + +#include + +#ifdef HAVE_CLOCK_GETTIME +static clockid_t _ecore_time_clock_id = -1; +#elif defined(__APPLE__) && defined(__MACH__) +static double _ecore_time_clock_conversion = 1e-9; +#endif +double _ecore_time_loop_time = -1.0; + +/** + * @addtogroup Ecore_Time_Group + * + * @{ + */ + +/** + * Retrieves the current system time as a floating point value in seconds. + * + * This uses a monotonic clock and thus never goes back in time while + * machine is live (even if user changes time or timezone changes, + * however it may be reset whenever the machine is restarted). + * + * @see ecore_loop_time_get(). + * @see ecore_time_unix_get(). + * + * @return The number of seconds. Start time is not defined (it may be + * when the machine was booted, unix time, etc), all it is + * defined is that it never goes backwards (unless you got big critical + * messages when the application started). + */ +EAPI double +ecore_time_get(void) +{ +#ifdef HAVE_CLOCK_GETTIME + struct timespec t; + + if (EINA_UNLIKELY(_ecore_time_clock_id < 0)) + return ecore_time_unix_get(); + + if (EINA_UNLIKELY(clock_gettime(_ecore_time_clock_id, &t))) + { + CRIT("Cannot get current time."); + /* Try to at least return the latest value retrieved*/ + return _ecore_time_loop_time; + } + + return (double)t.tv_sec + (((double)t.tv_nsec) / 1000000000.0); +#elif defined(HAVE_EVIL) + return evil_time_get(); +#elif defined(__APPLE__) && defined(__MACH__) + return _ecore_time_clock_conversion * (double)mach_absolute_time(); +#else + return ecore_time_unix_get(); +#endif +} + +/** + * Retrieves the current UNIX time as a floating point value in seconds. + * + * @see ecore_time_get(). + * @see ecore_loop_time_get(). + * + * @return The number of seconds since 12.00AM 1st January 1970. + */ +EAPI double +ecore_time_unix_get(void) +{ +#ifdef HAVE_GETTIMEOFDAY + struct timeval timev; + + gettimeofday(&timev, NULL); + return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000); +#else +# error "Your platform isn't supported yet" +#endif +} + +/** + * Retrieves the time at which the last loop stopped waiting for timeouts or + * events. + * + * This gets the time that the main loop ceased waiting for timouts and/or + * events to come in or for signals or any other interrupt source. This should + * be considered a reference point for all time based activity that should + * calculate its timepoint from the return of ecore_loop_time_get(). Use this + * UNLESS you absolutely must get the current actual timepoint - then use + * ecore_time_get(). Note that this time is meant to be used as relative to + * other times obtained on this run. If you need absolute time references, use + * ecore_time_unix_get() instead. + * + * This function can be called before any loop has ever been run, but either + * ecore_init() or ecore_time_get() must have been called once. + * + * @return The number of seconds. Start time is not defined (it may be + * when the machine was booted, unix time, etc), all it is + * defined is that it never goes backwards (unless you got big critical + * messages when the application started). + */ +EAPI double +ecore_loop_time_get(void) +{ + return _ecore_time_loop_time; +} + +/** + * @} + */ + +/********************** Internal methods ********************************/ + +/* TODO: Documentation says "All implementations support the system-wide + * real-time clock, which is identified by CLOCK_REALTIME. Check if the fallback + * to unix time (without specifying the resolution) might be removed + */ +void +_ecore_time_init(void) +{ +#ifdef HAVE_CLOCK_GETTIME + struct timespec t; + + if (_ecore_time_clock_id != -1) return; + + if (!clock_gettime(CLOCK_MONOTONIC, &t)) + { + _ecore_time_clock_id = CLOCK_MONOTONIC; + DBG("using CLOCK_MONOTONIC."); + } + else if (!clock_gettime(CLOCK_REALTIME, &t)) + { + /* may go backwards */ + _ecore_time_clock_id = CLOCK_REALTIME; + WRN("CLOCK_MONOTONIC not available. Fallback to CLOCK_REALTIME."); + } + else + { + _ecore_time_clock_id = -2; + CRIT("Cannot get a valid clock_gettime() clock id! " + "Fallback to unix time."); + } +#else +# ifndef HAVE_EVIL +# if defined(__APPLE__) && defined(__MACH__) + mach_timebase_info_data_t info; + kern_return_t err = mach_timebase_info(&info); + if (err == 0) + { + _ecore_time_clock_conversion = 1e-9 * (double)info.numer / (double)info.denom; + } + else + { + WRN("Unable to get timebase info. Fallback to nanoseconds."); + } +# else +# warning "Your platform isn't supported yet" + CRIT("Platform does not support clock_gettime. " + "Fallback to unix time."); +# endif +# endif +#endif + + _ecore_time_loop_time = ecore_time_get(); +} + diff --git a/libraries/ecore/src/lib/ecore/ecore_timer.c b/libraries/ecore/src/lib/ecore/ecore_timer.c new file mode 100644 index 0000000..9c66545 --- /dev/null +++ b/libraries/ecore/src/lib/ecore/ecore_timer.c @@ -0,0 +1,800 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include "Ecore.h" +#include "ecore_private.h" + +#ifdef WANT_ECORE_TIMER_DUMP +# include +# include +# define ECORE_TIMER_DEBUG_BT_NUM 64 +typedef void (*Ecore_Timer_Bt_Func)(); +#endif + +struct _Ecore_Timer +{ + EINA_INLIST; + ECORE_MAGIC; + double in; + double at; + double pending; + Ecore_Task_Cb func; + void *data; + +#ifdef WANT_ECORE_TIMER_DUMP + Ecore_Timer_Bt_Func timer_bt[ECORE_TIMER_DEBUG_BT_NUM]; + int timer_bt_num; +#endif + + int references; + unsigned char delete_me : 1; + unsigned char just_added : 1; + unsigned char frozen : 1; +}; + +static void _ecore_timer_set(Ecore_Timer *timer, + double at, + double in, + Ecore_Task_Cb func, + void *data); +#ifdef WANT_ECORE_TIMER_DUMP +static int _ecore_timer_cmp(const void *d1, + const void *d2); +#endif + +static int timers_added = 0; +static int timers_delete_me = 0; +static Ecore_Timer *timers = NULL; +static Ecore_Timer *timer_current = NULL; +static Ecore_Timer *suspended = NULL; +static double last_check = 0.0; +static double precision = 10.0 / 1000000.0; + +/** + * @addtogroup Ecore_Time_Group + * + * @{ + */ + +/** + * Retrieves the current precision used by timer infrastructure. + * + * @see ecore_timer_precision_set() + */ +EAPI double +ecore_timer_precision_get(void) +{ + return precision; +} + +/** + * Sets the precision to be used by timer infrastructure. + * + * When system calculates time to expire the next timer we'll be able + * to delay the timer by the given amount so more timers will fit in + * the same dispatch, waking up the system less often and thus being + * able to save power. + * + * Be aware that kernel may delay delivery even further, these delays + * are always possible due other tasks having higher priorities or + * other scheduler policies. + * + * Example: + * We have 2 timers, one that expires in a 2.0s and another that + * expires in 2.1s, if precision is 0.1s, then the Ecore will request + * for the next expire to happen in 2.1s and not 2.0s and another one + * of 0.1 as it would before. + * + * @note Ecore is smart enough to see if there are timers in the + * precision range, if it does not, in our example if no second timer + * in (T + precision) existed, then it would use the minimum timeout. + * + * @param value allowed introduced timeout delay, in seconds. + */ +EAPI void +ecore_timer_precision_set(double value) +{ + _ecore_lock(); + + if (value < 0.0) + { + ERR("Precision %f less than zero, ignored", value); + goto unlock; + } + precision = value; + +unlock: + _ecore_unlock(); +} + +/** + * Creates a timer to call the given function in the given period of time. + * @param in The interval in seconds. + * @param func The given function. If @p func returns 1, the timer is + * rescheduled for the next interval @p in. + * @param data Data to pass to @p func when it is called. + * @return A timer object on success. @c NULL on failure. + * + * This function adds a timer and returns its handle on success and NULL on + * failure. The function @p func will be called every @p in seconds. The + * function will be passed the @p data pointer as its parameter. + * + * When the timer @p func is called, it must return a value of either 1 + * (or ECORE_CALLBACK_RENEW) or 0 (or ECORE_CALLBACK_CANCEL). + * If it returns 1, it will be called again at the next tick, or if it returns + * 0 it will be deleted automatically making any references/handles for it + * invalid. + */ +EAPI Ecore_Timer * +ecore_timer_add(double in, + Ecore_Task_Cb func, + const void *data) +{ + double now; + Ecore_Timer *timer = NULL; + + _ecore_lock(); + if (!func) goto unlock; + if (in < 0.0) in = 0.0; + timer = calloc(1, sizeof(Ecore_Timer)); + if (!timer) goto unlock; + ECORE_MAGIC_SET(timer, ECORE_MAGIC_TIMER); + now = ecore_time_get(); + +#ifdef WANT_ECORE_TIMER_DUMP + timer->timer_bt_num = backtrace((void **)(timer->timer_bt), + ECORE_TIMER_DEBUG_BT_NUM); +#endif + + _ecore_timer_set(timer, now + in, in, func, (void *)data); +unlock: + _ecore_unlock(); + return timer; +} + +/** + * Creates a timer to call the given function in the given period of time. + * @param in The interval in seconds from current loop time. + * @param func The given function. If @p func returns 1, the timer is + * rescheduled for the next interval @p in. + * @param data Data to pass to @p func when it is called. + * @return A timer object on success. @c NULL on failure. + * + * This is the same as ecore_timer_add(), but "now" is the time from + * ecore_loop_time_get() not ecore_time_get() as ecore_timer_add() uses. See + * ecore_timer_add() for more details. + */ +EAPI Ecore_Timer * +ecore_timer_loop_add(double in, + Ecore_Task_Cb func, + const void *data) +{ + Ecore_Timer *timer; + + _ecore_lock(); + timer = _ecore_timer_loop_add(in, func, data); + _ecore_unlock(); + + return timer; +} + +/** + * Delete the specified timer from the timer list. + * @param timer The timer to delete. + * @return The data pointer set for the timer when @ref ecore_timer_add was + * called. @c NULL is returned if the function is unsuccessful. + * + * Note: @p timer must be a valid handle. If the timer function has already + * returned 0, the handle is no longer valid (and does not need to be delete). + */ +EAPI void * +ecore_timer_del(Ecore_Timer *timer) +{ + void *data = NULL; + + _ecore_lock(); + + if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) + { + ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, + "ecore_timer_del"); + goto unlock; + } + + data = _ecore_timer_del(timer); + +unlock: + _ecore_unlock(); + return data; +} + +/** + * Change the interval the timer ticks of. If set during + * a timer call, this will affect the next interval. + * + * @param timer The timer to change. + * @param in The interval in seconds. + */ +EAPI void +ecore_timer_interval_set(Ecore_Timer *timer, + double in) +{ + _ecore_lock(); + + if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) + { + ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, + "ecore_timer_interval_set"); + goto unlock; + } + timer->in = in; +unlock: + _ecore_unlock(); +} + +/** + * Get the interval the timer ticks on. + * + * @param timer The timer to retrieve the interval from + * @return The interval on success. -1 on failure. + */ +EAPI double +ecore_timer_interval_get(Ecore_Timer *timer) +{ + double interval; + + _ecore_lock(); + + if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) + { + ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, + "ecore_timer_interval_get"); + interval = -1.0; + goto unlock; + } + + interval = timer->in; +unlock: + _ecore_unlock(); + return interval; +} + +/** + * Add some delay for the next occurrence of a timer. + * This doesn't affect the interval of a timer. + * + * @param timer The timer to change. + * @param add The dalay to add to the next iteration. + */ +EAPI void +ecore_timer_delay(Ecore_Timer *timer, + double add) +{ + if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) + { + ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, + "ecore_timer_delay"); + return; + } + + _ecore_lock(); + _ecore_timer_delay(timer, add); + _ecore_unlock(); +} + +/** + * Get the pending time regarding a timer. + * + * @param timer The timer to learn from. + * @ingroup Ecore_Time_Group + */ +EAPI double +ecore_timer_pending_get(Ecore_Timer *timer) +{ + double now; + double ret = 0.0; + + _ecore_lock(); + + if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) + { + ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, + "ecore_timer_pending_get"); + goto unlock; + } + + now = ecore_time_get(); + + if (timer->frozen) + ret = timer->pending; + else + ret = timer->at - now; +unlock: + _ecore_unlock(); + return ret; +} + +/** + * Pauses a running timer. + * + * @param timer The timer to be paused. + * + * The timer callback won't be called while the timer is paused. The remaining + * time until the timer expires will be saved, so the timer can be resumed with + * that same remaining time to expire, instead of expiring instantly. Use + * ecore_timer_thaw() to resume it. + * + * @note Nothing happens if the timer was already paused. + * + * @see ecore_timer_thaw() + */ +EAPI void +ecore_timer_freeze(Ecore_Timer *timer) +{ + double now; + + _ecore_lock(); + + if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) + { + ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, + "ecore_timer_freeze"); + goto unlock; + } + + /* Timer already frozen */ + if (timer->frozen) + goto unlock; + + timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer)); + suspended = (Ecore_Timer *)eina_inlist_prepend(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer)); + + now = ecore_time_get(); + + timer->pending = timer->at - now; + timer->at = 0.0; + timer->frozen = 1; +unlock: + _ecore_unlock(); +} + +/** + * Resumes a frozen (paused) timer. + * + * @param timer The timer to be resumed. + * + * The timer will be resumed from its previous relative position in time. That + * means, if it had X seconds remaining until expire when it was paused, it will + * be started now with those same X seconds remaining to expire again. But + * notice that the interval time won't be touched by this call or by + * ecore_timer_freeze(). + * + * @see ecore_timer_freeze() + */ +EAPI void +ecore_timer_thaw(Ecore_Timer *timer) +{ + double now; + + _ecore_lock(); + + if (!ECORE_MAGIC_CHECK(timer, ECORE_MAGIC_TIMER)) + { + ECORE_MAGIC_FAIL(timer, ECORE_MAGIC_TIMER, + "ecore_timer_thaw"); + goto unlock; + } + + /* Timer not frozen */ + if (!timer->frozen) + goto unlock; + + suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer)); + now = ecore_time_get(); + + _ecore_timer_set(timer, timer->pending + now, timer->in, timer->func, timer->data); +unlock: + _ecore_unlock(); +} + +EAPI char * +ecore_timer_dump(void) +{ +#ifdef WANT_ECORE_TIMER_DUMP + Eina_Strbuf *result; + char *out; + Ecore_Timer *tm; + Eina_List *tmp = NULL; + int living_timer = 0; + int unknow_timer = 0; + + _ecore_lock(); + result = eina_strbuf_new(); + + EINA_INLIST_FOREACH(timers, tm) + tmp = eina_list_sorted_insert(tmp, _ecore_timer_cmp, tm); + + EINA_LIST_FREE(tmp, tm) + { + char **strings; + int j; + + if (!tm->frozen && !tm->delete_me) + living_timer++; + + strings = backtrace_symbols((void **)tm->timer_bt, tm->timer_bt_num); + if (tm->timer_bt_num <= 0 || strings == NULL) + { + unknow_timer++; + continue; + } + + eina_strbuf_append_printf(result, "*** timer: %f ***\n", tm->in); + if (tm->frozen) + eina_strbuf_append(result, "FROZEN\n"); + if (tm->delete_me) + eina_strbuf_append(result, "DELETED\n"); + for (j = 0; j < tm->timer_bt_num; j++) + eina_strbuf_append_printf(result, "%s\n", strings[j]); + + free(strings); + } + + eina_strbuf_append_printf(result, "\n***\nThere is %i living timer.\nWe did lost track of %i timers.\n", living_timer, unknow_timer); + + out = eina_strbuf_string_steal(result); + eina_strbuf_free(result); + _ecore_unlock(); + + return out; +#else + return NULL; +#endif +} + +/** + * @} + */ + +Ecore_Timer * +_ecore_timer_loop_add(double in, + Ecore_Task_Cb func, + const void *data) +{ + double now; + Ecore_Timer *timer = NULL; + + if (!func) return timer; + if (in < 0.0) in = 0.0; + timer = calloc(1, sizeof(Ecore_Timer)); + if (!timer) return timer; + ECORE_MAGIC_SET(timer, ECORE_MAGIC_TIMER); + now = ecore_loop_time_get(); + +#ifdef WANT_ECORE_TIMER_DUMP + timer->timer_bt_num = backtrace((void **)(timer->timer_bt), + ECORE_TIMER_DEBUG_BT_NUM); +#endif + _ecore_timer_set(timer, now + in, in, func, (void *)data); + return timer; +} + +EAPI void +_ecore_timer_delay(Ecore_Timer *timer, + double add) +{ + if (timer->frozen) + { + timer->pending += add; + } + else + { + timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer)); + _ecore_timer_set(timer, timer->at + add, timer->in, timer->func, timer->data); + } +} + +void * +_ecore_timer_del(Ecore_Timer *timer) +{ + if (timer->frozen && !timer->references) + { + void *data = timer->data; + + suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer)); + + if (timer->delete_me) + timers_delete_me--; + + free(timer); + return data; + } + + EINA_SAFETY_ON_TRUE_RETURN_VAL(timer->delete_me, NULL); + timer->delete_me = 1; + timers_delete_me++; + return timer->data; +} + +void +_ecore_timer_shutdown(void) +{ + Ecore_Timer *timer; + + while ((timer = timers)) + { + timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timers)); + ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE); + free(timer); + } + + while ((timer = suspended)) + { + suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(suspended)); + ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE); + free(timer); + } + + timer_current = NULL; +} + +void +_ecore_timer_cleanup(void) +{ + Ecore_Timer *l; + int in_use = 0, todo = timers_delete_me, done = 0; + + if (!timers_delete_me) return; + for (l = timers; l; ) + { + Ecore_Timer *timer = l; + + l = (Ecore_Timer *)EINA_INLIST_GET(l)->next; + if (timer->delete_me) + { + if (timer->references) + { + in_use++; + continue; + } + timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer)); + ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE); + free(timer); + timers_delete_me--; + done++; + if (timers_delete_me == 0) return; + } + } + for (l = suspended; l; ) + { + Ecore_Timer *timer = l; + + l = (Ecore_Timer *)EINA_INLIST_GET(l)->next; + if (timer->delete_me) + { + if (timer->references) + { + in_use++; + continue; + } + suspended = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(suspended), EINA_INLIST_GET(timer)); + ECORE_MAGIC_SET(timer, ECORE_MAGIC_NONE); + free(timer); + timers_delete_me--; + done++; + if (timers_delete_me == 0) return; + } + } + + if ((!in_use) && (timers_delete_me)) + { + ERR("%d timers to delete, but they were not found!" + "Stats: todo=%d, done=%d, pending=%d, in_use=%d. " + "reset counter.", + timers_delete_me, todo, done, todo - done, in_use); + timers_delete_me = 0; + } +} + +void +_ecore_timer_enable_new(void) +{ + Ecore_Timer *timer; + + if (!timers_added) return; + timers_added = 0; + EINA_INLIST_FOREACH(timers, timer) timer->just_added = 0; +} + +int +_ecore_timers_exists(void) +{ + Ecore_Timer *timer = timers; + + while ((timer) && (timer->delete_me)) + timer = (Ecore_Timer *)EINA_INLIST_GET(timer)->next; + + return !!timer; +} + +static inline Ecore_Timer * +_ecore_timer_first_get(void) +{ + Ecore_Timer *timer = timers; + + while ((timer) && ((timer->delete_me) || (timer->just_added))) + timer = (Ecore_Timer *)EINA_INLIST_GET(timer)->next; + + return timer; +} + +static inline Ecore_Timer * +_ecore_timer_after_get(Ecore_Timer *base) +{ + Ecore_Timer *timer = (Ecore_Timer *)EINA_INLIST_GET(base)->next; + Ecore_Timer *valid_timer = NULL; + double maxtime = base->at + precision; + + while ((timer) && (timer->at < maxtime)) + { + if (!((timer->delete_me) || (timer->just_added))) + valid_timer = timer; + timer = (Ecore_Timer *)EINA_INLIST_GET(timer)->next; + } + + return valid_timer; +} + +double +_ecore_timer_next_get(void) +{ + double now; + double in; + Ecore_Timer *first, *second; + + first = _ecore_timer_first_get(); + if (!first) return -1; + + second = _ecore_timer_after_get(first); + if (second) first = second; + + now = ecore_loop_time_get(); + in = first->at - now; + if (in < 0) in = 0; + return in; +} + +static inline void +_ecore_timer_reschedule(Ecore_Timer *timer, + double when) +{ + if ((timer->delete_me) || (timer->frozen)) return; + + timers = (Ecore_Timer *)eina_inlist_remove(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer)); + + /* if the timer would have gone off more than 15 seconds ago, + * assume that the system hung and set the timer to go off + * timer->in from now. this handles system hangs, suspends + * and more, so ecore will only "replay" the timers while + * the system is suspended if it is suspended for less than + * 15 seconds (basically). this also handles if the process + * is stopped in a debugger or IO and other handling gets + * really slow within the main loop. + */ + if ((timer->at + timer->in) < (when - 15.0)) + _ecore_timer_set(timer, when + timer->in, timer->in, timer->func, timer->data); + else + _ecore_timer_set(timer, timer->at + timer->in, timer->in, timer->func, timer->data); +} + +/* assume that we hold the ecore lock when entering this function */ +void +_ecore_timer_expired_timers_call(double when) +{ + /* call the first expired timer until no expired timers exist */ + while (_ecore_timer_expired_call(when)) ; +} + +/* assume that we hold the ecore lock when entering this function */ +int +_ecore_timer_expired_call(double when) +{ + if (!timers) return 0; + if (last_check > when) + { + Ecore_Timer *timer; + /* User set time backwards */ + EINA_INLIST_FOREACH(timers, timer) timer->at -= (last_check - when); + } + last_check = when; + + if (!timer_current) + { + /* regular main loop, start from head */ + timer_current = timers; + } + else + { + /* recursive main loop, continue from where we were */ + Ecore_Timer *timer_old = timer_current; + timer_current = (Ecore_Timer *)EINA_INLIST_GET(timer_current)->next; + _ecore_timer_reschedule(timer_old, when); + } + + while (timer_current) + { + Ecore_Timer *timer = timer_current; + + if (timer->at > when) + { + timer_current = NULL; /* ended walk, next should restart. */ + return 0; + } + + if ((timer->just_added) || (timer->delete_me)) + { + timer_current = (Ecore_Timer *)EINA_INLIST_GET(timer_current)->next; + continue; + } + + timer->references++; + if (!_ecore_call_task_cb(timer->func, timer->data)) + { + if (!timer->delete_me) _ecore_timer_del(timer); + } + timer->references--; + + if (timer_current) /* may have changed in recursive main loops */ + timer_current = (Ecore_Timer *)EINA_INLIST_GET(timer_current)->next; + + _ecore_timer_reschedule(timer, when); + } + return 0; +} + +static void +_ecore_timer_set(Ecore_Timer *timer, + double at, + double in, + Ecore_Task_Cb func, + void *data) +{ + Ecore_Timer *t2; + + timers_added = 1; + timer->at = at; + timer->in = in; + timer->func = func; + timer->data = data; + timer->just_added = 1; + timer->frozen = 0; + timer->pending = 0.0; + if (timers) + { + EINA_INLIST_REVERSE_FOREACH(EINA_INLIST_GET(timers), t2) + { + if (timer->at > t2->at) + { + timers = (Ecore_Timer *)eina_inlist_append_relative(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer), EINA_INLIST_GET(t2)); + return; + } + } + } + timers = (Ecore_Timer *)eina_inlist_prepend(EINA_INLIST_GET(timers), EINA_INLIST_GET(timer)); +} + +#ifdef WANT_ECORE_TIMER_DUMP +static int +_ecore_timer_cmp(const void *d1, + const void *d2) +{ + const Ecore_Timer *t1 = d1; + const Ecore_Timer *t2 = d2; + + return (int)((t1->in - t2->in) * 100); +} +#endif diff --git a/libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa.h b/libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa.h new file mode 100644 index 0000000..51c8ead --- /dev/null +++ b/libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa.h @@ -0,0 +1,147 @@ +#ifndef __ECORE_COCOA_H__ +#define __ECORE_COCOA_H__ + +/* + * DO NOT USE THIS HEADER. IT IS WORK IN PROGRESS. IT IS NOT FINAL AND + * THE API MAY CHANGE. + */ + +#ifndef ECORE_COCOA_WIP_GNSIDNQI +# warning "You are using a work in progress API. This API is not stable" +# warning "and is subject to change. You use this at your own risk." +#endif + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +#else +# define EAPI +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window; + +EAPI extern int ECORE_COCOA_EVENT_GOT_FOCUS; +EAPI extern int ECORE_COCOA_EVENT_LOST_FOCUS; +EAPI extern int ECORE_COCOA_EVENT_RESIZE; +EAPI extern int ECORE_COCOA_EVENT_EXPOSE; + +typedef struct _Ecore_Cocoa_Event_Video_Resize Ecore_Cocoa_Event_Video_Resize; +struct _Ecore_Cocoa_Event_Video_Resize +{ + int w; + int h; +}; + + +/* Core */ + +EAPI int ecore_cocoa_init(void); +EAPI int ecore_cocoa_shutdown(void); +EAPI void ecore_cocoa_feed_events(void); + +/* Window */ + +EAPI Ecore_Cocoa_Window *ecore_cocoa_window_new(int x, + int y, + int width, + int height); + +EAPI void ecore_cocoa_window_free(Ecore_Cocoa_Window *window); + +EAPI void *ecore_cocoa_window_hwnd_get(Ecore_Cocoa_Window *window); + +EAPI void ecore_cocoa_window_move(Ecore_Cocoa_Window *window, + int x, + int y); + +EAPI void ecore_cocoa_window_resize(Ecore_Cocoa_Window *window, + int width, + int height); + +EAPI void ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window, + int x, + int y, + int width, + int height); + +EAPI void ecore_cocoa_window_geometry_get(Ecore_Cocoa_Window *window, + int *x, + int *y, + int *width, + int *height); + +EAPI void ecore_cocoa_window_size_get(Ecore_Cocoa_Window *window, + int *width, + int *height); + +EAPI void ecore_cocoa_window_size_min_set(Ecore_Cocoa_Window *window, + unsigned int min_width, + unsigned int min_height); + +EAPI void ecore_cocoa_window_size_min_get(Ecore_Cocoa_Window *window, + unsigned int *min_width, + unsigned int *min_height); + +EAPI void ecore_cocoa_window_size_max_set(Ecore_Cocoa_Window *window, + unsigned int max_width, + unsigned int max_height); + +EAPI void ecore_cocoa_window_size_max_get(Ecore_Cocoa_Window *window, + unsigned int *max_width, + unsigned int *max_height); + +EAPI void ecore_cocoa_window_size_base_set(Ecore_Cocoa_Window *window, + unsigned int base_width, + unsigned int base_height); + +EAPI void ecore_cocoa_window_size_base_get(Ecore_Cocoa_Window *window, + unsigned int *base_width, + unsigned int *base_height); + +EAPI void ecore_cocoa_window_size_step_set(Ecore_Cocoa_Window *window, + unsigned int step_width, + unsigned int step_height); + +EAPI void ecore_cocoa_window_size_step_get(Ecore_Cocoa_Window *window, + unsigned int *step_width, + unsigned int *step_height); + +EAPI void ecore_cocoa_window_show(Ecore_Cocoa_Window *window); + +EAPI void ecore_cocoa_window_hide(Ecore_Cocoa_Window *window); + +EAPI void ecore_cocoa_window_raise(Ecore_Cocoa_Window *window); + +EAPI void ecore_cocoa_window_lower(Ecore_Cocoa_Window *window); + +EAPI void ecore_cocoa_window_title_set(Ecore_Cocoa_Window *window, + const char *title); + +EAPI void ecore_cocoa_window_focus_set(Ecore_Cocoa_Window *window); + +EAPI void ecore_cocoa_window_iconified_set(Ecore_Cocoa_Window *window, + int on); + +EAPI void ecore_cocoa_window_borderless_set(Ecore_Cocoa_Window *window, + int on); + +EAPI void ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window, + void *view); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h b/libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h new file mode 100644 index 0000000..7068bc2 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_cocoa/Ecore_Cocoa_Keys.h @@ -0,0 +1,285 @@ +#ifndef ECORE_COCOA_KEYS_H__ +#define ECORE_COCOA_KEYS_H__ + +struct _ecore_cocoa_keys_s +{ + int code; + const char *name; + const char *compose; +}; + +static const struct _ecore_cocoa_keys_s keystable[] = +{ + +{ 0, "0x00", "" }, +{ 0, "First", "" }, +{ 3, "Return", "\015" }, +{ 8, "BackSpace", "\010" }, +{ 9, "Tab", "\011" }, +{ 12, "Clear", "" }, +{ 13, "Return", "\015" }, +{ 19, "Pause", "" }, +{ 25, "BackTab", ""}, +{ 27, "Escape", "" }, +{ 32, "space", " " }, +{ 33, "exclam", "!" }, +{ 34, "quotedbl", "\"" }, +{ 35, "numbersign", "#" }, +{ 36, "dollar", "$" }, +{ 37, "percent", "%%" }, +{ 38, "ampersand", "&" }, +{ 39, "apostrophe", "'" }, +{ 40, "parenleft", "(" }, +{ 41, "parenright", ")" }, +{ 42, "asterisk", "*" }, +{ 43, "plus", "+" }, +{ 44, "comma", "," }, +{ 45, "minus", "-" }, +{ 46, "period", "." }, +{ 47, "slash", "/" }, +{ 48, "0", "0" }, +{ 49, "1", "1" }, +{ 50, "2", "2" }, +{ 51, "3", "3" }, +{ 52, "4", "4" }, +{ 53, "5", "5" }, +{ 54, "6", "6" }, +{ 55, "7", "7" }, +{ 56, "8", "8" }, +{ 57, "9", "9" }, +{ 58, "colon", ";" }, +{ 59, "semicolon", ";" }, +{ 60, "less", "<" }, +{ 61, "equal", "=" }, +{ 62, "greater", ">" }, +{ 63, "question", "?" }, +{ 64, "at", "@" }, + +{ 91, "bracketleft", "[" }, +{ 92, "backslash", "\\" }, +{ 93, "bracketright", "]" }, +{ 94, "asciicircumm", "^" }, +{ 95, "underscore", "_" }, +{ 96, "backquote", "`" }, +{ 97, "a", "a" }, +{ 98, "b", "b" }, +{ 99, "c", "c" }, +{ 100, "d", "d" }, +{ 101, "e", "e" }, +{ 102, "f", "f" }, +{ 103, "g", "g" }, +{ 104, "h", "h" }, +{ 105, "i", "i" }, +{ 106, "j", "j" }, +{ 107, "k", "k" }, +{ 108, "l", "l" }, +{ 109, "m", "m" }, +{ 110, "n", "n" }, +{ 111, "o", "o" }, +{ 112, "p", "p" }, +{ 113, "q", "q" }, +{ 114, "r", "r" }, +{ 115, "s", "s" }, +{ 116, "t", "t" }, +{ 117, "u", "u" }, +{ 118, "v", "v" }, +{ 119, "w", "w" }, +{ 120, "x", "x" }, +{ 121, "y", "y" }, +{ 122, "z", "z" }, +{ 123, "braceleft", "" }, +{ 124, "pipe", "" }, +{ 125, "braceright", "" }, +{ 127, "Delete", "\177" }, +{ 126, "asciitilde", "~" }, + +{ 160, "w0", "" }, +{ 161, "w1", "" }, +{ 162, "w2", "" }, +{ 163, "w3", "" }, +{ 164, "w4", "" }, +{ 165, "w5", "" }, +{ 166, "w6", "" }, +{ 167, "w7", "" }, +{ 168, "w8", "" }, +{ 169, "w9", "" }, +{ 170, "w10", "" }, +{ 171, "w11", "" }, +{ 172, "w12", "" }, +{ 173, "w13", "" }, +{ 174, "w14", "" }, +{ 175, "w15", "" }, +{ 176, "w16", "" }, +{ 177, "w17", "" }, +{ 178, "w18", "" }, +{ 179, "w19", "" }, +{ 180, "w20", "" }, +{ 181, "w21", "" }, +{ 182, "w22", "" }, +{ 183, "w23", "" }, +{ 184, "w24", "" }, +{ 185, "w25", "" }, +{ 186, "w26", "" }, +{ 187, "w27", "" }, +{ 188, "w28", "" }, +{ 189, "w29", "" }, +{ 190, "w30", "" }, +{ 191, "w31", "" }, +{ 192, "w32", "" }, +{ 193, "w33", "" }, +{ 194, "w34", "" }, +{ 195, "w35", "" }, +{ 196, "w36", "" }, +{ 197, "w37", "" }, +{ 198, "w38", "" }, +{ 199, "w39", "" }, +{ 200, "w40", "" }, +{ 201, "w41", "" }, +{ 202, "w42", "" }, +{ 203, "w43", "" }, +{ 204, "w44", "" }, +{ 205, "w45", "" }, +{ 206, "w46", "" }, +{ 207, "w47", "" }, +{ 208, "w48", "" }, +{ 209, "w49", "" }, +{ 210, "w50", "" }, +{ 211, "w51", "" }, +{ 212, "w52", "" }, +{ 213, "w53", "" }, +{ 214, "w54", "" }, +{ 215, "w55", "" }, +{ 216, "w56", "" }, +{ 217, "w57", "" }, +{ 218, "w58", "" }, +{ 219, "w59", "" }, +{ 220, "w60", "" }, +{ 221, "w61", "" }, +{ 222, "w62", "" }, +{ 223, "w63", "" }, +{ 224, "w64", "" }, +{ 225, "w65", "" }, +{ 226, "w66", "" }, +{ 227, "w67", "" }, +{ 228, "w68", "" }, +{ 229, "w69", "" }, +{ 230, "w70", "" }, +{ 231, "w71", "" }, +{ 232, "w72", "" }, +{ 233, "w73", "" }, +{ 234, "w74", "" }, +{ 235, "w75", "" }, +{ 236, "w76", "" }, +{ 237, "w77", "" }, +{ 238, "w78", "" }, +{ 239, "w79", "" }, +{ 240, "w80", "" }, +{ 241, "w81", "" }, +{ 242, "w82", "" }, +{ 243, "w83", "" }, +{ 244, "w84", "" }, +{ 245, "w85", "" }, +{ 246, "w86", "" }, +{ 247, "w87", "" }, +{ 248, "w88", "" }, +{ 249, "w89", "" }, +{ 250, "w90", "" }, +{ 251, "w91", "" }, +{ 252, "w92", "" }, +{ 253, "w93", "" }, +{ 254, "w94", "" }, +{ 255, "w95", "" }, + +{ 256, "KP0", "0" }, +{ 257, "KP1", "1" }, +{ 258, "KP2", "2" }, +{ 259, "KP3", "3" }, +{ 260, "KP4", "4" }, +{ 261, "KP5", "5" }, +{ 262, "KP6", "6" }, +{ 263, "KP7", "7" }, +{ 264, "KP8", "8" }, +{ 265, "KP9", "9" }, +{ 266, "period", "." }, +{ 267, "KP_Divide", "/" }, +{ 268, "KP_Multiply", "*" }, +{ 269, "KP_Minus", "-" }, +{ 270, "KP_Plus", "+" }, +{ 271, "KP_Enter", "\015" }, +{ 272, "KP_Equals", "=" }, + +{ NSUpArrowFunctionKey, "Up", "" }, +{ NSDownArrowFunctionKey, "Down", "" }, +{ NSRightArrowFunctionKey, "Right", "" }, +{ NSLeftArrowFunctionKey, "Left", "" }, +{ NSInsertFunctionKey, "Insert", "" }, +{ NSHomeFunctionKey, "Home", "" }, +{ NSEndFunctionKey, "End", "" }, +{ NSPageUpFunctionKey, "Page_Up", "" }, +{ NSPageDownFunctionKey, "Page_Down", "" }, + +{ NSF1FunctionKey, "F1", "" }, +{ NSF2FunctionKey, "F2", "" }, +{ NSF3FunctionKey, "F3", "" }, +{ NSF4FunctionKey, "F4", "" }, +{ NSF5FunctionKey, "F5", "" }, +{ NSF6FunctionKey, "F6", "" }, +{ NSF7FunctionKey, "F7", "" }, +{ NSF8FunctionKey, "F8", "" }, +{ NSF9FunctionKey, "F9", "" }, +{ NSF10FunctionKey, "F10", "" }, +{ NSF11FunctionKey, "F11", "" }, +{ NSF12FunctionKey, "F12", "" }, +{ NSF13FunctionKey, "F13", "" }, +{ NSF14FunctionKey, "F14", "" }, +{ NSF15FunctionKey, "F15", "" }, +{ NSF16FunctionKey, "F16", "" }, +{ NSF17FunctionKey, "F17", "" }, +{ NSF18FunctionKey, "F18", "" }, +{ NSF19FunctionKey, "F19", "" }, +{ NSF20FunctionKey, "F20", "" }, +{ NSF21FunctionKey, "F21", "" }, +{ NSF22FunctionKey, "F22", "" }, +{ NSF23FunctionKey, "F23", "" }, +{ NSF24FunctionKey, "F24", "" }, +{ NSF25FunctionKey, "F25", "" }, +{ NSF26FunctionKey, "F26", "" }, +{ NSF27FunctionKey, "F27", "" }, +{ NSF28FunctionKey, "F28", "" }, +{ NSF29FunctionKey, "F29", "" }, +{ NSF30FunctionKey, "F30", "" }, +{ NSF31FunctionKey, "F31", "" }, +{ NSF32FunctionKey, "F32", "" }, +{ NSF33FunctionKey, "F33", "" }, +{ NSF34FunctionKey, "F34", "" }, +{ NSF35FunctionKey, "F35", "" }, + +{ NSClearLineFunctionKey, "Num_Lock", "" }, +{ 301, "Caps_Lock", "" }, +{ NSScrollLockFunctionKey, "Scroll_Lock", "" }, +{ 303, "Shift_R", "" }, +{ 304, "Shift_L", "" }, +{ 305, "Control_R", "" }, +{ 306, "Control_L", "" }, +{ 307, "Alt_R", "" }, +{ 308, "Alt_L", "" }, +{ 309, "Meta_R", "" }, +{ 310, "Meta_L", "" }, +{ 311, "Super_L", "" }, +{ 312, "Super_R", "" }, + +{ NSModeSwitchFunctionKey, "Mode", "" }, +{ 314, "Compose", "" }, + +{ NSHelpFunctionKey, "Help", "" }, +{ NSPrintFunctionKey, "Print", "" }, +{ NSSysReqFunctionKey, "SysReq", "" }, +{ NSBreakFunctionKey, "Break", "" }, +{ NSMenuFunctionKey, "Menu", "" }, +{ 320, "Power", "" }, +{ 321, "Euro", "" }, +{ NSUndoFunctionKey, "Undo", "" } + +}; + +#endif /* ECORE_COCOA_KEYS_H__ */ diff --git a/libraries/ecore/src/lib/ecore_cocoa/Makefile.am b/libraries/ecore/src/lib/ecore_cocoa/Makefile.am new file mode 100644 index 0000000..4ac7b11 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_cocoa/Makefile.am @@ -0,0 +1,29 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_input \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_cocoa.la +includes_HEADERS = \ +Ecore_Cocoa.h \ +Ecore_Cocoa_Keys.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_cocoa_la_SOURCES = \ +ecore_cocoa.m \ +ecore_cocoa_window.m + +libecore_cocoa_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@EVAS_LIBS@ \ +@EINA_LIBS@ + +libecore_cocoa_la_LDFLAGS = @cocoa_ldflags@ -version-info @version_info@ @release_info@ + +EXTRA_DIST = ecore_cocoa_private.h diff --git a/libraries/ecore/src/lib/ecore_cocoa/Makefile.in b/libraries/ecore/src/lib/ecore_cocoa/Makefile.in new file mode 100644 index 0000000..ede48a2 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_cocoa/Makefile.in @@ -0,0 +1,823 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_cocoa +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_cocoa_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore/libecore.la \ + $(top_builddir)/src/lib/ecore_input/libecore_input.la +am_libecore_cocoa_la_OBJECTS = ecore_cocoa.lo ecore_cocoa_window.lo +libecore_cocoa_la_OBJECTS = $(am_libecore_cocoa_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_cocoa_la_LINK = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(OBJCLD) $(AM_OBJCFLAGS) \ + $(OBJCFLAGS) $(libecore_cocoa_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +OBJCCOMPILE = $(OBJC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCFLAGS) $(OBJCFLAGS) +LTOBJCCOMPILE = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(OBJC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_OBJCFLAGS) $(OBJCFLAGS) +AM_V_OBJC = $(am__v_OBJC_$(V)) +am__v_OBJC_ = $(am__v_OBJC_$(AM_DEFAULT_VERBOSITY)) +am__v_OBJC_0 = @echo " OBJC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +OBJCLD = $(OBJC) +OBJCLINK = $(LIBTOOL) $(AM_V_lt) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(OBJCLD) $(AM_OBJCFLAGS) $(OBJCFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_OBJCLD = $(am__v_OBJCLD_$(V)) +am__v_OBJCLD_ = $(am__v_OBJCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_OBJCLD_0 = @echo " OBJCLD" $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_cocoa_la_SOURCES) +DIST_SOURCES = $(libecore_cocoa_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_input \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_cocoa.la +includes_HEADERS = \ +Ecore_Cocoa.h \ +Ecore_Cocoa_Keys.h + +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_cocoa_la_SOURCES = \ +ecore_cocoa.m \ +ecore_cocoa_window.m + +libecore_cocoa_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@EVAS_LIBS@ \ +@EINA_LIBS@ + +libecore_cocoa_la_LDFLAGS = @cocoa_ldflags@ -version-info @version_info@ @release_info@ +EXTRA_DIST = ecore_cocoa_private.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .lo .m .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_cocoa/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_cocoa/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_cocoa.la: $(libecore_cocoa_la_OBJECTS) $(libecore_cocoa_la_DEPENDENCIES) + $(AM_V_OBJCLD)$(libecore_cocoa_la_LINK) -rpath $(libdir) $(libecore_cocoa_la_OBJECTS) $(libecore_cocoa_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_cocoa.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_cocoa_window.Plo@am__quote@ + +.m.o: +@am__fastdepOBJC_TRUE@ $(AM_V_OBJC)$(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepOBJC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepOBJC_FALSE@ $(AM_V_OBJC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepOBJC_FALSE@ $(OBJCCOMPILE) -c -o $@ $< + +.m.obj: +@am__fastdepOBJC_TRUE@ $(AM_V_OBJC)$(OBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepOBJC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepOBJC_FALSE@ $(AM_V_OBJC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepOBJC_FALSE@ $(OBJCCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.m.lo: +@am__fastdepOBJC_TRUE@ $(AM_V_OBJC)$(LTOBJCCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepOBJC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepOBJC_FALSE@ $(AM_V_OBJC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepOBJC_FALSE@ DEPDIR=$(DEPDIR) $(OBJCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepOBJC_FALSE@ $(LTOBJCCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa.m b/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa.m new file mode 100644 index 0000000..3f6023a --- /dev/null +++ b/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa.m @@ -0,0 +1,283 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include + +#include +#include +#include + +#include "Ecore_Cocoa.h" +#include "Ecore_Cocoa_Keys.h" + + +EAPI int ECORE_COCOA_EVENT_GOT_FOCUS = 0; +EAPI int ECORE_COCOA_EVENT_LOST_FOCUS = 0; +EAPI int ECORE_COCOA_EVENT_RESIZE = 0; +EAPI int ECORE_COCOA_EVENT_EXPOSE = 0; + +static int _ecore_cocoa_init_count = 0; + +static int old_flags; + +EAPI int +ecore_cocoa_init(void) +{ + if (++_ecore_cocoa_init_count != 1) + return _ecore_cocoa_init_count; + + if (!ecore_event_init()) + return --_ecore_cocoa_init_count; + + NSApplicationLoad(); + + ECORE_COCOA_EVENT_GOT_FOCUS = ecore_event_type_new(); + ECORE_COCOA_EVENT_LOST_FOCUS = ecore_event_type_new(); + ECORE_COCOA_EVENT_RESIZE = ecore_event_type_new(); + ECORE_COCOA_EVENT_EXPOSE = ecore_event_type_new(); + + return _ecore_cocoa_init_count; +} + +/** + * Shuts down the Ecore_Cocoa library. + * @return @c The number of times the system has been initialised without + * being shut down. + * @ingroup Ecore_Cocoa_Library_Group + */ +EAPI int +ecore_cocoa_shutdown(void) +{ + if (--_ecore_cocoa_init_count != 0) + return _ecore_cocoa_init_count; + + ecore_event_shutdown(); + + return _ecore_cocoa_init_count; +} + +EAPI void +ecore_cocoa_feed_events(void) +{ + NSDate *date = [NSDate dateWithTimeIntervalSinceNow:0.001]; + NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask + untilDate:date + inMode:NSDefaultRunLoopMode + dequeue:YES]; + [date release]; + if (!event) return; // SDL loops until null; maybe we should do that too. or not. + + unsigned int time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff); + + switch([event type]) + { + case NSMouseMoved: + case NSLeftMouseDragged: + case NSRightMouseDragged: + case NSOtherMouseDragged: + { + Ecore_Event_Mouse_Move * ev = calloc(1, sizeof(Ecore_Event_Mouse_Move)); + if (!ev) return; + ev->x = [event locationInWindow].x; + ev->y = [event locationInWindow].y; + ev->root.x = ev->x; + ev->root.y = ev->y; + ev->timestamp = time; + ev->window = [event window]; + ev->modifiers = 0; /* FIXME: keep modifier around. */ + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); + + [NSApp sendEvent:event]; // pass along mouse events, for window manager + break; + } + case NSLeftMouseDown: + case NSRightMouseDown: + case NSOtherMouseDown: + { + Ecore_Event_Mouse_Button * ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)); + if (!ev) return; + ev->x = [event locationInWindow].x; + ev->y = [event locationInWindow].y; + ev->root.x = ev->x; + ev->root.y = ev->y; + ev->timestamp = time; + ev->buttons = [event buttonNumber] + 1; // Apple indexes buttons from 0 + + if ([event clickCount] == 2) + ev->double_click = 1; + else + ev->double_click = 0; + + if ([event clickCount] >= 3) + ev->triple_click = 1; + else + ev->triple_click = 0; + + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL); + + [NSApp sendEvent:event]; // pass along mouse events, for window manager + break; + } + case NSLeftMouseUp: + case NSRightMouseUp: + case NSOtherMouseUp: + { + Ecore_Event_Mouse_Button * ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)); + if (!ev) return; + ev->x = [event locationInWindow].x; + ev->y = [event locationInWindow].y; + ev->root.x = ev->x; + ev->root.y = ev->y; + ev->timestamp = time; + ev->buttons = [event buttonNumber] + 1; // Apple indexes buttons from 0 + + if ([event clickCount] == 2) + ev->double_click = 1; + else + ev->double_click = 0; + + if ([event clickCount] >= 3) + ev->triple_click = 1; + else + ev->triple_click = 0; + + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL); + + [NSApp sendEvent:event]; // pass along mouse events, for window manager + break; + } + case NSKeyDown: + { + Ecore_Event_Key *ev; + unsigned int i; + + ev = calloc(1, sizeof (Ecore_Event_Key)); + if (!ev) return; + ev->timestamp = time; + + for (i = 0; i < sizeof (keystable) / sizeof (struct _ecore_cocoa_keys_s); ++i) + { + if (keystable[i].code == tolower([[event charactersIgnoringModifiers] characterAtIndex:0])) + { + ev->keyname = keystable[i].name; + ev->string = keystable[i].compose; + + ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL); + return; + } + } + + break; + } + case NSKeyUp: + { + Ecore_Event_Key *ev; + unsigned int i; + + ev = calloc(1, sizeof (Ecore_Event_Key)); + if (!ev) return; + ev->timestamp = time; + + for (i = 0; i < sizeof (keystable) / sizeof (struct _ecore_cocoa_keys_s); ++i) + { + if (keystable[i].code == tolower([[event charactersIgnoringModifiers] characterAtIndex:0])) + { + ev->keyname = keystable[i].name; + ev->string = keystable[i].compose; + + ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL); + return; + } + } + + break; + } + case NSFlagsChanged: + { + int flags = [event modifierFlags]; + + Ecore_Event_Key *evDown = NULL; + Ecore_Event_Key *evUp = NULL; + + evDown = calloc(1, sizeof (Ecore_Event_Key)); + if (!evDown) return; + + evUp = calloc(1, sizeof (Ecore_Event_Key)); + if (!evUp) + { + free(evDown); + return; + } + + // Turn special key flags on + if (flags & NSShiftKeyMask) + evDown->keyname = "Shift_L"; + else if (flags & NSControlKeyMask) + evDown->keyname = "Control_L"; + else if (flags & NSAlternateKeyMask) + evDown->keyname = "Alt_L"; + else if (flags & NSCommandKeyMask) + evDown->keyname = "Super_L"; + else if (flags & NSAlphaShiftKeyMask) + evDown->keyname = "Caps_Lock"; + + if (evDown->keyname) + { + evDown->timestamp = time; + evDown->string = ""; + ecore_event_add(ECORE_EVENT_KEY_DOWN, evDown, NULL, NULL); + old_flags = flags; + break; + } + + int changed_flags = flags ^ old_flags; + + // Turn special key flags off + if (changed_flags & NSShiftKeyMask) + evUp->keyname = "Shift_L"; + else if (changed_flags & NSControlKeyMask) + evUp->keyname = "Control_L"; + else if (changed_flags & NSAlternateKeyMask) + evUp->keyname = "Alt_L"; + else if (changed_flags & NSCommandKeyMask) + evUp->keyname = "Super_L"; + else if (changed_flags & NSAlphaShiftKeyMask) + evUp->keyname = "Caps_Lock"; + + if (evUp->keyname) + { + evUp->timestamp = time; + evUp->string = ""; + ecore_event_add(ECORE_EVENT_KEY_UP, evUp, NULL, NULL); + old_flags = flags; + break; + } + + break; + } + case NSAppKitDefined: + { + if ([event subtype] == NSApplicationActivatedEventType) + ecore_event_add(ECORE_COCOA_EVENT_GOT_FOCUS, NULL, NULL, NULL); + else if ([event subtype] == NSApplicationDeactivatedEventType) + ecore_event_add(ECORE_COCOA_EVENT_LOST_FOCUS, NULL, NULL, NULL); + [NSApp sendEvent:event]; // pass along AppKit events, for window manager + break; + } + case NSScrollWheel: + { + break; + } + default: + { + [NSApp sendEvent:event]; + break; + } + } + + [event release]; +} diff --git a/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa_private.h b/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa_private.h new file mode 100644 index 0000000..0b4cf31 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa_private.h @@ -0,0 +1,11 @@ +#ifndef _ECORE_COCOA_PRIVATE_H +#define _ECORE_COCOA_PRIVATE_H + +struct _Ecore_Cocoa_Window +{ + NSWindow *window; + unsigned int borderless : 1; +}; + + +#endif diff --git a/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa_window.m b/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa_window.m new file mode 100644 index 0000000..2091a69 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_cocoa/ecore_cocoa_window.m @@ -0,0 +1,163 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "Ecore_Cocoa.h" +#include "ecore_cocoa_private.h" + +Ecore_Cocoa_Window * +ecore_cocoa_window_new(int x, + int y, + int width, + int height) +{ + Ecore_Cocoa_Window *w; + + NSWindow *window = [[NSWindow alloc] + initWithContentRect:NSMakeRect(x, y, width, height) + styleMask:(NSTitledWindowMask | + NSClosableWindowMask | + NSResizableWindowMask | + NSMiniaturizableWindowMask) + backing:NSBackingStoreBuffered + defer:NO + screen:nil + ]; + + if (!window) + return NULL; + + [window setBackgroundColor:[NSColor whiteColor]]; + + w = calloc(1, sizeof(Ecore_Cocoa_Window)); + w->window = window; + w->borderless = 0; + + return w; +} + +void +ecore_cocoa_window_free(Ecore_Cocoa_Window *window) +{ + if (!window) + return; + + [window->window release]; + free(window); +} + +void +ecore_cocoa_window_move(Ecore_Cocoa_Window *window, + int x, + int y) +{ + NSRect win_frame; + + if (!window) + return; + + win_frame = [window->window frame]; + win_frame.origin.x = x; + win_frame.origin.y = y; + + [window->window setFrame:win_frame display:YES]; +} + +void +ecore_cocoa_window_resize(Ecore_Cocoa_Window *window, + int width, + int height) +{ + if (!window) + return; + + NSRect win_frame; + + if (!window) + return; + + win_frame = [window->window frame]; + win_frame.size.height = height; + win_frame.size.width = width; + + [window->window setFrame:win_frame display:YES]; +} + +void +ecore_cocoa_window_move_resize(Ecore_Cocoa_Window *window, + int x, + int y, + int width, + int height) +{ + if (!window) + return; + + NSRect win_frame; + + if (!window) + return; + + win_frame = [window->window frame]; + win_frame.size.height = height; + win_frame.size.width = width; + win_frame.origin.x = x; + win_frame.origin.y = y; + + [window->window setFrame:win_frame display:YES]; +} + +void +ecore_cocoa_window_title_set(Ecore_Cocoa_Window *window, const char *title) +{ + if (!window || !title) + return; + + [window->window setTitle:[NSString stringWithUTF8String:title]]; +} + +void +ecore_cocoa_window_show(Ecore_Cocoa_Window *window) +{ + if (!window || [window->window isVisible]) + { + printf("Window(%p) is not visible\n", window->window); + return; + } + + [window->window makeKeyAndOrderFront:NSApp]; +} + +void +ecore_cocoa_window_hide(Ecore_Cocoa_Window *window) +{ + if (!window || ![window->window isVisible]) + return; + + [window->window orderOut:NSApp]; +} + +void +ecore_cocoa_window_borderless_set(Ecore_Cocoa_Window *window, + int on) +{ + if (!window) + return; + + if (on) + [window->window setContentBorderThickness:0.0 + forEdje:NSMinXEdge | NSMinYEdge | NSMaxXEdge | NSMaxYEdge]; +} + +void +ecore_cocoa_window_view_set(Ecore_Cocoa_Window *window, + void *view) +{ + if (!window || !view) + return; + + [[window->window contentView] addSubview:view]; + +} diff --git a/libraries/ecore/src/lib/ecore_con/Ecore_Con.h b/libraries/ecore/src/lib/ecore_con/Ecore_Con.h new file mode 100644 index 0000000..e3b68c4 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_con/Ecore_Con.h @@ -0,0 +1,1801 @@ +#ifndef _ECORE_CON_H +#define _ECORE_CON_H + +#include +#include +#ifdef _WIN32 +# include +#else +# include +#endif +#include + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_ECORE_CON_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif +# else +# define EAPI __declspec(dllimport) +# endif +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif + +/** + * @defgroup Ecore_Con_Group Ecore_Con - Connection functions + * + * The Ecore Connection Library ( @c Ecore_Con ) provides simple mechanisms + * for communications between programs using reliable sockets. It saves + * the programmer from having to worry about file descriptors and waiting + * for incoming connections. + * + * There are two main objects in the @c Ecore_Con library: the @c + * Ecore_Con_Server and the @c Ecore_Con_Client. + * + * The @c Ecore_Con_Server represents a server that can be connected to. + * It is used regardless of whether the program is acting as a server or + * client itself. + * + * To create a listening server call @c ecore_con_server_add(), optionally using + * an ECORE_CON_USE_* encryption type OR'ed with the type for encryption. + * + * To connect to a server, call @c ecore_con_server_connect(). Data can + * then be sent to the server using the @c ecore_con_server_send(). + * + * Functions are described in the following groupings: + * @li @ref Ecore_Con_Lib_Group + * @li @ref Ecore_Con_Server_Group + * @li @ref Ecore_Con_Client_Group + * @li @ref Ecore_Con_Url_Group + * + * Events are described in @ref Ecore_Con_Events_Group. + */ + + +/** + * @defgroup Ecore_Con_Events_Group Events + * + * @li ECORE_CON_CLIENT_ADD: Whenever a client connection is made to an + * @c Ecore_Con_Server, an event of this type is emitted, allowing the + * retrieval of the client's ip with @ref ecore_con_client_ip_get and + * associating data with the client using ecore_con_client_data_set. + * @li ECORE_CON_EVENT_CLIENT_DEL: Whenever a client connection to an + * @c Ecore_Con_Server, an event of this type is emitted. The contents of + * the data with this event are variable, but if the client object in the data + * is non-null, it must be freed with @ref ecore_con_client_del. + * @li ECORE_CON_EVENT_SERVER_ADD: Whenever a server object is created + * with @ref ecore_con_server_connect, an event of this type is emitted, + * allowing for data to be serialized and sent to the server using + * @ref ecore_con_server_send. At this point, the http handshake has + * occurred. + * @li ECORE_CON_EVENT_SERVER_DEL: Whenever a server object is destroyed, + * usually by the server connection being refused or dropped, an event of this + * type is emitted. The contents of the data with this event are variable, + * but if the server object in the data is non-null, it must be freed + * with @ref ecore_con_server_del. + * @li ECORE_CON_EVENT_CLIENT_DATA: Whenever a client connects to your server + * object and sends data, an event of this type is emitted. The data will contain both + * the size and contents of the message sent by the client. It should be noted that + * data within this object is transient, so it must be duplicated in order to be + * retained. This event will continue to occur until the client has stopped sending its + * message, so a good option for storing this data is an Eina_Strbuf. Once the message has + * been received in full, the client object must be freed with ecore_con_client_free. + * @li ECORE_CON_EVENT_SERVER_DATA: Whenever your server object connects to its destination + * and receives data, an event of this type is emitted. The data will contain both + * the size and contents of the message sent by the server. It should be noted that + * data within this object is transient, so it must be duplicated in order to be + * retained. This event will continue to occur until the server has stopped sending its + * message, so a good option for storing this data is an Eina_Strbuf. Once the message has + * been received in full, the server object must be freed with ecore_con_server_free. + * + */ + +/** + * @defgroup Ecore_Con_Buffer Buffering + * + * As Ecore_Con works on an event driven design, as data arrives, events will + * be produced containing the data that arrived. It is up to the user of + * Ecore_Con to either parse as they go, append to a file to later parse the + * whole file in one go, or append to memory to parse or handle leter. + * + * To help with this Eina has some handy API's. The Eina_Binbuf and + * Eina_Strbuf APIs, abstract dynamic buffer management and make it trivial + * to handle buffers at runtime, without having to manage them. Eina_Binbuf + * makes it possible to create, expand, reset and slice a blob of memory - + * all via API. No system calls, no pointer manipulations and no size + * calculation. + * + * Additional functions include adding content at specified byte positions in + * the buffer, escaping the inputs, find and replace strings. This provides + * extreme flexibility to play around, with a dynamic blob of memory. + * + * It is good to free it (using eina_binbuf_free()) after using it. + * + * Eina_Binbuf compliments Ecore_Con use cases, where dynamic sizes of data + * arrive from the network (think http download in chunks). Using + * Eina_Binbuf provides enough flexibility to handle data as it arrives and + * to defer its processing until desired, without having to think about + * where to store the temporary data and how to manage its size. + * + * An example of how to use these with Ecore_Con follows. + * + * @code + * #include + * #include + * #include + * + * static Eina_Bool + * data_callback(void *data, int type, void *event) + * { + * Ecore_Con_Event_Url_Data *url_data = event; + * if ( url_data->size > 0) + * { + * // append data as it arrives - don't worry where or how it gets stored. + * // Also don't worry about size, expanding, reallocing etc. + * // just keep appending - size is automatically handled. + * + * eina_binbuf_append_length(data, url_data->data, url_data->size); + * + * fprintf(stderr, "Appended %d \n", url_data->size); + * } + * return EINA_TRUE; + * } + * + * + * + * static Eina_Bool + * completion_callback(void *data, int type, void *event) + * { + * Ecore_Con_Event_Url_Complete *url_complete = event; + * printf("download completed with status code: %d\n", url_complete->status); + * + * // get the data back from Eina_Binbuf + * char *ptr = eina_binbuf_string_get(data); + * size_t size = eina_binbuf_length_get(data); + * + * // process data as required (write to file) + * fprintf(stderr, "Size of data = %d bytes\n", size); + * int fd = open("./elm.png", O_CREAT); + * write(fd, ptr, size); + * close(fd); + * + * // free it when done. + * eina_binbuf_free(data); + * + * ecore_main_loop_quit(); + * + * return EINA_TRUE; + * } + * + * + * int + * main(int argc, char **argv) + * { + * + * const char *url = "http://www.enlightenment.org/p/index/d/logo.png"; + * + * ecore_init(); + * ecore_con_init(); + * ecore_con_url_init(); + * + * + * // This is single additional line to manage dynamic network data. + * Eina_Binbuf *data = eina_binbuf_new(); + * Ecore_Con_Url *url_con = ecore_con_url_new(url); + * + * ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, + * completion_callback, + * data); + * ecore_event_handler_add(ECORE_CON_EVENT_URL_DATA, + * data_callback, + * data); + * ecore_con_url_get(url_con); + * + * ecore_main_loop_begin(); + * return 0; + * } + * @endcode + */ + +#ifdef __cplusplus +extern "C" { +#endif +#define ECORE_CON_USE_SSL ECORE_CON_USE_SSL2 +#define ECORE_CON_REMOTE_SYSTEM ECORE_CON_REMOTE_TCP + + +/** + * @typedef Ecore_Con_Server + * A connection handle to a server + * @ingroup Ecore_Con_Server_Group + */ +typedef struct _Ecore_Con_Server Ecore_Con_Server; + +/** + * @typedef Ecore_Con_Client + * A connection handle to a client + * @ingroup Ecore_Con_Client_Group + */ +typedef struct _Ecore_Con_Client Ecore_Con_Client; + +/** + * @typedef Ecore_Con_Url + * A handle to an http upload/download object + * @ingroup Ecore_Con_Url_Group + */ +typedef struct _Ecore_Con_Url Ecore_Con_Url; + + +/** + * @addtogroup Ecore_Con_Events_Group Events + * @{ + */ + +/** + * @typedef Ecore_Con_Event_Client_Add + * Used as the @p data param for the corresponding event + */ +typedef struct _Ecore_Con_Event_Client_Add Ecore_Con_Event_Client_Add; + +/** + * @typedef Ecore_Con_Event_Client_Upgrade + * Used as the @p data param for the corresponding event + * @since 1.1 + */ +typedef struct _Ecore_Con_Event_Client_Upgrade Ecore_Con_Event_Client_Upgrade; + +/** + * @typedef Ecore_Con_Event_Client_Del + * Used as the @p data param for the corresponding event + */ +typedef struct _Ecore_Con_Event_Client_Del Ecore_Con_Event_Client_Del; + +/** + * @typedef Ecore_Con_Event_Client_Error + * Used as the @p data param for the corresponding event + * @since 1.1 + */ +typedef struct _Ecore_Con_Event_Client_Error Ecore_Con_Event_Client_Error; + +/** + * @typedef Ecore_Con_Event_Server_Add + * Used as the @p data param for the corresponding event + */ +typedef struct _Ecore_Con_Event_Server_Add Ecore_Con_Event_Server_Add; + +/** + * @typedef Ecore_Con_Event_Server_Upgrade + * Used as the @p data param for the corresponding event + * @since 1.1 + */ +typedef struct _Ecore_Con_Event_Server_Upgrade Ecore_Con_Event_Server_Upgrade; + +/** + * @typedef Ecore_Con_Event_Server_Del + * Used as the @p data param for the corresponding event + */ +typedef struct _Ecore_Con_Event_Server_Del Ecore_Con_Event_Server_Del; + +/** + * @typedef Ecore_Con_Event_Server_Error + * Used as the @p data param for the corresponding event + * @since 1.1 + */ +typedef struct _Ecore_Con_Event_Server_Error Ecore_Con_Event_Server_Error; + +/** + * @typedef Ecore_Con_Event_Client_Data + * Used as the @p data param for the corresponding event + */ +typedef struct _Ecore_Con_Event_Client_Data Ecore_Con_Event_Client_Data; + +/** + * @typedef Ecore_Con_Event_Server_Data + * Used as the @p data param for the corresponding event + */ +typedef struct _Ecore_Con_Event_Server_Data Ecore_Con_Event_Server_Data; + +/** + * @typedef Ecore_Con_Event_Client_Write + * Used as the @p data param for the corresponding event + * @since 1.1 + */ +typedef struct _Ecore_Con_Event_Client_Write Ecore_Con_Event_Client_Write; + +/** + * @typedef Ecore_Con_Event_Server_Write + * Used as the @p data param for the corresponding event + * @since 1.1 + */ +typedef struct _Ecore_Con_Event_Server_Write Ecore_Con_Event_Server_Write; + +/** + * @typedef Ecore_Con_Event_Url_Data + * Used as the @p data param for the corresponding event + * @ingroup Ecore_Con_Url_Group + */ +typedef struct _Ecore_Con_Event_Url_Data Ecore_Con_Event_Url_Data; + +/** + * @typedef Ecore_Con_Event_Url_Complete + * Used as the @p data param for the corresponding event + * @ingroup Ecore_Con_Url_Group + */ +typedef struct _Ecore_Con_Event_Url_Complete Ecore_Con_Event_Url_Complete; + +/** + * @typedef Ecore_Con_Event_Url_Progress + * Used as the @p data param for the corresponding event + * @ingroup Ecore_Con_Url_Group + */ +typedef struct _Ecore_Con_Event_Url_Progress Ecore_Con_Event_Url_Progress; + +/** + * @struct _Ecore_Con_Event_Client_Add + * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_ADD event + */ +struct _Ecore_Con_Event_Client_Add +{ + Ecore_Con_Client *client; /** the client that connected */ +}; + +/** + * @struct _Ecore_Con_Event_Client_Upgrade + * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_UPGRADE event + * @since 1.1 + */ +struct _Ecore_Con_Event_Client_Upgrade +{ + Ecore_Con_Client *client; /** the client that completed handshake */ +}; + +/** + * @struct _Ecore_Con_Event_Client_Del + * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_DEL event + */ +struct _Ecore_Con_Event_Client_Del +{ + Ecore_Con_Client *client; /** the client that was lost */ +}; + +/** + * @struct _Ecore_Con_Event_Client_Error + * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_ERROR event + */ +struct _Ecore_Con_Event_Client_Error +{ + Ecore_Con_Client *client; /** the client for which an error occurred */ + char *error; /**< the error string describing what happened */ +}; + +/** + * @struct _Ecore_Con_Event_Server_Add + * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_ADD event + */ +struct _Ecore_Con_Event_Server_Add +{ + Ecore_Con_Server *server; /** the server that was connected to */ +}; + +/** + * @struct _Ecore_Con_Event_Server_Upgrade + * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_UPGRADE event + * @since 1.1 + */ +struct _Ecore_Con_Event_Server_Upgrade +{ + Ecore_Con_Server *server; /** the server that was connected to */ +}; + +/** + * @struct _Ecore_Con_Event_Server_Del + * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_DEL event + */ +struct _Ecore_Con_Event_Server_Del +{ + Ecore_Con_Server *server; /** the client that was lost */ +}; + +/** + * @struct _Ecore_Con_Event_Server_Error + * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_ERROR event + */ +struct _Ecore_Con_Event_Server_Error +{ + Ecore_Con_Server *server; /** the server for which an error occurred */ + char *error; /**< the error string describing what happened */ +}; + +/** + * @struct _Ecore_Con_Event_Client_Data + * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_DATA event + */ +struct _Ecore_Con_Event_Client_Data +{ + Ecore_Con_Client *client; /**< the client that connected */ + void *data; /**< the data that the client sent */ + int size; /**< the length of the data sent */ +}; + +/** + * @struct _Ecore_Con_Event_Server_Data + * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_DATA event + */ +struct _Ecore_Con_Event_Server_Data +{ + Ecore_Con_Server *server; /**< the server that was connected to */ + void *data; /**< the data that the server sent */ + int size; /**< the length of the data sent */ +}; + +/** + * @struct _Ecore_Con_Event_Client_Write + * Used as the @p data param for the @ref ECORE_CON_EVENT_CLIENT_WRITE event + */ +struct _Ecore_Con_Event_Client_Write +{ + Ecore_Con_Client *client; /**< the client that connected */ + int size; /**< the length of the data sent */ +}; + +/** + * @struct _Ecore_Con_Event_Server_Write + * Used as the @p data param for the @ref ECORE_CON_EVENT_SERVER_WRITE event + */ +struct _Ecore_Con_Event_Server_Write +{ + Ecore_Con_Server *server; /**< the server that was connected to */ + int size; /**< the length of the data sent */ +}; + +/** + * @struct _Ecore_Con_Event_Url_Data + * Used as the @p data param for the @ref ECORE_CON_EVENT_URL_DATA event + * @ingroup Ecore_Con_Url_Group + */ +struct _Ecore_Con_Event_Url_Data +{ + Ecore_Con_Url *url_con; /**< a pointer to the connection object */ + int size; /**< the size of the current received data (in bytes) */ + unsigned char data[1]; /**< the data received on this event */ +}; + +/** + * @struct _Ecore_Con_Event_Url_Complete + * Used as the @p data param for the @ref ECORE_CON_EVENT_URL_COMPLETE event + * @ingroup Ecore_Con_Url_Group + */ +struct _Ecore_Con_Event_Url_Complete +{ + Ecore_Con_Url *url_con; /**< a pointer to the connection object */ + int status; /**< HTTP status code of the operation (200, 404, 401, etc.) */ +}; + +/** + * @struct _Ecore_Con_Event_Url_Progress + * Used as the @p data param for the @ref ECORE_CON_EVENT_URL_PROGRESS event + * @ingroup Ecore_Con_Url_Group + */ +struct _Ecore_Con_Event_Url_Progress +{ + Ecore_Con_Url *url_con; /**< a pointer to the connection object */ + struct + { + double total; /**< total size of the downloading data (in bytes) */ + double now; /**< current size of the downloading data (in bytes) */ + } down; /**< download info */ + struct + { + double total; /**< total size of the uploading data (in bytes) */ + double now; /**< current size of the uploading data (in bytes) */ + } up; /**< upload info */ +}; + +/** A client has connected to the server */ +EAPI extern int ECORE_CON_EVENT_CLIENT_ADD; +/** A client has disconnected from the server */ +EAPI extern int ECORE_CON_EVENT_CLIENT_DEL; +/** A client experienced an error + * @since 1.1 + */ +EAPI extern int ECORE_CON_EVENT_CLIENT_ERROR; +/** A client connection has been upgraded to SSL + * @since 1.1 + */ +EAPI extern int ECORE_CON_EVENT_CLIENT_UPGRADE; +/** A server was created */ +EAPI extern int ECORE_CON_EVENT_SERVER_ADD; +/** A server connection was lost */ +EAPI extern int ECORE_CON_EVENT_SERVER_DEL; +/** A server experienced an error + * @since 1.1 + */ +EAPI extern int ECORE_CON_EVENT_SERVER_ERROR; +/** A server connection has been upgraded to SSL + * @since 1.1 + */ +EAPI extern int ECORE_CON_EVENT_SERVER_UPGRADE; +/** A server connection has sent data to its client + * @since 1.1 + */ +EAPI extern int ECORE_CON_EVENT_CLIENT_WRITE; +/** A server connection object has sent data + * @since 1.1 + */ +EAPI extern int ECORE_CON_EVENT_SERVER_WRITE; +/** A client connected to the server has sent data */ +EAPI extern int ECORE_CON_EVENT_CLIENT_DATA; +/** A server connection object has data */ +EAPI extern int ECORE_CON_EVENT_SERVER_DATA; +/** A URL object has data */ +EAPI extern int ECORE_CON_EVENT_URL_DATA; +/** A URL object has completed its transfer to and from the server and can be reused */ +EAPI extern int ECORE_CON_EVENT_URL_COMPLETE; +/** A URL object has made progress in its transfer */ +EAPI extern int ECORE_CON_EVENT_URL_PROGRESS; + +/** + * @} + */ + +/** + * @defgroup Ecore_Con_Lib_Group Ecore Connection Library Functions + * + * Utility functions that set up and shut down the Ecore Connection + * library. + * + * There's also ecore_con_lookup() that can be used to make simple asynchronous + * DNS lookups. + * + * A simple example of how to use these functions: + * @li @ref ecore_con_lookup_example_c + * + * @{ + */ + +/** + * @typedef Ecore_Con_Dns_Cb + * A callback type for use with @ref ecore_con_lookup. + */ +typedef void (*Ecore_Con_Dns_Cb)(const char *canonname, + const char *ip, + struct sockaddr *addr, + int addrlen, + void *data); + +/** + * @typedef Ecore_Con_Type + * @enum _Ecore_Con_Type + * Types for an ecore_con client/server object. A correct way to set this type is + * with an ECORE_CON_$TYPE, optionally OR'ed with an ECORE_CON_$USE if encryption is desired, + * and LOAD_CERT if the previously loaded certificate should be used. + * @code + * ECORE_CON_REMOTE_TCP | ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT + * @endcode + * @ingroup Ecore_Con_Server_Group + */ +typedef enum _Ecore_Con_Type +{ + /** Socket in ~/.ecore */ + ECORE_CON_LOCAL_USER = 0, + /** Socket in /tmp */ + ECORE_CON_LOCAL_SYSTEM = 1, + /** Abstract socket */ + ECORE_CON_LOCAL_ABSTRACT = 2, + /** Remote server using TCP */ + ECORE_CON_REMOTE_TCP = 3, + /** Remote multicast server */ + ECORE_CON_REMOTE_MCAST = 4, + /** Remote server using UDP */ + ECORE_CON_REMOTE_UDP = 5, + /** Remote broadcast using UDP */ + ECORE_CON_REMOTE_BROADCAST = 6, + ECORE_CON_REMOTE_NODELAY = 7, + /** Use SSL2: UNSUPPORTED. **/ + ECORE_CON_USE_SSL2 = (1 << 4), + /** Use SSL3 */ + ECORE_CON_USE_SSL3 = (1 << 5), + /** Use TLS */ + ECORE_CON_USE_TLS = (1 << 6), + /** Use both TLS and SSL3 */ + ECORE_CON_USE_MIXED = ECORE_CON_USE_SSL3 | ECORE_CON_USE_TLS, + /** Attempt to use the loaded certificate */ + ECORE_CON_LOAD_CERT = (1 << 7) +} Ecore_Con_Type; + +/** + * Initialises the Ecore_Con library. + * @return Number of times the library has been initialised without being + * shut down. + * + * @note This function already calls ecore_init() internally, so you don't need + * to call it explicitly. + */ +EAPI int ecore_con_init(void); + +/** + * Shuts down the Ecore_Con library. + * @return Number of times the library has been initialised without being + * shut down. + * @note This function already calls ecore_shutdown() internally, so you don't + * need to call it explicitly unless you called ecore_init() explicitly too. + */ +EAPI int ecore_con_shutdown(void); + +/** + * Do an asynchronous DNS lookup. + * + * @param name IP address or server name to translate. + * @param done_cb Callback to notify when done. + * @param data User data to be given to done_cb. + * @return EINA_TRUE if the request did not fail to be set up, EINA_FALSE if it + * failed. + * + * This function performs a DNS lookup on the hostname specified by @p name, + * then calls @p done_cb with the result and the @p data given as parameter. + * The result will be given to the @p done_cb as follows: + * @li @c canonname - the canonical name of the address + * @li @c ip - the resolved ip address + * @li @c addr - a pointer to the socket address + * @li @c addrlen - the length of the socket address, in bytes + * @li @c data - the data pointer given as parameter to ecore_con_lookup() + */ +EAPI Eina_Bool ecore_con_lookup(const char *name, + Ecore_Con_Dns_Cb done_cb, + const void *data); + +/** + * @} + */ + +/** + * @defgroup Ecore_Con_SSL_Group Ecore Connection SSL Functions + * + * @{ + */ +EAPI int ecore_con_ssl_available_get(void); +EAPI Eina_Bool ecore_con_ssl_server_cert_add(Ecore_Con_Server *svr, const char *cert); +EAPI Eina_Bool ecore_con_ssl_server_privkey_add(Ecore_Con_Server *svr, const char *key_file); +EAPI Eina_Bool ecore_con_ssl_server_crl_add(Ecore_Con_Server *svr, const char *crl_file); +EAPI Eina_Bool ecore_con_ssl_server_cafile_add(Ecore_Con_Server *svr, const char *ca_file); +EAPI void ecore_con_ssl_server_verify(Ecore_Con_Server *svr); +EAPI void ecore_con_ssl_server_verify_basic(Ecore_Con_Server *svr); +EAPI Eina_Bool ecore_con_ssl_server_upgrade(Ecore_Con_Server *svr, Ecore_Con_Type compl_type); +EAPI Eina_Bool ecore_con_ssl_client_upgrade(Ecore_Con_Client *cl, Ecore_Con_Type compl_type); + +/** + * @} + */ + +/** + * @defgroup Ecore_Con_Server_Group Ecore Connection Server Functions + * + * This group of functions is applied to an @ref Ecore_Con_Server object. It + * doesn't mean that they should be used in the server application, but on the + * server object. In fact, most of them should be used in the client + * application, when retrieving information or sending data. + * + * Setting up a server is very simple: you just need to start it with + * ecore_con_server_add() and setup some callbacks to the events + * #ECORE_CON_EVENT_CLIENT_ADD, #ECORE_CON_EVENT_CLIENT_DEL and + * #ECORE_CON_EVENT_CLIENT_DATA, that will be called when a client is + * communicating with the server: + * + * @code + * if (!(svr = ecore_con_server_add(ECORE_CON_REMOTE_TCP, "127.0.0.1", 8080, NULL))) + * exit(1); + * + * ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, _add_cb, NULL); + * ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, _del_cb, NULL); + * ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, _data_cb, NULL); + * + * ecore_main_loop_begin(); + * @endcode + * + * The function ecore_con_server_connect() can be used to write a client that + * connects to a server. The resulting code will be very similar to the server + * code: + * + * @code + * if (!(svr = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, "127.0.0.1", 8080, NULL))) + * exit(1); + * + * ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, _add_cb, NULL); + * ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, _del_cb, NULL); + * ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, _data_cb, NULL); + * + * ecore_main_loop_begin(); + * @endcode + * + * After these two pieces of code are executed, respectively, in the server and + * client code, the server will be up and running and the client will try to + * connect to it. The connection, with its subsequent messages being sent from + * server to client and client to server, can be represented in the following + * sequence diagram: + * + * @htmlonly + * + * Full size + * @endhtmlonly + * + * @image rtf ecore_con-client-server.png + * @image latex ecore_con-client-server.eps width=\textwidth + * + * Please notice the important difference between these two codes: the first is + * used for writing a @b server, while the second should be used for writing a + * @b client. + * + * A reference for the @c client functions can be found at @ref + * Ecore_Con_Client_Group. + * + * Examples of usage for this API can be found here: + * @li @ref ecore_con_server_simple_example_c + * @li @ref ecore_con_client_simple_example_c + * + * @{ + */ + +/** + * Creates a server to listen for connections. + * + * @param type The connection type. + * @param name Name to associate with the socket. It is used when + * generating the socket name of a Unix socket, or for + * determining what host to listen on for TCP sockets. + * @c NULL will not be accepted. + * @param port Number to identify socket. When a Unix socket is used, + * it becomes part of the socket name. When a TCP socket + * is used, it is used as the TCP port. + * @param data Data to associate with the created Ecore_Con_Server + * object. + * @return A new Ecore_Con_Server. + * + * The socket on which the server listens depends on the connection + * type: + * @li If @a type is @c ECORE_CON_LOCAL_USER, the server will listen on + * the Unix socket "~/.ecore/[name]/[port]". + * @li If @a type is @c ECORE_CON_LOCAL_SYSTEM, the server will listen + * on Unix socket "/tmp/.ecore_service|[name]|[port]". + * @li If @a type is @c ECORE_CON_REMOTE_TCP, the server will listen + * on TCP port @c port. + * + * More information about the @p type can be found at @ref _Ecore_Con_Type. + * + * The @p data parameter can be fetched later using ecore_con_server_data_get() + * or changed with ecore_con_server_data_set(). + */ +EAPI Ecore_Con_Server *ecore_con_server_add(Ecore_Con_Type type, + const char *name, int port, + const void *data); + +/** + * Creates a connection to the specified server and returns an associated object. + * + * @param type The connection type. + * @param name Name used when determining what socket to connect to. + * It is used to generate the socket name when the socket + * is a Unix socket. It is used as the hostname when + * connecting with a TCP socket. + * @param port Number to identify the socket to connect to. Used when + * generating the socket name for a Unix socket, or as the + * TCP port when connecting to a TCP socket. + * @param data Data to associate with the created Ecore_Con_Server + * object. + * @return A new Ecore_Con_Server. + * + * The socket to which the connection is made depends on the connection type: + * @li If @a type is @c ECORE_CON_LOCAL_USER, the function will + * connect to the server at the Unix socket + * "~/.ecore/[name]/[port]". + * @li If @a type is @c ECORE_CON_LOCAL_SYSTEM, the function will + * connect to the server at the Unix socket + * "/tmp/.ecore_service|[name]|[port]". + * @li If @a type is @c ECORE_CON_REMOTE_TCP, the function will + * connect to the server at the TCP port "[name]:[port]". + * + * More information about the @p type can be found at @ref _Ecore_Con_Type. + * + * This function won't block. It will either succeed, or fail due to invalid + * parameters, failed memory allocation, etc., returning @c NULL on that case. + * + * However, even if this call returns a valid @ref Ecore_Con_Server, the + * connection will only be successfully completed if an event of type + * #ECORE_CON_EVENT_SERVER_ADD is received. If it fails to complete, an + * #ECORE_CON_EVENT_SERVER_DEL will be received. + * + * The @p data parameter can be fetched later using ecore_con_server_data_get() + * or changed with ecore_con_server_data_set(). + */ +EAPI Ecore_Con_Server *ecore_con_server_connect(Ecore_Con_Type type, + const char *name, int port, + const void *data); +/** + * Closes the connection and frees the given server. + * + * @param svr The given server. + * @return Data associated with the server when it was created. + * + * All the clients connected to this server will be disconnected. + * + * @see ecore_con_server_add, ecore_con_server_connect + */ +EAPI void * ecore_con_server_del(Ecore_Con_Server *svr); + +/** + * Retrieves the data associated with the given server. + * + * @param svr The given server. + * @return The associated data. + * + * @see ecore_con_server_data_set() + */ +EAPI void * ecore_con_server_data_get(Ecore_Con_Server *svr); +/** + * Sets the data associated with the given server. + * + * @param svr The given server. + * @param data The data to associate with @p svr + * @return The previously associated data, if any. + * + * @see ecore_con_server_data_get() + */ +EAPI void * ecore_con_server_data_set(Ecore_Con_Server *svr, + void *data); +/** + * Retrieves whether the given server is currently connected. + * + * @param svr The given server. + * @return #EINA_TRUE if the server is connected. #EINA_FALSE otherwise. + */ +EAPI Eina_Bool ecore_con_server_connected_get(Ecore_Con_Server *svr); +/** + * Retrieves the current list of clients. + * + * @param svr The given server. + * @return The list of clients on this server. + * + * Each node in the returned list points to an @ref Ecore_Con_Client. This list + * cannot be modified or freed. It can also change if new clients are connected + * or disconnected, and will become invalid when the server is deleted/freed. + */ +EAPI const Eina_List * ecore_con_server_clients_get(Ecore_Con_Server *svr); + +/** + * Retrieves the name of server. + * + * @param svr The given server. + * @return The name of the server. + * + * The name returned is the name used to connect on this server. + */ +EAPI const char * ecore_con_server_name_get(Ecore_Con_Server *svr); + +/** + * Retrieves the server port in use. + * + * @param svr The given server. + * @return The server port in use. + * + * The port where the server is listening for connections. + */ +EAPI int ecore_con_server_port_get(Ecore_Con_Server *svr); +/** + * @brief Check how long a server has been connected + * + * @param svr The server to check + * @return The total time, in seconds, that the server has been + * connected/running + * + * This function is used to find out the time that has been elapsed since + * ecore_con_server_add() succeeded. + */ +EAPI double ecore_con_server_uptime_get(Ecore_Con_Server *svr); +/** + * Sends the given data to the given server. + * + * @param svr The given server. + * @param data The given data. + * @param size Length of the data, in bytes, to send. + * @return The number of bytes sent. @c 0 will be returned if there is an + * error. + * + * This function will send the given data to the server as soon as the program + * is back to the main loop. Thus, this function returns immediately + * (non-blocking). If the data needs to be sent @b now, call + * ecore_con_server_flush() after this one. + * + * @see ecore_con_client_send() + * @see ecore_con_server_flush() + */ +EAPI int ecore_con_server_send(Ecore_Con_Server *svr, + const void *data, + int size); +/** + * Sets a limit on the number of clients that can be handled concurrently + * by the given server, and a policy on what to do if excess clients try to + * connect. + * + * @param svr The given server. + * @param client_limit The maximum number of clients to handle + * concurrently. -1 means unlimited (default). 0 + * effectively disables the server. + * @param reject_excess_clients Set to 1 to automatically disconnect + * excess clients as soon as they connect if you are + * already handling client_limit clients. Set to 0 + * (default) to just hold off on the "accept()" + * system call until the number of active clients + * drops. This causes the kernel to queue up to 4096 + * connections (or your kernel's limit, whichever is + * lower). + * + * Beware that if you set this once ecore is already running, you may + * already have pending CLIENT_ADD events in your event queue. Those + * clients have already connected and will not be affected by this call. + * Only clients subsequently trying to connect will be affected. + */ +EAPI void ecore_con_server_client_limit_set(Ecore_Con_Server *svr, + int client_limit, + char reject_excess_clients); +/** + * Gets the IP address of a server that has been connected to. + * + * @param svr The given server. + * @return A pointer to an internal string that contains the IP address of + * the connected server in the form "XXX.YYY.ZZZ.AAA" IP notation. + * This string should not be modified or trusted to stay valid after + * deletion for the @p svr object. If no IP is known NULL is returned. + */ +EAPI const char * ecore_con_server_ip_get(Ecore_Con_Server *svr); +/** + * Flushes all pending data to the given server. + * + * @param svr The given server. + * + * This function will block until all data is sent to the server. + * + * @see ecore_con_server_send() + * @see ecore_con_client_flush() + */ +EAPI void ecore_con_server_flush(Ecore_Con_Server *svr); +/** + * Set the default time after which an inactive client will be disconnected + * + * @param svr The server object + * @param timeout The timeout, in seconds, to disconnect after + * + * This function is used by the server to set the default idle timeout on + * clients. If the any of the clients becomes idle for a time higher than this + * value, it will be disconnected. A value of < 1 disables the idle timeout. + * + * This timeout is not affected by the one set by + * ecore_con_client_timeout_set(). A client will be disconnected whenever the + * client or the server timeout is reached. That means, the lower timeout value + * will be used for that client if ecore_con_client_timeout_set() is used on it. + * + * @see ecore_con_server_timeout_get() + * @see ecore_con_client_timeout_set() + */ +EAPI void ecore_con_server_timeout_set(Ecore_Con_Server *svr, double timeout); +/** + * Get the default time after which an inactive client will be disconnected + * + * @param svr The server object + * @return The timeout, in seconds, to disconnect after + * + * This function is used to get the idle timeout for clients. A value of < 1 + * means the idle timeout is disabled. + * + * @see ecore_con_server_timeout_set() + * @see ecore_con_client_timeout_get() + */ +EAPI double ecore_con_server_timeout_get(Ecore_Con_Server *svr); + +/** + * Get the fd that the server is connected to + * + * @param svr The server object + * @return The fd, or -1 on failure + * + * This function returns the fd which is used by the underlying server connection. + * It should not be tampered with unless you REALLY know what you are doing. + * @note This function is only valid for servers created with ecore_con_server_connect() + * @warning Seriously. Don't use this unless you know what you are doing. + * @since 1.1 + */ +EAPI int ecore_con_server_fd_get(Ecore_Con_Server *svr); + +/** + * Get the fd that the client is connected to + * + * @param cl The client object + * @return The fd, or -1 on failure + * + * This function returns the fd which is used by the underlying client connection. + * It should not be tampered with unless you REALLY know what you are doing. + * @since 1.1 + */ +EAPI int ecore_con_client_fd_get(Ecore_Con_Client *cl); +/** + * @} + */ + +/** + * @defgroup Ecore_Con_Client_Group Ecore Connection Client Functions + * + * Functions to communicate with and/or set options on a client. + * + * This set of functions, as explained in @ref Ecore_Con_Server_Group, is used + * to send data to a client, or to set options and get information about this + * client. Most of them should be used on the server, applied on the client + * object. + * + * If you need to implement a client, the way to connect to a server is + * described in @ref Ecore_Con_Server_Group. + * + * An example of usage of these functions can be found at: + * @li @ref ecore_con_client_simple_example_c + * + * @{ + */ + +/** + * Sends the given data to the given client. + * + * @param cl The given client. + * @param data The given data. + * @param size Length of the data, in bytes, to send. + * @return The number of bytes sent. @c 0 will be returned if there is an + * error. + * + * This function will send the given data to the client as soon as the program + * is back to the main loop. Thus, this function returns immediately + * (non-blocking). If the data needs to be sent @b now, call + * ecore_con_client_flush() after this one. + * + * @see ecore_con_server_send() + * @see ecore_con_client_flush() + */ +EAPI int ecore_con_client_send(Ecore_Con_Client *cl, + const void *data, + int size); +/** + * Retrieves the server representing the socket the client has + * connected to. + * + * @param cl The given client. + * @return The server that the client connected to. + */ +EAPI Ecore_Con_Server *ecore_con_client_server_get(Ecore_Con_Client *cl); +/** + * Closes the connection and frees memory allocated to the given client. + * + * @param cl The given client. + * @return Data associated with the client. + */ +EAPI void * ecore_con_client_del(Ecore_Con_Client *cl); +/** + * Sets the data associated with the given client to @p data. + * + * @param cl The given client. + * @param data What to set the data to. + */ +EAPI void ecore_con_client_data_set(Ecore_Con_Client *cl, + const void *data); +/** + * Retrieves the data associated with the given client. + * + * @param cl The given client. + * @return The data associated with @p cl. + */ +EAPI void * ecore_con_client_data_get(Ecore_Con_Client *cl); + +/** + * Gets the IP address of a client that has connected. + * + * @param cl The given client. + * @return A pointer to an internal string that contains the IP address of + * the connected client in the form "XXX.YYY.ZZZ.AAA" IP notation. + * + * The returned string should not be modified, freed or trusted to stay valid + * after deletion for the @p cl object. If no IP is known NULL is returned. + */ +EAPI const char * ecore_con_client_ip_get(Ecore_Con_Client *cl); +/** + * Flushes all pending data to the given client. + * + * @param cl The given client. + * + * This function will block until all data is sent to the server. + * + * @see ecore_con_client_send() + * @see ecore_con_server_flush() + */ +EAPI void ecore_con_client_flush(Ecore_Con_Client *cl); +/** + * @brief Check how long a client has been connected + * + * @param cl The client to check + * @return The total time, in seconds, that the client has been connected to + * the server + * + * This function is used to find out how long a client has been connected for. + */ +EAPI double ecore_con_client_uptime_get(Ecore_Con_Client *cl); +/** + * Get the default time after which the client will be disconnected when + * inactive + * + * @param cl The client object + * @return The timeout, in seconds, to disconnect after + * + * This function is used to get the idle timeout for a client. A value of < 1 + * means the idle timeout is disabled. + * + * @see ecore_con_client_timeout_set() + */ +EAPI double ecore_con_client_timeout_get(Ecore_Con_Client *cl); +/** + * Set the time after which the client will be disconnected when inactive + * + * @param cl The client object + * @param timeout The timeout, in seconds, to disconnect after + * + * This function is used by the server to set the idle timeout on a specific + * client. If the client becomes idle for a time higher than this value, it will + * be disconnected. A value of < 1 disables the idle timeout. + * + * This timeout is not affected by the one set by + * ecore_con_server_timeout_set(). A client will be disconnected whenever the + * client or the server timeout is reached. That means, the lower timeout value + * will be used for that client if ecore_con_server_timeout_set() is used on the + * server. + * + * @see ecore_con_client_timeout_get() + * @see ecore_con_server_timeout_set() + */ +EAPI void ecore_con_client_timeout_set(Ecore_Con_Client *cl, double timeout); +/** + * Returns whether the client is still connected + * + * @param cl The given client. + * @return #EINA_TRUE if connected, else EINA_FALSE + */ +EAPI Eina_Bool ecore_con_client_connected_get(Ecore_Con_Client *cl); +/** + * @brief Return the port that the client has connected to + * + * @param cl The client + * @return The port that @p cl has connected to, or -1 on error + * Use this function to return the port on which a given client has connected. + */ +EAPI int ecore_con_client_port_get(Ecore_Con_Client *cl); + +/** + * @} + */ + +/** + * @defgroup Ecore_Con_Url_Group Ecore URL Connection Functions + * + * Utility functions that set up, use and shut down the Ecore URL + * Connection library. + * + * These functions are a shortcut to make it easy to perform http requests + * (POST, GET, etc). + * + * Brief usage: + * 1. Create an Ecore_Con_Url object with ecore_con_url_new(url); + * 2. Register to receive the #ECORE_CON_EVENT_URL_COMPLETE event + * (and optionally the #ECORE_CON_EVENT_URL_DATA and + * #ECORE_CON_EVENT_URL_PROGRESS event to receive + * the response, e.g. for HTTP/FTP downloads) + * 3. Perform the operation with ecore_con_url_get(...); + * + * Note that it is good to reuse @ref Ecore_Con_Url objects wherever possible, + * but bear in mind that each one can only perform one operation at a time. You + * need to wait for the #ECORE_CON_EVENT_URL_COMPLETE event before re-using or + * destroying the object. + * + * If it's necessary to change the @ref Ecore_Con_Url object url, use + * ecore_con_url_url_set(). + * + * Simple Usage 1 (HTTP GET): + * @code + * ecore_con_url_url_set(url_con, "http://www.google.com"); + * ecore_con_url_get(url_con); + * @endcode + * + * Simple usage 2 (HTTP POST): + * @code + * ecore_con_url_url_set(url_con, "http://www.example.com/post_handler.cgi"); + * ecore_con_url_post(url_con, data, data_length, "multipart/form-data"); + * @endcode + * + * Simple Usage 3 (FTP download): + * @code + * fd = creat(filename, 0644) + * ecore_con_url_url_set(url_con, "ftp://ftp.example.com/pub/myfile"); + * ecore_con_url_fd_set(url_con, fd); + * ecore_con_url_get(url_con); + * @endcode + * + * Simple Usage 4 (FTP upload as ftp://ftp.example.com/file): + * @code + * ecore_con_url_url_set(url_con, "ftp://ftp.example.com"); + * ecore_con_url_ftp_upload(url_con, "/tmp/file", "user", "pass", NULL); + * @endcode + * + * Simple Usage 5 (FTP upload as ftp://ftp.example.com/dir/file): + * @code + * ecore_con_url_url_set(url_con, "ftp://ftp.example.com"); + * ecore_con_url_ftp_upload(url_con, "/tmp/file", "user", "pass","dir"); + * @endcode + * + * These are complete examples for the API: + * @li @ref ecore_con_url_download_example.c "Downloading a file" + * @li @ref ecore_con_url_headers_example.c "Setting many options for the + * connection" + * + * @{ + */ + +/** + * @typedef Ecore_Con_Url_Time + * @enum _Ecore_Con_Url_Time + * The type of condition to use when making an HTTP request dependent on time, + * so that headers such as "If-Modified-Since" are used. + */ +typedef enum _Ecore_Con_Url_Time +{ + /** + * Do not place time restrictions on the HTTP requests. + */ + ECORE_CON_URL_TIME_NONE = 0, + /** + * Add the "If-Modified-Since" HTTP header, so that the request is performed + * by the server only if the target has been modified since the time value + * passed to it in the request. + */ + ECORE_CON_URL_TIME_IFMODSINCE, + /** + * Add the "If-Unmodified-Since" HTTP header, so that the request is + * performed by the server only if the target has NOT been modified since + * the time value passed to it in the request. + */ + ECORE_CON_URL_TIME_IFUNMODSINCE +} Ecore_Con_Url_Time; + +/** + * Initialises the Ecore_Con_Url library. + * @return Number of times the library has been initialised without being + * shut down. + * + * @note This function doesn't call ecore_con_init(). You still need to call it + * explicitly before calling this one. + */ +EAPI int ecore_con_url_init(void); + +/** + * Shuts down the Ecore_Con_Url library. + * @return Number of calls that still uses Ecore_Con_Url + * + * @note This function doesn't call ecore_con_shutdown(). You still need to call + * it explicitly after calling this one. + */ +EAPI int ecore_con_url_shutdown(void); + +/** + * Enable or disable HTTP 1.1 pipelining. + * @param enable EINA_TRUE will turn it on, EINA_FALSE will disable it. + * + * Pipelining allows to send one request after another one, without having to + * wait for the reply of the first request. The respective replies are received + * in the order that the requests were sent. + * + * Enabling this feature will be valid for all requests done using @c + * ecore_con_url. + * + * See http://en.wikipedia.org/wiki/HTTP_pipelining for more info. + * + * @see ecore_con_url_pipeline_get() + */ +EAPI void ecore_con_url_pipeline_set(Eina_Bool enable); +/** + * Is HTTP 1.1 pipelining enable ? + * @return EINA_TRUE if it is enable. + * + * @see ecore_con_url_pipeline_set() + */ +EAPI Eina_Bool ecore_con_url_pipeline_get(void); + +/** + * Creates and initializes a new Ecore_Con_Url connection object. + * + * @param url URL that will receive requests. Can be changed using + * ecore_con_url_url_set. + * + * @return NULL on error, a new Ecore_Con_Url on success. + * + * Creates and initializes a new Ecore_Con_Url connection object that can be + * used for sending requests. + * + * @see ecore_con_url_custom_new() + * @see ecore_con_url_url_set() + */ +EAPI Ecore_Con_Url * ecore_con_url_new(const char *url); +/** + * Creates a custom connection object. + * + * @param url URL that will receive requests + * @param custom_request Custom request (e.g. GET, POST, HEAD, PUT, etc) + * + * @return NULL on error, a new Ecore_Con_Url on success. + * + * Creates and initializes a new Ecore_Con_Url for a custom request (e.g. HEAD, + * SUBSCRIBE and other obscure HTTP requests). This object should be used like + * one created with ecore_con_url_new(). + * + * @see ecore_con_url_new() + * @see ecore_con_url_url_set() + */ +EAPI Ecore_Con_Url * ecore_con_url_custom_new(const char *url, + const char *custom_request); +/** + * Destroys a Ecore_Con_Url connection object. + * + * @param url_con Connection object to free. + * + * @see ecore_con_url_new() + */ +EAPI void ecore_con_url_free(Ecore_Con_Url *url_con); +/** + * Sets the URL to send the request to. + * + * @param url_con Connection object through which the request will be sent. + * @param url URL that will receive the request + * + * @return EINA_TRUE on success, EINA_FALSE on error. + * + */ +EAPI Eina_Bool ecore_con_url_url_set(Ecore_Con_Url *url_con, + const char *url); +/** + * Gets the URL to send the request to. + * + * @param url_con Connection object through which the request will be sent. + * @return URL that will receive the request, NULL on failure. URL is stringshared. + * @since 1.1 + */ +EAPI const char *ecore_con_url_url_get(Ecore_Con_Url *url_con); +/** + * Associates data with a connection object. + * + * @param url_con Connection object to associate data. + * @param data Data to be set. + * + * Associates data with a connection object, which can be retrieved later with + * ecore_con_url_data_get()). + * + * @see ecore_con_url_data_get() + */ +EAPI void ecore_con_url_data_set(Ecore_Con_Url *url_con, + void *data); +/** + * Retrieves data associated with a Ecore_Con_Url connection object. + * + * @param url_con Connection object to retrieve data from. + * + * @return Data associated with the given object. + * + * Retrieves data associated with a Ecore_Con_Url connection object (previously + * set with ecore_con_url_data_set()). + * + * @see ecore_con_url_data_set() + */ +EAPI void * ecore_con_url_data_get(Ecore_Con_Url *url_con); +/** + * Adds an additional header to the request connection object. + * + * @param url_con Connection object + * @param key Header key + * @param value Header value + * + * Adds an additional header (User-Agent, Content-Type, etc.) to the request + * connection object. This addition will be valid for only one + * ecore_con_url_get() or ecore_con_url_post() call. + * + * Some functions like ecore_con_url_time() also add headers to the request. + * + * @see ecore_con_url_get() + * @see ecore_con_url_post() + * @see ecore_con_url_additional_headers_clear() + */ +EAPI void ecore_con_url_additional_header_add(Ecore_Con_Url *url_con, + const char *key, + const char *value); +/** + * Cleans additional headers. + * + * @param url_con Connection object to clean additional headers. + * + * Cleans additional headers associated with a connection object (previously + * added with ecore_con_url_additional_header_add()). + * + * @see ecore_con_url_additional_header_add() + * @see ecore_con_url_get() + * @see ecore_con_url_post() + */ +EAPI void ecore_con_url_additional_headers_clear(Ecore_Con_Url *url_con); +/** + * Retrieves headers from last request sent. + * + * @param url_con Connection object to retrieve response headers from. + * + * Retrieves a list containing the response headers. This function should be + * used after an ECORE_CON_EVENT_URL_COMPLETE event (headers should normally be + * ready at that time). + * + * @return List of response headers. This list must not be modified by the user. + */ +EAPI const Eina_List * ecore_con_url_response_headers_get(Ecore_Con_Url *url_con); +/** + * Setup a file for receiving response data. + * + * @param url_con Connection object to set file + * @param fd File descriptor associated with the file. A negative value will + * unset any previously set fd. + * + * Sets up a file to have response data written into. Note that + * ECORE_CON_EVENT_URL_DATA events will not be emitted if a file has been set to + * receive the response data. + * + * This call can be used to easily setup a file where the downloaded data will + * be saved. + */ +EAPI void ecore_con_url_fd_set(Ecore_Con_Url *url_con, int fd); +/** + * Retrieves the number of bytes received. + * + * Retrieves the number of bytes received on the last request of the given + * connection object. + * + * @param url_con Connection object which the request was sent on. + * + * @return Number of bytes received on request. + * + * @see ecore_con_url_get() + * @see ecore_con_url_post() + */ +EAPI int ecore_con_url_received_bytes_get(Ecore_Con_Url *url_con); +/** + * Sets url_con to use http auth, with given username and password, "safely" or not. + * + * @param url_con Connection object to perform a request on, previously created + * with ecore_con_url_new() or ecore_con_url_custom_new(). + * @param username Username to use in authentication + * @param password Password to use in authentication + * @param safe Whether to use "safer" methods (eg, NOT http basic auth) + * + * @return #EINA_TRUE on success, #EINA_FALSE on error. + * + * ATTENTION: requires libcurl >= 7.19.1 to work, otherwise will always return 0. + */ +EAPI Eina_Bool ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, + const char *username, + const char *password, + Eina_Bool safe); +/** + * Sends a request. + * + * @param url_con Connection object to perform a request on, previously created + * with ecore_con_url_new() or ecore_con_url_custom_new(). + * @param data Payload (data sent on the request) + * @param length Payload length. If @c -1, rely on automatic length + * calculation via @c strlen() on @p data. + * @param content_type Content type of the payload (e.g. text/xml) + * + * @return #EINA_TRUE on success, #EINA_FALSE on error. + * + * @see ecore_con_url_custom_new() + * @see ecore_con_url_additional_headers_clear() + * @see ecore_con_url_additional_header_add() + * @see ecore_con_url_data_set() + * @see ecore_con_url_data_get() + * @see ecore_con_url_response_headers_get() + * @see ecore_con_url_time() + * @see ecore_con_url_get() + * @see ecore_con_url_post() + * + * @deprecated Use ecore_con_url_post() instead of this. + */ +EINA_DEPRECATED EAPI Eina_Bool ecore_con_url_send(Ecore_Con_Url *url_con, + const void *data, long length, + const char *content_type); +/** + * Sends a get request. + * + * @param url_con Connection object to perform a request on, previously created + * + * @return #EINA_TRUE on success, #EINA_FALSE on error. + * + * The request is performed immediately, but you need to setup event handlers + * for #ECORE_CON_EVENT_URL_DATA, #ECORE_CON_EVENT_URL_COMPLETE or + * #ECORE_CON_EVENT_URL_PROGRESS to get more information about its result. + * + * @see ecore_con_url_custom_new() + * @see ecore_con_url_additional_headers_clear() + * @see ecore_con_url_additional_header_add() + * @see ecore_con_url_data_set() + * @see ecore_con_url_data_get() + * @see ecore_con_url_response_headers_get() + * @see ecore_con_url_time() + * @see ecore_con_url_post() + */ +EAPI Eina_Bool ecore_con_url_get(Ecore_Con_Url *url_con); +/** + * Sends a post request. + * + * @param url_con Connection object to perform a request on, previously created + * with ecore_con_url_new() or ecore_con_url_custom_new(). + * @param data Payload (data sent on the request). Can be @c NULL. + * @param length Payload length. If @c -1, rely on automatic length + * calculation via @c strlen() on @p data. + * @param content_type Content type of the payload (e.g. text/xml). Can be @c + * NULL. + * + * @return #EINA_TRUE on success, #EINA_FALSE on error. + * + * The request starts immediately, but you need to setup event handlers + * for #ECORE_CON_EVENT_URL_DATA, #ECORE_CON_EVENT_URL_COMPLETE or + * #ECORE_CON_EVENT_URL_PROGRESS to get more information about its result. + * + * This call won't block your main loop. + * + * @see ecore_con_url_custom_new() + * @see ecore_con_url_additional_headers_clear() + * @see ecore_con_url_additional_header_add() + * @see ecore_con_url_data_set() + * @see ecore_con_url_data_get() + * @see ecore_con_url_response_headers_get() + * @see ecore_con_url_time() + * @see ecore_con_url_get() + */ +EAPI Eina_Bool ecore_con_url_post(Ecore_Con_Url *url_con, + const void *data, long length, + const char *content_type); +/** + * Sets whether HTTP requests should be conditional, dependent on + * modification time. + * + * @param url_con Ecore_Con_Url to act upon. + * @param condition Condition to use for HTTP requests. + * @param timestamp Time since 1 Jan 1970 to use in the condition. + * + * This function may set the header "If-Modified-Since" or + * "If-Unmodified-Since", depending on the value of @p time_condition, with the + * value @p timestamp. + * + * @sa ecore_con_url_get() + * @sa ecore_con_url_post() + */ +EAPI void ecore_con_url_time(Ecore_Con_Url *url_con, + Ecore_Con_Url_Time time_condition, + double timestamp); + +/** + * @brief Uploads a file to an ftp site. + * @param url_con The Ecore_Con_Url object to send with + * @param filename The path to the file to send + * @param user The username to log in with + * @param pass The password to log in with + * @param upload_dir The directory to which the file should be uploaded + * @return #EINA_TRUE on success, else #EINA_FALSE. + * Upload @p filename to an ftp server set in @p url_con using @p user + * and @p pass to directory @p upload_dir + */ +EAPI Eina_Bool ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, + const char *filename, + const char *user, + const char *pass, + const char *upload_dir); +/** + * Toggle libcurl's verbose output. + * + * @param url_con Ecore_Con_Url instance which will be acted upon. + * @param verbose Whether or not to enable libcurl's verbose output. + * + * If @p verbose is @c EINA_TRUE, libcurl will output a lot of verbose + * information about its operations, which is useful for + * debugging. The verbose information will be sent to stderr. + */ +EAPI void ecore_con_url_verbose_set(Ecore_Con_Url *url_con, + Eina_Bool verbose); +/** + * Enable or disable EPSV extension + * @return FIXME: To be more documented. + */ +EAPI void ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, + Eina_Bool use_epsv); + +/** + * Enables the cookie engine for subsequent HTTP requests. + * + * @param url_con Ecore_Con_Url instance which will be acted upon. + * + * After this function is called, cookies set by the server in HTTP responses + * will be parsed and stored, as well as sent back to the server in new HTTP + * requests. + * + * @note Even though this function is called @c ecore_con_url_cookies_init(), + * there is no symmetrical shutdown operation. + */ +EAPI void ecore_con_url_cookies_init(Ecore_Con_Url *url_con); +/** + * Controls whether session cookies from previous sessions shall be loaded. + * + * @param url_con Ecore_Con_Url instance which will be acted upon. + * @param ignore If @c EINA_TRUE, ignore session cookies when loading cookies + * from files. If @c EINA_FALSE, all cookies will be loaded. + * + * Session cookies are cookies with no expire date set, which usually means + * they are removed after the current session is closed. + * + * By default, when Ecore_Con_Url loads cookies from a file, all cookies are + * loaded, including session cookies, which, most of the time, were supposed + * to be loaded and valid only for that session. + * + * If @p ignore is set to @c EINA_TRUE, when Ecore_Con_Url loads cookies from + * the files passed to @c ecore_con_url_cookies_file_add(), session cookies + * will not be loaded. + * + * @see ecore_con_url_cookies_file_add() + */ +EAPI void ecore_con_url_cookies_ignore_old_session_set(Ecore_Con_Url *url_con, + Eina_Bool ignore); +/** + * Clears currently loaded cookies. + * @param url_con Ecore_Con_Url instance which will be acted upon. + * + * The cleared cookies are removed and will not be sent in subsequent HTTP + * requests, nor will they be written to the cookiejar file set via + * @c ecore_con_url_cookies_jar_file_set(). + * + * @note This function will initialize the cookie engine if it has not been + * initialized yet. + * @note The cookie files set by ecore_con_url_cookies_file_add() aren't loaded + * immediately, just when the request is started. Thus, if you ask to + * clear the cookies, but has a file already set by that function, the + * cookies will then be loaded and you will have old cookies set. In order + * to don't have any old cookie set, you need to don't call + * ecore_con_url_cookies_file_add() ever on the @p url_con handler, and + * call this function to clear any cookie set by a previous request on + * this handler. + * + * @see ecore_con_url_cookies_session_clear() + * @see ecore_con_url_cookies_ignore_old_session_set() + */ +EAPI void ecore_con_url_cookies_clear(Ecore_Con_Url *url_con); +/** + * Clears currently loaded session cookies. + * + * @param url_con Ecore_Con_Url instance which will be acted upon. + * + * Session cookies are cookies with no expire date set, which usually means + * they are removed after the current session is closed. + * + * The cleared cookies are removed and will not be sent in subsequent HTTP + * requests, nor will they be written to the cookiejar file set via + * @c ecore_con_url_cookies_jar_file_set(). + * + * @note This function will initialize the cookie engine if it has not been + * initialized yet. + * @note The cookie files set by ecore_con_url_cookies_file_add() aren't loaded + * immediately, just when the request is started. Thus, if you ask to + * clear the session cookies, but has a file already set by that function, + * the session cookies will then be loaded and you will have old cookies + * set. In order to don't have any old session cookie set, you need to + * don't call ecore_con_url_cookies_file_add() ever on the @p url_con + * handler, and call this function to clear any session cookie set by a + * previous request on this handler. An easier way to don't use old + * session cookies is by using the function + * ecore_con_url_cookies_ignore_old_session_set(). + * + * @see ecore_con_url_cookies_clear() + * @see ecore_con_url_cookies_ignore_old_session_set() + */ +EAPI void ecore_con_url_cookies_session_clear(Ecore_Con_Url *url_con); +/** + * Adds a file to the list of files from which to load cookies. + * + * @param url_con Ecore_Con_Url instance which will be acted upon. + * @param file_name Name of the file that will be added to the list. + * + * Files must contain cookies defined according to two possible formats: + * + * @li HTTP-style header ("Set-Cookie: ..."). + * @li Netscape/Mozilla cookie data format. + * + * Cookies will only be @b read from this file. If you want to save cookies to a + * file, use ecore_con_url_cookies_jar_file_set(). Also notice that this + * function supports the both types of cookie file cited above, while + * ecore_con_url_cookies_jar_file_set() will save only in the Netscape/Mozilla's + * format. + * + * Please notice that the file will not be read immediately, but rather added + * to a list of files that will be loaded and parsed at a later time. + * + * @note This function will initialize the cookie engine if it has not been + * initialized yet. + * + * @see ecore_con_url_cookies_ignore_old_session_set() + * @see ecore_con_url_cookies_jar_file_set() + */ +EAPI void ecore_con_url_cookies_file_add(Ecore_Con_Url *url_con, + const char * const file_name); +/** + * Sets the name of the file to which all current cookies will be written when + * either cookies are flushed or Ecore_Con is shut down. + * + * @param url_con Ecore_Con_Url instance which will be acted upon. + * @param cookiejar_file File to which the cookies will be written. + * + * @return @c EINA_TRUE is the file name has been set successfully, + * @c EINA_FALSE otherwise. + * + * Cookies are written following Netscape/Mozilla's data format, also known as + * cookie-jar. + * + * Cookies will only be @b saved to this file. If you need to read cookies from + * a file, use ecore_con_url_cookies_file_add() instead. + * + * @note This function will initialize the cookie engine if it has not been + * initialized yet. + * + * @see ecore_con_url_cookies_jar_write() + */ +EAPI Eina_Bool ecore_con_url_cookies_jar_file_set(Ecore_Con_Url *url_con, + const char * const cookiejar_file); +/** + * Writes all current cookies to the cookie jar immediately. + * + * @param url_con Ecore_Con_Url instance which will be acted upon. + * + * A cookie-jar file must have been previously set by + * @c ecore_con_url_jar_file_set, otherwise nothing will be done. + * + * @note This function will initialize the cookie engine if it has not been + * initialized yet. + * + * @see ecore_con_url_cookies_jar_file_set() + */ +EAPI void ecore_con_url_cookies_jar_write(Ecore_Con_Url *url_con); + +EAPI void ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_con, + Eina_Bool verify); +EAPI int ecore_con_url_ssl_ca_set(Ecore_Con_Url *url_con, + const char *ca_path); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/ecore/src/lib/ecore_con/Makefile.am b/libraries/ecore/src/lib/ecore_con/Makefile.am new file mode 100644 index 0000000..300586d --- /dev/null +++ b/libraries/ecore/src/lib/ecore_con/Makefile.am @@ -0,0 +1,45 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_con \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_con \ +@EFL_ECORE_CON_BUILD@ \ +@SSL_CFLAGS@ \ +@CURL_CFLAGS@ \ +@EINA_CFLAGS@ \ +@TLS_CFLAGS@ \ +@CARES_CFLAGS@ \ +@WIN32_CPPFLAGS@ + +lib_LTLIBRARIES = libecore_con.la +includes_HEADERS = Ecore_Con.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_con_la_SOURCES = \ +ecore_con.c \ +ecore_con_ssl.c \ +ecore_con_url.c \ +ecore_con_alloc.c + +if ECORE_HAVE_WIN32 +libecore_con_la_SOURCES += ecore_con_local_win32.c +else +libecore_con_la_SOURCES += ecore_con_local.c +endif + +if HAVE_CARES +libecore_con_la_SOURCES += ecore_con_ares.c +else +libecore_con_la_SOURCES += ecore_con_info.c +endif + +libecore_con_la_CFLAGS = @WIN32_CFLAGS@ +libecore_con_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@SSL_LIBS@ @CURL_LIBS@ @EINA_LIBS@ @TLS_LIBS@ @CARES_LIBS@ @WIN32_LIBS@ + +libecore_con_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ + +EXTRA_DIST = ecore_con_private.h diff --git a/libraries/ecore/src/lib/ecore_con/Makefile.in b/libraries/ecore/src/lib/ecore_con/Makefile.in new file mode 100644 index 0000000..5940a83 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_con/Makefile.in @@ -0,0 +1,909 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@ECORE_HAVE_WIN32_TRUE@am__append_1 = ecore_con_local_win32.c +@ECORE_HAVE_WIN32_FALSE@am__append_2 = ecore_con_local.c +@HAVE_CARES_TRUE@am__append_3 = ecore_con_ares.c +@HAVE_CARES_FALSE@am__append_4 = ecore_con_info.c +subdir = src/lib/ecore_con +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_con_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore/libecore.la +am__libecore_con_la_SOURCES_DIST = ecore_con.c ecore_con_ssl.c \ + ecore_con_url.c ecore_con_alloc.c ecore_con_local_win32.c \ + ecore_con_local.c ecore_con_ares.c ecore_con_info.c +@ECORE_HAVE_WIN32_TRUE@am__objects_1 = libecore_con_la-ecore_con_local_win32.lo +@ECORE_HAVE_WIN32_FALSE@am__objects_2 = \ +@ECORE_HAVE_WIN32_FALSE@ libecore_con_la-ecore_con_local.lo +@HAVE_CARES_TRUE@am__objects_3 = libecore_con_la-ecore_con_ares.lo +@HAVE_CARES_FALSE@am__objects_4 = libecore_con_la-ecore_con_info.lo +am_libecore_con_la_OBJECTS = libecore_con_la-ecore_con.lo \ + libecore_con_la-ecore_con_ssl.lo \ + libecore_con_la-ecore_con_url.lo \ + libecore_con_la-ecore_con_alloc.lo $(am__objects_1) \ + $(am__objects_2) $(am__objects_3) $(am__objects_4) +libecore_con_la_OBJECTS = $(am_libecore_con_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_con_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libecore_con_la_CFLAGS) $(CFLAGS) $(libecore_con_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_con_la_SOURCES) +DIST_SOURCES = $(am__libecore_con_la_SOURCES_DIST) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_con \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_con \ +@EFL_ECORE_CON_BUILD@ \ +@SSL_CFLAGS@ \ +@CURL_CFLAGS@ \ +@EINA_CFLAGS@ \ +@TLS_CFLAGS@ \ +@CARES_CFLAGS@ \ +@WIN32_CPPFLAGS@ + +lib_LTLIBRARIES = libecore_con.la +includes_HEADERS = Ecore_Con.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_con_la_SOURCES = ecore_con.c ecore_con_ssl.c ecore_con_url.c \ + ecore_con_alloc.c $(am__append_1) $(am__append_2) \ + $(am__append_3) $(am__append_4) +libecore_con_la_CFLAGS = @WIN32_CFLAGS@ +libecore_con_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@SSL_LIBS@ @CURL_LIBS@ @EINA_LIBS@ @TLS_LIBS@ @CARES_LIBS@ @WIN32_LIBS@ + +libecore_con_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ +EXTRA_DIST = ecore_con_private.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_con/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_con/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_con.la: $(libecore_con_la_OBJECTS) $(libecore_con_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_con_la_LINK) -rpath $(libdir) $(libecore_con_la_OBJECTS) $(libecore_con_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_alloc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_ares.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_info.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_local.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_local_win32.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_ssl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libecore_con_la-ecore_con_url.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libecore_con_la-ecore_con.lo: ecore_con.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -MT libecore_con_la-ecore_con.lo -MD -MP -MF $(DEPDIR)/libecore_con_la-ecore_con.Tpo -c -o libecore_con_la-ecore_con.lo `test -f 'ecore_con.c' || echo '$(srcdir)/'`ecore_con.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con.Tpo $(DEPDIR)/libecore_con_la-ecore_con.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con.c' object='libecore_con_la-ecore_con.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -c -o libecore_con_la-ecore_con.lo `test -f 'ecore_con.c' || echo '$(srcdir)/'`ecore_con.c + +libecore_con_la-ecore_con_ssl.lo: ecore_con_ssl.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -MT libecore_con_la-ecore_con_ssl.lo -MD -MP -MF $(DEPDIR)/libecore_con_la-ecore_con_ssl.Tpo -c -o libecore_con_la-ecore_con_ssl.lo `test -f 'ecore_con_ssl.c' || echo '$(srcdir)/'`ecore_con_ssl.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_ssl.Tpo $(DEPDIR)/libecore_con_la-ecore_con_ssl.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_ssl.c' object='libecore_con_la-ecore_con_ssl.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -c -o libecore_con_la-ecore_con_ssl.lo `test -f 'ecore_con_ssl.c' || echo '$(srcdir)/'`ecore_con_ssl.c + +libecore_con_la-ecore_con_url.lo: ecore_con_url.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -MT libecore_con_la-ecore_con_url.lo -MD -MP -MF $(DEPDIR)/libecore_con_la-ecore_con_url.Tpo -c -o libecore_con_la-ecore_con_url.lo `test -f 'ecore_con_url.c' || echo '$(srcdir)/'`ecore_con_url.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_url.Tpo $(DEPDIR)/libecore_con_la-ecore_con_url.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_url.c' object='libecore_con_la-ecore_con_url.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -c -o libecore_con_la-ecore_con_url.lo `test -f 'ecore_con_url.c' || echo '$(srcdir)/'`ecore_con_url.c + +libecore_con_la-ecore_con_alloc.lo: ecore_con_alloc.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -MT libecore_con_la-ecore_con_alloc.lo -MD -MP -MF $(DEPDIR)/libecore_con_la-ecore_con_alloc.Tpo -c -o libecore_con_la-ecore_con_alloc.lo `test -f 'ecore_con_alloc.c' || echo '$(srcdir)/'`ecore_con_alloc.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_alloc.Tpo $(DEPDIR)/libecore_con_la-ecore_con_alloc.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_alloc.c' object='libecore_con_la-ecore_con_alloc.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -c -o libecore_con_la-ecore_con_alloc.lo `test -f 'ecore_con_alloc.c' || echo '$(srcdir)/'`ecore_con_alloc.c + +libecore_con_la-ecore_con_local_win32.lo: ecore_con_local_win32.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -MT libecore_con_la-ecore_con_local_win32.lo -MD -MP -MF $(DEPDIR)/libecore_con_la-ecore_con_local_win32.Tpo -c -o libecore_con_la-ecore_con_local_win32.lo `test -f 'ecore_con_local_win32.c' || echo '$(srcdir)/'`ecore_con_local_win32.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_local_win32.Tpo $(DEPDIR)/libecore_con_la-ecore_con_local_win32.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_local_win32.c' object='libecore_con_la-ecore_con_local_win32.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -c -o libecore_con_la-ecore_con_local_win32.lo `test -f 'ecore_con_local_win32.c' || echo '$(srcdir)/'`ecore_con_local_win32.c + +libecore_con_la-ecore_con_local.lo: ecore_con_local.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -MT libecore_con_la-ecore_con_local.lo -MD -MP -MF $(DEPDIR)/libecore_con_la-ecore_con_local.Tpo -c -o libecore_con_la-ecore_con_local.lo `test -f 'ecore_con_local.c' || echo '$(srcdir)/'`ecore_con_local.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_local.Tpo $(DEPDIR)/libecore_con_la-ecore_con_local.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_local.c' object='libecore_con_la-ecore_con_local.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -c -o libecore_con_la-ecore_con_local.lo `test -f 'ecore_con_local.c' || echo '$(srcdir)/'`ecore_con_local.c + +libecore_con_la-ecore_con_ares.lo: ecore_con_ares.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -MT libecore_con_la-ecore_con_ares.lo -MD -MP -MF $(DEPDIR)/libecore_con_la-ecore_con_ares.Tpo -c -o libecore_con_la-ecore_con_ares.lo `test -f 'ecore_con_ares.c' || echo '$(srcdir)/'`ecore_con_ares.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_ares.Tpo $(DEPDIR)/libecore_con_la-ecore_con_ares.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_ares.c' object='libecore_con_la-ecore_con_ares.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -c -o libecore_con_la-ecore_con_ares.lo `test -f 'ecore_con_ares.c' || echo '$(srcdir)/'`ecore_con_ares.c + +libecore_con_la-ecore_con_info.lo: ecore_con_info.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -MT libecore_con_la-ecore_con_info.lo -MD -MP -MF $(DEPDIR)/libecore_con_la-ecore_con_info.Tpo -c -o libecore_con_la-ecore_con_info.lo `test -f 'ecore_con_info.c' || echo '$(srcdir)/'`ecore_con_info.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libecore_con_la-ecore_con_info.Tpo $(DEPDIR)/libecore_con_la-ecore_con_info.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_con_info.c' object='libecore_con_la-ecore_con_info.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libecore_con_la_CFLAGS) $(CFLAGS) -c -o libecore_con_la-ecore_con_info.lo `test -f 'ecore_con_info.c' || echo '$(srcdir)/'`ecore_con_info.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con.c b/libraries/ecore/src/lib/ecore_con/ecore_con.c new file mode 100644 index 0000000..7bd0358 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_con/ecore_con.c @@ -0,0 +1,2600 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_NETINET_TCP_H +# include +#endif + +#ifdef HAVE_NETINET_IN_H +# include +#endif + +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif + +#ifdef HAVE_SYS_UN_H +# include +#endif + +#ifdef HAVE_WS2TCPIP_H +# include +#endif + +#ifdef HAVE_EVIL +# include +#endif + +#include "Ecore.h" +#include "ecore_private.h" +#include "Ecore_Con.h" +#include "ecore_con_private.h" + +static Eina_Bool _ecore_con_client_timer(Ecore_Con_Client *cl); +static void _ecore_con_cl_timer_update(Ecore_Con_Client *cl); + +static Eina_Bool _ecore_con_server_timer(Ecore_Con_Server *svr); +static void _ecore_con_server_timer_update(Ecore_Con_Server *svr); + +static void _ecore_con_cb_tcp_connect(void *data, + Ecore_Con_Info *info); +static void _ecore_con_cb_udp_connect(void *data, + Ecore_Con_Info *info); +static void _ecore_con_cb_tcp_listen(void *data, + Ecore_Con_Info *info); +static void _ecore_con_cb_udp_listen(void *data, + Ecore_Con_Info *info); + +static void _ecore_con_server_free(Ecore_Con_Server *svr); +static void _ecore_con_client_free(Ecore_Con_Client *cl); + +static void _ecore_con_cl_read(Ecore_Con_Server *svr); +static Eina_Bool _ecore_con_svr_tcp_handler(void *data, + Ecore_Fd_Handler *fd_handler); +static Eina_Bool _ecore_con_cl_handler(void *data, + Ecore_Fd_Handler *fd_handler); +static Eina_Bool _ecore_con_cl_udp_handler(void *data, + Ecore_Fd_Handler *fd_handler); +static Eina_Bool _ecore_con_svr_udp_handler(void *data, + Ecore_Fd_Handler *fd_handler); + +static void _ecore_con_svr_cl_read(Ecore_Con_Client *cl); +static Eina_Bool _ecore_con_svr_cl_handler(void *data, + Ecore_Fd_Handler *fd_handler); + +static void _ecore_con_server_flush(Ecore_Con_Server *svr); +static void _ecore_con_client_flush(Ecore_Con_Client *cl); + +static void _ecore_con_event_client_add_free(Ecore_Con_Server *svr, + void *ev); +static void _ecore_con_event_client_del_free(Ecore_Con_Server *svr, + void *ev); +static void _ecore_con_event_client_data_free(Ecore_Con_Server *svr, + void *ev); +static void _ecore_con_event_server_add_free(void *data, + void *ev); +static void _ecore_con_event_server_del_free(void *data, + void *ev); +static void _ecore_con_event_server_data_free(void *data, + void *ev); +static void _ecore_con_event_server_error_free(void *data, + Ecore_Con_Event_Server_Error *e); +static void _ecore_con_event_client_error_free(Ecore_Con_Server *svr, + Ecore_Con_Event_Client_Error *e); +static void _ecore_con_event_server_write_free(void *data, + Ecore_Con_Event_Server_Write *e); +static void _ecore_con_event_client_write_free(Ecore_Con_Server *svr, + Ecore_Con_Event_Client_Write *e); + +static void _ecore_con_lookup_done(void *data, + Ecore_Con_Info *infos); + +static const char * _ecore_con_pretty_ip(struct sockaddr *client_addr); + +EAPI int ECORE_CON_EVENT_CLIENT_ADD = 0; +EAPI int ECORE_CON_EVENT_CLIENT_DEL = 0; +EAPI int ECORE_CON_EVENT_SERVER_ADD = 0; +EAPI int ECORE_CON_EVENT_SERVER_DEL = 0; +EAPI int ECORE_CON_EVENT_CLIENT_DATA = 0; +EAPI int ECORE_CON_EVENT_SERVER_DATA = 0; +EAPI int ECORE_CON_EVENT_CLIENT_WRITE = 0; +EAPI int ECORE_CON_EVENT_SERVER_WRITE = 0; +EAPI int ECORE_CON_EVENT_CLIENT_ERROR = 0; +EAPI int ECORE_CON_EVENT_SERVER_ERROR = 0; + +static Eina_List *servers = NULL; +static int _ecore_con_init_count = 0; +static int _ecore_con_event_count = 0; +int _ecore_con_log_dom = -1; + +EAPI int +ecore_con_init(void) +{ + if (++_ecore_con_init_count != 1) + return _ecore_con_init_count; + +#ifdef HAVE_EVIL + if (!evil_init()) + return --_ecore_con_init_count; + +#endif + + if (!ecore_init()) + return --_ecore_con_init_count; + + _ecore_con_log_dom = eina_log_domain_register + ("ecore_con", ECORE_CON_DEFAULT_LOG_COLOR); + if (_ecore_con_log_dom < 0) + { + EINA_LOG_ERR("Impossible to create a log domain for Ecore Con."); + ecore_shutdown(); + return --_ecore_con_init_count; + } + + ecore_con_mempool_init(); + + ECORE_CON_EVENT_CLIENT_ADD = ecore_event_type_new(); + ECORE_CON_EVENT_CLIENT_DEL = ecore_event_type_new(); + ECORE_CON_EVENT_SERVER_ADD = ecore_event_type_new(); + ECORE_CON_EVENT_SERVER_DEL = ecore_event_type_new(); + ECORE_CON_EVENT_CLIENT_DATA = ecore_event_type_new(); + ECORE_CON_EVENT_SERVER_DATA = ecore_event_type_new(); + ECORE_CON_EVENT_CLIENT_WRITE = ecore_event_type_new(); + ECORE_CON_EVENT_SERVER_WRITE = ecore_event_type_new(); + ECORE_CON_EVENT_CLIENT_ERROR = ecore_event_type_new(); + ECORE_CON_EVENT_SERVER_ERROR = ecore_event_type_new(); + + + eina_magic_string_set(ECORE_MAGIC_CON_SERVER, "Ecore_Con_Server"); + eina_magic_string_set(ECORE_MAGIC_CON_CLIENT, "Ecore_Con_Server"); + eina_magic_string_set(ECORE_MAGIC_CON_URL, "Ecore_Con_Url"); + + /* TODO Remember return value, if it fails, use gethostbyname() */ + ecore_con_ssl_init(); + ecore_con_info_init(); + + return _ecore_con_init_count; +} + +EAPI int +ecore_con_shutdown(void) +{ + Eina_List *l, *l2; + Ecore_Con_Server *svr; + + if (--_ecore_con_init_count != 0) + return _ecore_con_init_count; + + EINA_LIST_FOREACH_SAFE(servers, l, l2, svr) + { + Ecore_Con_Event_Server_Add *ev; + + svr->delete_me = svr->dead = EINA_TRUE; + /* some pointer hacks here to prevent double frees if people are being stupid */ + EINA_LIST_FREE(svr->event_count, ev) + ev->server = NULL; + _ecore_con_server_free(svr); + } + + if (!_ecore_con_event_count) ecore_con_mempool_shutdown(); + + ecore_con_info_shutdown(); + ecore_con_ssl_shutdown(); + eina_log_domain_unregister(_ecore_con_log_dom); + _ecore_con_log_dom = -1; + ecore_shutdown(); +#ifdef HAVE_EVIL + evil_shutdown(); +#endif + + return _ecore_con_init_count; +} + +EAPI Eina_Bool +ecore_con_lookup(const char *name, + Ecore_Con_Dns_Cb done_cb, + const void *data) +{ + Ecore_Con_Server *svr; + Ecore_Con_Lookup *lk; + struct addrinfo hints; + + if (!name || !done_cb) + return EINA_FALSE; + + svr = calloc(1, sizeof(Ecore_Con_Server)); + if (!svr) + return EINA_FALSE; + + lk = malloc(sizeof (Ecore_Con_Lookup)); + if (!lk) + { + free(svr); + return EINA_FALSE; + } + + lk->done_cb = done_cb; + lk->data = data; + + svr->name = strdup(name); + if (!svr->name) + goto on_error; + + svr->type = ECORE_CON_REMOTE_TCP; + svr->port = 1025; + svr->data = lk; + svr->created = EINA_TRUE; + svr->reject_excess_clients = EINA_FALSE; + svr->client_limit = -1; + svr->clients = NULL; + svr->ppid = getpid(); + + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_CANONNAME; + hints.ai_protocol = IPPROTO_TCP; + hints.ai_canonname = NULL; + hints.ai_next = NULL; + hints.ai_addr = NULL; + + if (ecore_con_info_get(svr, _ecore_con_lookup_done, svr, + &hints)) + return EINA_TRUE; + + free(svr->name); +on_error: + free(lk); + free(svr); + return EINA_FALSE; +} + +/** + * @addtogroup Ecore_Con_Server_Group Ecore Connection Server Functions + * + * Functions that operate on Ecore server objects. + * + * @{ + */ + +/** + * @example ecore_con_server_example.c + * Shows how to write a simple server using the Ecore_Con library. + */ + +EAPI Ecore_Con_Server * +ecore_con_server_add(Ecore_Con_Type compl_type, + const char *name, + int port, + const void *data) +{ + Ecore_Con_Server *svr; + Ecore_Con_Type type; + + if (port < 0 || !name) + return NULL; /* local user socket: FILE: ~/.ecore/[name]/[port] */ + + /* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */ + /* remote system socket: TCP/IP: [name]:[port] */ + svr = calloc(1, sizeof(Ecore_Con_Server)); + if (!svr) + return NULL; + + svr->name = strdup(name); + if (!svr->name) + goto error; + + svr->type = compl_type; + svr->port = port; + svr->data = (void *)data; + svr->created = EINA_TRUE; + if (compl_type & ECORE_CON_LOAD_CERT) + svr->use_cert = EINA_TRUE; + svr->reject_excess_clients = EINA_FALSE; + svr->client_limit = -1; + svr->clients = NULL; + svr->ppid = getpid(); + if (ecore_con_ssl_server_prepare(svr, compl_type & ECORE_CON_SSL)) + goto error; + + type = compl_type & ECORE_CON_TYPE; + + if ((type == ECORE_CON_LOCAL_USER) || + (type == ECORE_CON_LOCAL_SYSTEM) || + (type == ECORE_CON_LOCAL_ABSTRACT)) + /* Local */ +#ifdef _WIN32 + if (!ecore_con_local_listen(svr)) + goto error; +#else + if (!ecore_con_local_listen(svr, _ecore_con_svr_tcp_handler, svr)) + goto error; +#endif + + if ((type == ECORE_CON_REMOTE_TCP) || + (type == ECORE_CON_REMOTE_NODELAY)) + { + /* TCP */ + if (!ecore_con_info_tcp_listen(svr, _ecore_con_cb_tcp_listen, + svr)) + goto error; + } + else if ((type == ECORE_CON_REMOTE_MCAST) || + (type == ECORE_CON_REMOTE_UDP)) + /* UDP and MCAST */ + if (!ecore_con_info_udp_listen(svr, _ecore_con_cb_udp_listen, + svr)) + goto error; + + servers = eina_list_append(servers, svr); + ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER); + + return svr; + +error: + if (svr->name) + free(svr->name); + + if (svr->path) + free(svr->path); + + + if (svr->fd_handler) + ecore_main_fd_handler_del(svr->fd_handler); + + if (svr->fd > 0) + close(svr->fd); + + if (svr->buf) + eina_binbuf_free(svr->buf); + + if (svr->ip) + eina_stringshare_del(svr->ip); + + ecore_con_ssl_server_shutdown(svr); + free(svr); + return NULL; +} + +EAPI Ecore_Con_Server * +ecore_con_server_connect(Ecore_Con_Type compl_type, + const char *name, + int port, + const void *data) +{ + Ecore_Con_Server *svr; + Ecore_Con_Type type; + + if ((!name) || (!name[0])) + return NULL; + /* local user socket: FILE: ~/.ecore/[name]/[port] */ + /* local system socket: FILE: /tmp/.ecore_service|[name]|[port] */ + /* remote system socket: TCP/IP: [name]:[port] */ + svr = calloc(1, sizeof(Ecore_Con_Server)); + if (!svr) + return NULL; + + svr->name = strdup(name); + if (!svr->name) + goto error; + + svr->type = compl_type; + svr->port = port; + svr->data = (void *)data; + svr->created = EINA_FALSE; + svr->use_cert = (compl_type & ECORE_CON_LOAD_CERT); + svr->reject_excess_clients = EINA_FALSE; + svr->clients = NULL; + svr->client_limit = -1; + if (ecore_con_ssl_server_prepare(svr, compl_type & ECORE_CON_SSL)) + goto error; + + type = compl_type & ECORE_CON_TYPE; + + if (((type == ECORE_CON_REMOTE_TCP) || + (type == ECORE_CON_REMOTE_NODELAY) || + (type == ECORE_CON_REMOTE_UDP) || + (type == ECORE_CON_REMOTE_BROADCAST)) && + (port < 0)) + goto error; + + if ((type == ECORE_CON_LOCAL_USER) || + (type == ECORE_CON_LOCAL_SYSTEM) || + (type == ECORE_CON_LOCAL_ABSTRACT)) + /* Local */ +#ifdef _WIN32 + if (!ecore_con_local_connect(svr, _ecore_con_cl_handler)) + goto error; +#else + if (!ecore_con_local_connect(svr, _ecore_con_cl_handler, svr)) + goto error; +#endif + + if ((type == ECORE_CON_REMOTE_TCP) || + (type == ECORE_CON_REMOTE_NODELAY)) + { + /* TCP */ + if (!ecore_con_info_tcp_connect(svr, _ecore_con_cb_tcp_connect, + svr)) + goto error; + } + else if ((type == ECORE_CON_REMOTE_UDP) || + (type == ECORE_CON_REMOTE_BROADCAST)) + /* UDP and MCAST */ + if (!ecore_con_info_udp_connect(svr, _ecore_con_cb_udp_connect, + svr)) + goto error; + + servers = eina_list_append(servers, svr); + ECORE_MAGIC_SET(svr, ECORE_MAGIC_CON_SERVER); + + return svr; + +error: + if (svr->name) + free(svr->name); + + if (svr->path) + free(svr->path); + + if (svr->fd_handler) + ecore_main_fd_handler_del(svr->fd_handler); + + if (svr->fd > 0) + close(svr->fd); + + ecore_con_ssl_server_shutdown(svr); + free(svr); + return NULL; +} + +EAPI void +ecore_con_server_timeout_set(Ecore_Con_Server *svr, + double timeout) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_timeout_set"); + return; + } + + if (svr->created) + svr->client_disconnect_time = timeout; + else + svr->disconnect_time = timeout; +} + +EAPI double +ecore_con_server_timeout_get(Ecore_Con_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_timeout_get"); + return 0; + } + + return svr->created ? svr->client_disconnect_time : svr->disconnect_time; +} + +EAPI void * +ecore_con_server_del(Ecore_Con_Server *svr) +{ + void *data; + + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_del"); + return NULL; + } + + if (svr->delete_me) + return NULL; + + data = svr->data; + svr->delete_me = EINA_TRUE; + if (svr->event_count) + { + if (svr->fd_handler) + { + ecore_main_fd_handler_del(svr->fd_handler); + svr->fd_handler = NULL; + } + } + else + _ecore_con_server_free(svr); + + return data; +} + +EAPI void * +ecore_con_server_data_get(Ecore_Con_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, + ECORE_MAGIC_CON_SERVER, + "ecore_con_server_data_get"); + return NULL; + } + + return svr->data; +} + +EAPI void * +ecore_con_server_data_set(Ecore_Con_Server *svr, + void *data) +{ + void *ret = NULL; + + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, + ECORE_MAGIC_CON_SERVER, + "ecore_con_server_data_get"); + return NULL; + } + + ret = svr->data; + svr->data = data; + return ret; +} + +EAPI Eina_Bool +ecore_con_server_connected_get(Ecore_Con_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, + "ecore_con_server_connected_get"); + return EINA_FALSE; + } + + if (svr->connecting) + return EINA_FALSE; + + return EINA_TRUE; +} + +EAPI const Eina_List * +ecore_con_server_clients_get(Ecore_Con_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, + "ecore_con_server_clients_get"); + return NULL; + } + + return svr->clients; +} + +EAPI const char * +ecore_con_server_name_get(Ecore_Con_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, + "ecore_con_server_name_get"); + return NULL; + } + + return svr->name; +} + +EAPI int +ecore_con_server_port_get(Ecore_Con_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, + "ecore_con_server_port_get"); + return -1; + } + return svr->port; +} + +EAPI int +ecore_con_server_send(Ecore_Con_Server *svr, + const void *data, + int size) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_send"); + return 0; + } + + EINA_SAFETY_ON_TRUE_RETURN_VAL(svr->dead, 0); + + EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0); + + EINA_SAFETY_ON_TRUE_RETURN_VAL(size < 1, 0); + + if (svr->fd_handler) + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE); + + if (!svr->buf) + { + svr->buf = eina_binbuf_new(); + EINA_SAFETY_ON_NULL_RETURN_VAL(svr->buf, 0); + } + eina_binbuf_append_length(svr->buf, data, size); + + return size; +} + +EAPI void +ecore_con_server_client_limit_set(Ecore_Con_Server *svr, + int client_limit, + char reject_excess_clients) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, + "ecore_con_server_client_limit_set"); + return; + } + + svr->client_limit = client_limit; + svr->reject_excess_clients = reject_excess_clients; +} + +EAPI const char * +ecore_con_server_ip_get(Ecore_Con_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_ip_get"); + return NULL; + } + + return svr->ip; +} + +EAPI double +ecore_con_server_uptime_get(Ecore_Con_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_uptime_get"); + return -1; + } + + return ecore_time_get() - svr->start_time; +} + +EAPI void +ecore_con_server_flush(Ecore_Con_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_server_flush"); + return; + } + + _ecore_con_server_flush(svr); +} + +/** + * @} + */ + +/** + * @addtogroup Ecore_Con_Client_Group Ecore Connection Client Functions + * + * Functions that operate on Ecore connection client objects. + * + * @{ + */ + +/** + * @example ecore_con_client_example.c + * Shows how to write a simple client that connects to the example server. + */ + +EAPI int +ecore_con_client_send(Ecore_Con_Client *cl, + const void *data, + int size) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_send"); + return 0; + } + + EINA_SAFETY_ON_TRUE_RETURN_VAL(cl->dead, 0); + + EINA_SAFETY_ON_NULL_RETURN_VAL(data, 0); + + EINA_SAFETY_ON_TRUE_RETURN_VAL(size < 1, 0); + + if (cl->fd_handler) + ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ | ECORE_FD_WRITE); + + if (cl->host_server && ((cl->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_UDP)) + sendto(cl->host_server->fd, data, size, 0, (struct sockaddr *)cl->client_addr, + cl->client_addr_len); + else if (!cl->buf) + { + cl->buf = eina_binbuf_new(); + EINA_SAFETY_ON_NULL_RETURN_VAL(cl->buf, 0); + } + eina_binbuf_append_length(cl->buf, data, size); + + return size; +} + +EAPI Ecore_Con_Server * +ecore_con_client_server_get(Ecore_Con_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, + "ecore_con_client_server_get"); + return NULL; + } + + return cl->host_server; +} + +EAPI Eina_Bool +ecore_con_client_connected_get(Ecore_Con_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, + "ecore_con_client_connected_get"); + return EINA_FALSE; + } + + return !cl->dead; +} + +EAPI void +ecore_con_client_timeout_set(Ecore_Con_Client *cl, + double timeout) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, + "ecore_con_client_timeout_set"); + return; + } + + cl->disconnect_time = timeout; + + _ecore_con_cl_timer_update(cl); +} + +EAPI double +ecore_con_client_timeout_get(Ecore_Con_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_timeout_get"); + return 0; + } + + return cl->disconnect_time; +} + +EAPI void * +ecore_con_client_del(Ecore_Con_Client *cl) +{ + void *data = NULL; + + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_del"); + return NULL; + } + + data = cl->data; + cl->delete_me = EINA_TRUE; + if (cl->event_count) + { + if (cl->fd_handler) + { + ecore_main_fd_handler_del(cl->fd_handler); + cl->fd_handler = NULL; + } + } + else + { + if (cl->host_server) + { + cl->host_server->clients = eina_list_remove(cl->host_server->clients, cl); + --cl->host_server->client_count; + } + + _ecore_con_client_free(cl); + } + + return data; +} + +EAPI void +ecore_con_client_data_set(Ecore_Con_Client *cl, + const void *data) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, + ECORE_MAGIC_CON_CLIENT, + "ecore_con_client_data_set"); + return; + } + + cl->data = (void *)data; +} + +EAPI void * +ecore_con_client_data_get(Ecore_Con_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, + ECORE_MAGIC_CON_CLIENT, + "ecore_con_client_data_get"); + return NULL; + } + + return cl->data; +} + +EAPI const char * +ecore_con_client_ip_get(Ecore_Con_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_ip_get"); + return NULL; + } + if (!cl->ip) + cl->ip = _ecore_con_pretty_ip(cl->client_addr); + + return cl->ip; +} + +EAPI int +ecore_con_client_port_get(Ecore_Con_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_port_get"); + return -1; + } + if (cl->client_addr->sa_family == AF_INET) + return ((struct sockaddr_in*)cl->client_addr)->sin_port; +#ifdef HAVE_IPV6 + return ((struct sockaddr_in6*)cl->client_addr)->sin6_port; +#else + return -1; +#endif +} + +EAPI double +ecore_con_client_uptime_get(Ecore_Con_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_uptime_get"); + return -1; + } + + return ecore_time_get() - cl->start_time; +} + +EAPI void +ecore_con_client_flush(Ecore_Con_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, "ecore_con_client_flush"); + return; + } + + _ecore_con_client_flush(cl); +} + +EAPI int +ecore_con_server_fd_get(Ecore_Con_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, __func__); + return -1; + } + if (svr->created) return -1; + return ecore_main_fd_handler_fd_get(svr->fd_handler); +} + +EAPI int +ecore_con_client_fd_get(Ecore_Con_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, __func__); + return -1; + } + return ecore_main_fd_handler_fd_get(cl->fd_handler); +} + +/** + * @} + */ + +void +ecore_con_event_server_add(Ecore_Con_Server *svr) +{ + /* we got our server! */ + Ecore_Con_Event_Server_Add *e; + int ev = ECORE_CON_EVENT_SERVER_ADD; + + e = ecore_con_event_server_add_alloc(); + EINA_SAFETY_ON_NULL_RETURN(e); + + svr->event_count = eina_list_append(svr->event_count, e); + _ecore_con_server_timer_update(svr); + e->server = svr; + if (svr->upgrade) ev = ECORE_CON_EVENT_SERVER_UPGRADE; + ecore_event_add(ev, e, + _ecore_con_event_server_add_free, NULL); + _ecore_con_event_count++; +} + +void +ecore_con_event_server_del(Ecore_Con_Server *svr) +{ + Ecore_Con_Event_Server_Del *e; + + e = ecore_con_event_server_del_alloc(); + EINA_SAFETY_ON_NULL_RETURN(e); + + svr->event_count = eina_list_append(svr->event_count, e); + _ecore_con_server_timer_update(svr); + e->server = svr; + ecore_event_add(ECORE_CON_EVENT_SERVER_DEL, e, + _ecore_con_event_server_del_free, NULL); + _ecore_con_event_count++; +} + +void +ecore_con_event_server_write(Ecore_Con_Server *svr, int num) +{ + Ecore_Con_Event_Server_Write *e; + + e = ecore_con_event_server_write_alloc(); + EINA_SAFETY_ON_NULL_RETURN(e); + + svr->event_count = eina_list_append(svr->event_count, e); + e->server = svr; + e->size = num; + ecore_event_add(ECORE_CON_EVENT_SERVER_WRITE, e, + (Ecore_End_Cb)_ecore_con_event_server_write_free, NULL); + _ecore_con_event_count++; +} + +void +ecore_con_event_server_data(Ecore_Con_Server *svr, unsigned char *buf, int num, Eina_Bool duplicate) +{ + Ecore_Con_Event_Server_Data *e; + + e = ecore_con_event_server_data_alloc(); + EINA_SAFETY_ON_NULL_RETURN(e); + + svr->event_count = eina_list_append(svr->event_count, e); + _ecore_con_server_timer_update(svr); + e->server = svr; + if (duplicate) + { + e->data = malloc(num); + if (!e->data) + { + ERR("server data allocation failure !"); + _ecore_con_event_server_data_free(NULL, e); + return; + } + memcpy(e->data, buf, num); + } + else + e->data = buf; + e->size = num; + ecore_event_add(ECORE_CON_EVENT_SERVER_DATA, e, + _ecore_con_event_server_data_free, NULL); + _ecore_con_event_count++; +} + +void +ecore_con_event_client_add(Ecore_Con_Client *cl) +{ + Ecore_Con_Event_Client_Add *e; + int ev = ECORE_CON_EVENT_CLIENT_ADD; + + e = ecore_con_event_client_add_alloc(); + EINA_SAFETY_ON_NULL_RETURN(e); + + cl->event_count = eina_list_append(cl->event_count, e); + cl->host_server->event_count = eina_list_append(cl->host_server->event_count, e); + _ecore_con_cl_timer_update(cl); + e->client = cl; + if (cl->upgrade) ev = ECORE_CON_EVENT_CLIENT_UPGRADE; + ecore_event_add(ev, e, + (Ecore_End_Cb)_ecore_con_event_client_add_free, cl->host_server); + _ecore_con_event_count++; +} + +void +ecore_con_event_client_del(Ecore_Con_Client *cl) +{ + Ecore_Con_Event_Client_Del *e; + + if (!cl) return; + e = ecore_con_event_client_del_alloc(); + EINA_SAFETY_ON_NULL_RETURN(e); + cl->event_count = eina_list_append(cl->event_count, e); + + cl->host_server->event_count = eina_list_append(cl->host_server->event_count, e); + _ecore_con_cl_timer_update(cl); + e->client = cl; + ecore_event_add(ECORE_CON_EVENT_CLIENT_DEL, e, + (Ecore_End_Cb)_ecore_con_event_client_del_free, cl->host_server); + _ecore_con_event_count++; +} + +void +ecore_con_event_client_write(Ecore_Con_Client *cl, int num) +{ + Ecore_Con_Event_Client_Write *e; + + e = ecore_con_event_client_write_alloc(); + EINA_SAFETY_ON_NULL_RETURN(e); + + cl->event_count = eina_list_append(cl->event_count, e); + cl->host_server->event_count = eina_list_append(cl->host_server->event_count, e); + e->client = cl; + e->size = num; + ecore_event_add(ECORE_CON_EVENT_CLIENT_WRITE, e, + (Ecore_End_Cb)_ecore_con_event_client_write_free, cl->host_server); + _ecore_con_event_count++; +} + +void +ecore_con_event_client_data(Ecore_Con_Client *cl, unsigned char *buf, int num, Eina_Bool duplicate) +{ + Ecore_Con_Event_Client_Data *e; + + e = ecore_con_event_client_data_alloc(); + EINA_SAFETY_ON_NULL_RETURN(e); + + cl->event_count = eina_list_append(cl->event_count, e); + cl->host_server->event_count = eina_list_append(cl->host_server->event_count, e); + _ecore_con_cl_timer_update(cl); + e->client = cl; + if (duplicate) + { + e->data = malloc(num); + if (!e->data) + { + ERR("client data allocation failure !"); + _ecore_con_event_client_data_free(cl->host_server, e); + return; + } + memcpy(e->data, buf, num); + } + else + e->data = buf; + e->size = num; + ecore_event_add(ECORE_CON_EVENT_CLIENT_DATA, e, + (Ecore_End_Cb)_ecore_con_event_client_data_free, cl->host_server); + _ecore_con_event_count++; +} + + +void +ecore_con_server_infos_del(Ecore_Con_Server *svr, void *info) +{ + svr->infos = eina_list_remove(svr->infos, info); +} + +void +ecore_con_event_server_error(Ecore_Con_Server *svr, const char *error) +{ + Ecore_Con_Event_Server_Error *e; + + e = ecore_con_event_server_error_alloc(); + EINA_SAFETY_ON_NULL_RETURN(e); + + e->server = svr; + e->error = strdup(error); + ERR("%s", error); + svr->event_count = eina_list_append(svr->event_count, e); + ecore_event_add(ECORE_CON_EVENT_SERVER_ERROR, e, (Ecore_End_Cb)_ecore_con_event_server_error_free, NULL); + _ecore_con_event_count++; +} + +void +ecore_con_event_client_error(Ecore_Con_Client *cl, const char *error) +{ + Ecore_Con_Event_Client_Error *e; + + e = ecore_con_event_client_error_alloc(); + EINA_SAFETY_ON_NULL_RETURN(e); + + e->client = cl; + e->error = strdup(error); + ERR("%s", error); + cl->event_count = eina_list_append(cl->event_count, e); + cl->host_server->event_count = eina_list_append(cl->host_server->event_count, e); + ecore_event_add(ECORE_CON_EVENT_CLIENT_ERROR, e, (Ecore_End_Cb)_ecore_con_event_client_error_free, cl->host_server); + _ecore_con_event_count++; +} + +static void +_ecore_con_server_free(Ecore_Con_Server *svr) +{ + Ecore_Con_Client *cl; + double t_start, t; + + if (svr->event_count) return; + + while (svr->infos) + { + ecore_con_info_data_clear(svr->infos->data); + svr->infos = eina_list_remove_list(svr->infos, svr->infos); + } + if ((!svr->buf) && svr->delete_me && (!svr->dead) && (!svr->event_count)) + { + /* this is a catch-all for cases when a server is not properly killed. */ + svr->dead = EINA_TRUE; + ecore_con_event_server_del(svr); + return; + } + + t_start = ecore_time_get(); + while (svr->buf && (!svr->dead)) + { + _ecore_con_server_flush(svr); + t = ecore_time_get(); + if ((t - t_start) > 0.5) + { + WRN("ECORE_CON: EEK - stuck in _ecore_con_server_free() trying\n" + " to flush data out from the server, and have been for\n" + " %1.1f seconds. This is taking too long. Aborting flush.", + (t - t_start)); + break; + } + } + +#ifdef _WIN32 + ecore_con_local_win32_server_del(svr); +#endif + if (svr->event_count) return; + ECORE_MAGIC_SET(svr, ECORE_MAGIC_NONE); + + if (svr->buf) + eina_binbuf_free(svr->buf); + + EINA_LIST_FREE(svr->clients, cl) + { + Ecore_Con_Event_Server_Add *ev; + + /* some pointer hacks here to prevent double frees if people are being stupid */ + EINA_LIST_FREE(cl->event_count, ev) + ev->server = NULL; + cl->delete_me = cl->dead = EINA_TRUE; + _ecore_con_client_free(cl); + } + if ((svr->created) && (svr->path) && (svr->ppid == getpid())) + unlink(svr->path); + + ecore_con_ssl_server_shutdown(svr); + free(svr->name); + + free(svr->path); + + eina_stringshare_del(svr->ip); + + if (svr->fd_handler) + ecore_main_fd_handler_del(svr->fd_handler); + + if (svr->fd > 0) + close(svr->fd); + + if (svr->until_deletion) + ecore_timer_del(svr->until_deletion); + + servers = eina_list_remove(servers, svr); + svr->data = NULL; + free(svr); +} + +static void +_ecore_con_client_free(Ecore_Con_Client *cl) +{ + double t_start, t; + + if (cl->event_count) return; + + if (cl->delete_me && (!cl->dead) && (!cl->event_count)) + { + /* this is a catch-all for cases when a client is not properly killed. */ + cl->dead = EINA_TRUE; + ecore_con_event_client_del(cl); + return; + } + + + t_start = ecore_time_get(); + while ((cl->buf) && (!cl->dead)) + { + _ecore_con_client_flush(cl); + t = ecore_time_get(); + if ((t - t_start) > 0.5) + { + WRN("EEK - stuck in _ecore_con_client_free() trying\n" + " to flush data out from the client, and have been for\n" + " %1.1f seconds. This is taking too long. Aborting flush.", + (t - t_start)); + break; + } + } + +#ifdef _WIN32 + ecore_con_local_win32_client_del(cl); +#endif + + if (cl->event_count) return; + ECORE_MAGIC_SET(cl, ECORE_MAGIC_NONE); + + free(cl->buf); + + if (cl->host_server->type & ECORE_CON_SSL) + ecore_con_ssl_client_shutdown(cl); + + if (cl->fd_handler) + ecore_main_fd_handler_del(cl->fd_handler); + + if (cl->fd > 0) + close(cl->fd); + + free(cl->client_addr); + cl->client_addr = NULL; + + if (cl->until_deletion) + ecore_timer_del(cl->until_deletion); + + eina_stringshare_del(cl->ip); + cl->data = NULL; + free(cl); + return; +} + +static void +_ecore_con_server_kill(Ecore_Con_Server *svr) +{ + if (!svr->delete_me) + ecore_con_event_server_del(svr); + + svr->dead = EINA_TRUE; + if (svr->fd_handler) + ecore_main_fd_handler_del(svr->fd_handler); + + svr->fd_handler = NULL; +} + +static Eina_Bool +_ecore_con_server_timer(Ecore_Con_Server *svr) +{ + ecore_con_server_del(svr); + + svr->until_deletion = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static void +_ecore_con_server_timer_update(Ecore_Con_Server *svr) +{ + if (svr->disconnect_time) + { + if (svr->disconnect_time > 0) + { + if (svr->until_deletion) + ecore_timer_interval_set(svr->until_deletion, svr->disconnect_time); + else + svr->until_deletion = ecore_timer_add(svr->disconnect_time, (Ecore_Task_Cb)_ecore_con_server_timer, svr); + } + else if (svr->until_deletion) + { + ecore_timer_del(svr->until_deletion); + svr->until_deletion = NULL; + } + } + else + { + if (svr->until_deletion) + { + ecore_timer_del(svr->until_deletion); + svr->until_deletion = NULL; + } + } +} + +static Eina_Bool +_ecore_con_client_timer(Ecore_Con_Client *cl) +{ + ecore_con_client_del(cl); + + cl->until_deletion = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static void +_ecore_con_cl_timer_update(Ecore_Con_Client *cl) +{ + if (cl->disconnect_time) + { + if (cl->disconnect_time > 0) + { + if (cl->until_deletion) + ecore_timer_interval_set(cl->until_deletion, cl->disconnect_time); + else + cl->until_deletion = ecore_timer_add(cl->disconnect_time, (Ecore_Task_Cb)_ecore_con_client_timer, cl); + } + else if (cl->until_deletion) + { + ecore_timer_del(cl->until_deletion); + cl->until_deletion = NULL; + } + } + else + { + if (cl->host_server->client_disconnect_time > 0) + { + if (cl->until_deletion) + ecore_timer_interval_set(cl->until_deletion, cl->host_server->client_disconnect_time); + else + cl->until_deletion = ecore_timer_add(cl->host_server->client_disconnect_time, (Ecore_Task_Cb)_ecore_con_client_timer, cl); + } + else if (cl->until_deletion) + { + ecore_timer_del(cl->until_deletion); + cl->until_deletion = NULL; + } + } +} + +static void +_ecore_con_cb_tcp_listen(void *data, + Ecore_Con_Info *net_info) +{ + Ecore_Con_Server *svr; + struct linger lin; + + svr = data; + + if (!net_info) /* error message has already been handled */ + goto error; + + svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype, + net_info->info.ai_protocol); + if (svr->fd < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + lin.l_onoff = 1; + lin.l_linger = 0; + if (setsockopt(svr->fd, SOL_SOCKET, SO_LINGER, (const void *)&lin, + sizeof(struct linger)) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_NODELAY) + { +#ifdef HAVE_NETINET_TCP_H + int flag = 1; + + if (setsockopt(svr->fd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, + sizeof(int)) < 0) +#endif + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + } + + if (bind(svr->fd, net_info->info.ai_addr, + net_info->info.ai_addrlen) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + if (listen(svr->fd, 4096) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + svr->fd_handler = ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ, + _ecore_con_svr_tcp_handler, svr, NULL, NULL); + if (!svr->fd_handler) + { + ecore_con_event_server_error(svr, "Memory allocation failure"); + goto error; + } + + return; + +error: + ecore_con_ssl_server_shutdown(svr); + _ecore_con_server_kill(svr); +} + +static void +_ecore_con_cb_udp_listen(void *data, + Ecore_Con_Info *net_info) +{ + Ecore_Con_Server *svr; + Ecore_Con_Type type; + struct ip_mreq mreq; +#ifdef HAVE_IPV6 + struct ipv6_mreq mreq6; +#endif + const int on = 1; + + svr = data; + type = svr->type; + type &= ECORE_CON_TYPE; + + if (!net_info) /* error message has already been handled */ + goto error; + + svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype, + net_info->info.ai_protocol); + if (svr->fd < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if (type == ECORE_CON_REMOTE_MCAST) + { + if (net_info->info.ai_family == AF_INET) + { + if (!inet_pton(net_info->info.ai_family, net_info->ip, + &mreq.imr_multiaddr)) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + mreq.imr_interface.s_addr = htonl(INADDR_ANY); + if (setsockopt(svr->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, + (const void *)&mreq, sizeof(mreq)) != 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + } +#ifdef HAVE_IPV6 + else if (net_info->info.ai_family == AF_INET6) + { + if (!inet_pton(net_info->info.ai_family, net_info->ip, + &mreq6.ipv6mr_multiaddr)) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + mreq6.ipv6mr_interface = htonl(INADDR_ANY); + if (setsockopt(svr->fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, + (const void *)&mreq6, sizeof(mreq6)) != 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + } +#endif + } + + if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&on, sizeof(on)) != 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if (bind(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + svr->fd_handler = + ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ, + _ecore_con_svr_udp_handler, svr, NULL, NULL); + if (!svr->fd_handler) + { + ecore_con_event_server_error(svr, "Memory allocation failure"); + goto error; + } + + svr->ip = eina_stringshare_add(net_info->ip); + + return; + +error: + ecore_con_ssl_server_shutdown(svr); + _ecore_con_server_kill(svr); +} + +static void +_ecore_con_cb_tcp_connect(void *data, + Ecore_Con_Info *net_info) +{ + Ecore_Con_Server *svr; + int res; + int curstate = 0; + + svr = data; + + if (!net_info) /* error message has already been handled */ + goto error; + + svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype, + net_info->info.ai_protocol); + if (svr->fd < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate, sizeof(curstate)) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_NODELAY) + { +#ifdef HAVE_NETINET_TCP_H + int flag = 1; + + if (setsockopt(svr->fd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int)) < 0) +#endif + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + } + + res = connect(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen); +#ifdef _WIN32 + if (res == SOCKET_ERROR) + { + if (WSAGetLastError() != WSAEINPROGRESS) + goto error; /* FIXME: strerror on windows? */ + +#else + if (res < 0) + { + if (errno != EINPROGRESS) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + +#endif + svr->connecting = EINA_TRUE; + svr->fd_handler = + ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ | ECORE_FD_WRITE, + _ecore_con_cl_handler, svr, NULL, NULL); + } + else + svr->fd_handler = ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ, + _ecore_con_cl_handler, svr, NULL, NULL); + + if (svr->type & ECORE_CON_SSL) + { + svr->handshaking = EINA_TRUE; + svr->ssl_state = ECORE_CON_SSL_STATE_INIT; + DBG("beginning ssl handshake"); + if (ecore_con_ssl_server_init(svr)) + goto error; + } + + if (!svr->fd_handler) + { + ecore_con_event_server_error(svr, "Memory allocation failure"); + goto error; + } + + svr->ip = eina_stringshare_add(net_info->ip); + + return; + +error: + ecore_con_ssl_server_shutdown(svr); + _ecore_con_server_kill(svr); +} + +static void +_ecore_con_cb_udp_connect(void *data, + Ecore_Con_Info *net_info) +{ + Ecore_Con_Server *svr; + int curstate = 0; + int broadcast = 1; + svr = data; + + if (!net_info) /* error message has already been handled */ + goto error; + + svr->fd = socket(net_info->info.ai_family, net_info->info.ai_socktype, + net_info->info.ai_protocol); + if (svr->fd < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_BROADCAST) + { + if (setsockopt(svr->fd, SOL_SOCKET, SO_BROADCAST, + (const void *)&broadcast, + sizeof(broadcast)) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + } + else if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, + (const void *)&curstate, sizeof(curstate)) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + if (connect(svr->fd, net_info->info.ai_addr, net_info->info.ai_addrlen) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto error; + } + + svr->fd_handler = ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ | ECORE_FD_WRITE, + _ecore_con_cl_udp_handler, svr, NULL, NULL); + + if (!svr->fd_handler) + { + ecore_con_event_server_error(svr, "Memory allocation failure"); + goto error; + } + + svr->ip = eina_stringshare_add(net_info->ip); + + return; + +error: + ecore_con_ssl_server_shutdown(svr); + _ecore_con_server_kill(svr); +} + +static Ecore_Con_State +svr_try_connect_plain(Ecore_Con_Server *svr) +{ + int res; + int so_err = 0; + socklen_t size = sizeof(int); + + res = getsockopt(svr->fd, SOL_SOCKET, SO_ERROR, (void *)&so_err, &size); +#ifdef _WIN32 + if (res == SOCKET_ERROR) + so_err = WSAGetLastError(); + + if ((so_err == WSAEINPROGRESS) && !svr->dead) + return ECORE_CON_INPROGRESS; + +#else + if (res < 0) + so_err = errno; + + if ((so_err == EINPROGRESS) && !svr->dead) + return ECORE_CON_INPROGRESS; + +#endif + + if (so_err) + { + /* we lost our server! */ + ecore_con_event_server_error(svr, strerror(errno)); + ERR("Connection lost: %s", strerror(so_err)); + _ecore_con_server_kill(svr); + return ECORE_CON_DISCONNECTED; + } + + if ((!svr->delete_me) && (!svr->handshaking) && svr->connecting) + { + svr->connecting = EINA_FALSE; + svr->start_time = ecore_time_get(); + ecore_con_event_server_add(svr); + } + + if (svr->fd_handler && (!svr->buf)) + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ); + + if (!svr->dead) + return ECORE_CON_CONNECTED; + else + return ECORE_CON_DISCONNECTED; +} + +static const char * +_ecore_con_pretty_ip(struct sockaddr *client_addr) +{ +#ifndef HAVE_IPV6 + char ipbuf[INET_ADDRSTRLEN + 1]; +#else + char ipbuf[INET6_ADDRSTRLEN + 1]; +#endif + int family = client_addr->sa_family; + void *src; + + switch(family) + { + case AF_INET: + src = &(((struct sockaddr_in *)client_addr)->sin_addr); + break; +#ifdef HAVE_IPV6 + case AF_INET6: + src = &(((struct sockaddr_in6 *)client_addr)->sin6_addr); + + if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)src)) + { + family = AF_INET; + src = (char*)src + 12; + } + break; +#endif + default: + return eina_stringshare_add("0.0.0.0"); + } + + if (!inet_ntop(family, src, ipbuf, sizeof(ipbuf))) + return eina_stringshare_add("0.0.0.0"); + + ipbuf[sizeof(ipbuf) - 1] = 0; + return eina_stringshare_add(ipbuf); +} + +static Eina_Bool +_ecore_con_svr_tcp_handler(void *data, + Ecore_Fd_Handler *fd_handler __UNUSED__) +{ + Ecore_Con_Server *svr; + Ecore_Con_Client *cl = NULL; + unsigned char client_addr[256]; + unsigned int client_addr_len; + + svr = data; + if (svr->dead) + return ECORE_CALLBACK_RENEW; + + if (svr->delete_me) + return ECORE_CALLBACK_RENEW; + + if ((svr->client_limit >= 0) && (!svr->reject_excess_clients) && + (svr->client_count >= (unsigned int)svr->client_limit)) + return ECORE_CALLBACK_RENEW; + + /* a new client */ + + cl = calloc(1, sizeof(Ecore_Con_Client)); + if (!cl) + { + ecore_con_event_server_error(svr, "Memory allocation failure when attempting to add a new client"); + return ECORE_CALLBACK_RENEW; + } + cl->host_server = svr; + + client_addr_len = sizeof(client_addr); + memset(&client_addr, 0, client_addr_len); + cl->fd = accept(svr->fd, (struct sockaddr *)&client_addr, (socklen_t *)&client_addr_len); + if (cl->fd < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto free_cl; + } + + if ((svr->client_limit >= 0) && (svr->reject_excess_clients) && + (svr->client_count >= (unsigned int)svr->client_limit)) + { + ecore_con_event_server_error(svr, "Maximum client limit reached"); + goto close_fd; + } + + if (fcntl(cl->fd, F_SETFL, O_NONBLOCK) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto close_fd; + } + if (fcntl(cl->fd, F_SETFD, FD_CLOEXEC) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + goto close_fd; + } + cl->fd_handler = ecore_main_fd_handler_add(cl->fd, ECORE_FD_READ, + _ecore_con_svr_cl_handler, cl, NULL, NULL); + if (!cl->fd_handler) + goto close_fd; + + ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT); + + if ((!svr->upgrade) && (svr->type & ECORE_CON_SSL)) + { + cl->handshaking = EINA_TRUE; + cl->ssl_state = ECORE_CON_SSL_STATE_INIT; + if (ecore_con_ssl_client_init(cl)) + goto del_handler; + } + + cl->client_addr = malloc(client_addr_len); + if (!cl->client_addr) + { + ecore_con_event_server_error(svr, "Memory allocation failure when attempting to add a new client"); + goto del_handler; + } + cl->client_addr_len = client_addr_len; + memcpy(cl->client_addr, &client_addr, client_addr_len); + + svr->clients = eina_list_append(svr->clients, cl); + svr->client_count++; + + if ((!cl->delete_me) && (!cl->handshaking)) + ecore_con_event_client_add(cl); + + return ECORE_CALLBACK_RENEW; + + del_handler: + ecore_main_fd_handler_del(cl->fd_handler); + close_fd: + close(cl->fd); + free_cl: + free(cl); + + return ECORE_CALLBACK_RENEW; +} + +static void +_ecore_con_cl_read(Ecore_Con_Server *svr) +{ + DBG("svr=%p", svr); + int num = 0; + Eina_Bool lost_server = EINA_TRUE; + unsigned char buf[READBUFSIZ]; + + /* only possible with non-ssl connections */ + if (svr->connecting && (svr_try_connect_plain(svr) != ECORE_CON_CONNECTED)) + return; + + if (svr->handshaking) + { + DBG("Continuing ssl handshake"); + if (!ecore_con_ssl_server_init(svr)) + lost_server = EINA_FALSE; + _ecore_con_server_timer_update(svr); + } + + if (!(svr->type & ECORE_CON_SSL)) + { + num = read(svr->fd, buf, sizeof(buf)); + /* 0 is not a valid return value for a tcp socket */ + if ((num > 0) || ((num < 0) && (errno == EAGAIN))) + lost_server = EINA_FALSE; + else if (num < 0) + ecore_con_event_server_error(svr, strerror(errno)); + } + else + { + num = ecore_con_ssl_server_read(svr, buf, sizeof(buf)); + /* this is not an actual 0 return, 0 here just means non-fatal error such as EAGAIN */ + if (num >= 0) + lost_server = EINA_FALSE; + } + + if ((!svr->delete_me) && (num > 0)) + ecore_con_event_server_data(svr, buf, num, EINA_TRUE); + + if (lost_server) + _ecore_con_server_kill(svr); +} + +static Eina_Bool +_ecore_con_cl_handler(void *data, + Ecore_Fd_Handler *fd_handler) +{ + Ecore_Con_Server *svr; + Eina_Bool want_read, want_write; + + svr = data; + if (svr->dead) + return ECORE_CALLBACK_RENEW; + + if (svr->delete_me) + return ECORE_CALLBACK_RENEW; + + want_read = ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ); + want_write = ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE); + + if (svr->handshaking && (want_read || want_write)) + { + DBG("Continuing ssl handshake: preparing to %s...", want_read ? "read" : "write"); +#ifdef ISCOMFITOR + if (want_read) + { + char buf[READBUFSIZ]; + ssize_t len; + len = recv(svr->fd, buf, sizeof(buf), MSG_DONTWAIT | MSG_PEEK); + DBG("%zu bytes in buffer", len); + } +#endif + if (ecore_con_ssl_server_init(svr)) + { + ERR("ssl handshaking failed!"); + svr->handshaking = EINA_FALSE; + + } + else if (!svr->ssl_state) + { + svr->connecting = EINA_FALSE; + svr->start_time = ecore_time_get(); + ecore_con_event_server_add(svr); + } + } + else if (want_read) + _ecore_con_cl_read(svr); + else if (want_write) /* only possible with non-ssl connections */ + { + if (svr->connecting && (!svr_try_connect_plain(svr))) + return ECORE_CALLBACK_RENEW; + + _ecore_con_server_flush(svr); + } + + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_ecore_con_cl_udp_handler(void *data, + Ecore_Fd_Handler *fd_handler) +{ + unsigned char buf[READBUFSIZ]; + int num; + Ecore_Con_Server *svr; + Eina_Bool want_read, want_write; + + want_read = ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ); + want_write = ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE); + + svr = data; + if (svr->dead || svr->delete_me || ((!want_read) && (!want_write))) + return ECORE_CALLBACK_RENEW; + + if (want_write) + { + _ecore_con_server_flush(svr); + return ECORE_CALLBACK_RENEW; + } + + num = read(svr->fd, buf, READBUFSIZ); + + if ((!svr->delete_me) && (num > 0)) + ecore_con_event_server_data(svr, buf, num, EINA_TRUE); + + if (num < 0 && (errno != EAGAIN) && (errno != EINTR)) + { + ecore_con_event_server_error(svr, strerror(errno)); + _ecore_con_server_kill(svr); + } + + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_ecore_con_svr_udp_handler(void *data, + Ecore_Fd_Handler *fd_handler) +{ + unsigned char buf[READBUFSIZ]; + unsigned char client_addr[256]; + socklen_t client_addr_len = sizeof(client_addr); + int num; + Ecore_Con_Server *svr; + Ecore_Con_Client *cl = NULL; + + svr = data; + + if (svr->delete_me || svr->dead) + return ECORE_CALLBACK_RENEW; + + if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE)) + { + _ecore_con_client_flush(cl); + return ECORE_CALLBACK_RENEW; + } + + if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) + return ECORE_CALLBACK_RENEW; + +#ifdef _WIN32 + num = fcntl(svr->fd, F_SETFL, O_NONBLOCK); + if (num >= 0) + num = recvfrom(svr->fd, (char *)buf, sizeof(buf), 0, + (struct sockaddr *)&client_addr, + &client_addr_len); + +#else + num = recvfrom(svr->fd, buf, sizeof(buf), MSG_DONTWAIT, + (struct sockaddr *)&client_addr, + &client_addr_len); +#endif + + if (num < 0 && (errno != EAGAIN) && (errno != EINTR)) + { + ecore_con_event_server_error(svr, strerror(errno)); + if (!svr->delete_me) + ecore_con_event_client_del(NULL); + + svr->dead = EINA_TRUE; + svr->fd_handler = NULL; + return ECORE_CALLBACK_CANCEL; + } + + +/* Create a new client for use in the client data event */ + cl = calloc(1, sizeof(Ecore_Con_Client)); + EINA_SAFETY_ON_NULL_RETURN_VAL(cl, ECORE_CALLBACK_RENEW); + + cl->host_server = svr; + cl->client_addr = malloc(client_addr_len); + if (!cl->client_addr) + { + free(cl); + return ECORE_CALLBACK_RENEW; + } + cl->client_addr_len = client_addr_len; + + memcpy(cl->client_addr, &client_addr, client_addr_len); + ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT); + svr->clients = eina_list_append(svr->clients, cl); + svr->client_count++; + + ecore_con_event_client_add(cl); + ecore_con_event_client_data(cl, buf, num, EINA_TRUE); + + return ECORE_CALLBACK_RENEW; +} + +static void +_ecore_con_svr_cl_read(Ecore_Con_Client *cl) +{ + int num = 0; + Eina_Bool lost_client = EINA_TRUE; + unsigned char buf[READBUFSIZ]; + + DBG("cl=%p", cl); + + if (cl->handshaking) + { + /* add an extra handshake attempt just before read, even though + * read also attempts to handshake, to try to finish sooner + */ + if (ecore_con_ssl_client_init(cl)) + lost_client = EINA_FALSE; + + _ecore_con_cl_timer_update(cl); + } + + if (!(cl->host_server->type & ECORE_CON_SSL) || (!cl->upgrade)) + { + num = read(cl->fd, buf, sizeof(buf)); + /* 0 is not a valid return value for a tcp socket */ + if ((num > 0) || ((num < 0) && ((errno == EAGAIN) || (errno == EINTR)))) + lost_client = EINA_FALSE; + else if (num < 0) + ecore_con_event_client_error(cl, strerror(errno)); + } + else + { + num = ecore_con_ssl_client_read(cl, buf, sizeof(buf)); + /* this is not an actual 0 return, 0 here just means non-fatal error such as EAGAIN */ + if (num >= 0) + lost_client = EINA_FALSE; + } + + if ((!cl->delete_me) && (num > 0)) + ecore_con_event_client_data(cl, buf, num, EINA_TRUE); + + if (lost_client) + { + if (!cl->delete_me) + ecore_con_event_client_del(cl); + INF("Lost client %s", (cl->ip) ? cl->ip : ""); + cl->dead = EINA_TRUE; + if (cl->fd_handler) + ecore_main_fd_handler_del(cl->fd_handler); + + cl->fd_handler = NULL; + return; + } +} + +static Eina_Bool +_ecore_con_svr_cl_handler(void *data, + Ecore_Fd_Handler *fd_handler) +{ + Ecore_Con_Client *cl; + + cl = data; + if (cl->dead) + return ECORE_CALLBACK_RENEW; + + if (cl->delete_me) + return ECORE_CALLBACK_RENEW; + + if (cl->handshaking && ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ | ECORE_FD_WRITE)) + { + if (ecore_con_ssl_client_init(cl)) + { + ERR("ssl handshaking failed!"); + cl->handshaking = EINA_FALSE; + cl->dead = EINA_TRUE; + INF("Lost client %s", (cl->ip) ? cl->ip : ""); + ecore_con_event_client_del(cl); + } + else if (!cl->ssl_state) + ecore_con_event_client_add(cl); + } + else if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) + _ecore_con_svr_cl_read(cl); + + else if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE)) + _ecore_con_client_flush(cl); + + return ECORE_CALLBACK_RENEW; +} + +static void +_ecore_con_server_flush(Ecore_Con_Server *svr) +{ + int count, num; + +#ifdef _WIN32 + if (ecore_con_local_win32_server_flush(svr)) + return; +#endif + + if ((!svr->buf) && svr->fd_handler) + { + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ); + return; + } + + num = eina_binbuf_length_get(svr->buf) - svr->write_buf_offset; + + /* check whether we need to write anything at all. + * we must not write zero bytes with SSL_write() since it + * causes undefined behaviour + */ + /* we thank Tommy[D] for needing to check negative buffer sizes + * here because his system is amazing. + */ + if (num <= 0) return; + + if (svr->handshaking) + { + DBG("Continuing ssl handshake"); + if (ecore_con_ssl_server_init(svr)) + _ecore_con_server_kill(svr); + _ecore_con_server_timer_update(svr); + return; + } + + if (!(svr->type & ECORE_CON_SSL)) + count = write(svr->fd, eina_binbuf_string_get(svr->buf) + svr->write_buf_offset, num); + else + count = ecore_con_ssl_server_write(svr, eina_binbuf_string_get(svr->buf) + svr->write_buf_offset, num); + + if (count < 0) + { + if ((errno != EAGAIN) && (errno != EINTR)) + { + ecore_con_event_server_error(svr, strerror(errno)); + _ecore_con_server_kill(svr); + } + return; + } + + if (count) ecore_con_event_server_write(svr, count); + svr->write_buf_offset += count; + if (svr->write_buf_offset >= eina_binbuf_length_get(svr->buf)) + { + svr->write_buf_offset = 0; + eina_binbuf_free(svr->buf); + svr->buf = NULL; + if (svr->fd_handler) + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ); + } + else if ((count < num) && svr->fd_handler) + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE); +} + +static void +_ecore_con_client_flush(Ecore_Con_Client *cl) +{ + int num, count = 0; + +#ifdef _WIN32 + if (ecore_con_local_win32_client_flush(cl)) + return; +#endif + + if (!cl->buf && cl->fd_handler) + { + ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ); + return; + } + + if (cl->handshaking) + { + if (ecore_con_ssl_client_init(cl)) + count = -1; + + _ecore_con_cl_timer_update(cl); + } + + if (!count) + { + num = eina_binbuf_length_get(cl->buf) - cl->buf_offset; + if (num <= 0) return; + if (!(cl->host_server->type & ECORE_CON_SSL) || (!cl->upgrade)) + count = write(cl->fd, eina_binbuf_string_get(cl->buf) + cl->buf_offset, num); + else + count = ecore_con_ssl_client_write(cl, eina_binbuf_string_get(cl->buf) + cl->buf_offset, num); + } + + if (count < 0) + { + if ((errno != EAGAIN) && (errno != EINTR) && (!cl->delete_me)) + { + ecore_con_event_client_error(cl, strerror(errno)); + ecore_con_event_client_del(cl); + cl->dead = EINA_TRUE; + INF("Lost client %s", (cl->ip) ? cl->ip : ""); + if (cl->fd_handler) + ecore_main_fd_handler_del(cl->fd_handler); + + cl->fd_handler = NULL; + } + + return; + } + + if (count) ecore_con_event_client_write(cl, count); + cl->buf_offset += count; + if (cl->buf_offset >= eina_binbuf_length_get(cl->buf)) + { + cl->buf_offset = 0; + eina_binbuf_free(cl->buf); + cl->buf = NULL; + if (cl->fd_handler) + ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ); + } + else if ((count < num) && cl->fd_handler) + ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE); +} + +static void +_ecore_con_event_client_add_free(Ecore_Con_Server *svr, + void *ev) +{ + Ecore_Con_Event_Client_Add *e; + + e = ev; + if (e->client) + { + e->client->event_count = eina_list_remove(e->client->event_count, e); + if (e->client->host_server) + { + e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, ev); + if ((!svr->event_count) && (svr->delete_me)) + _ecore_con_server_free(svr); + } + if ((!e->client->event_count) && (e->client->delete_me)) + ecore_con_client_del(e->client); + } + + ecore_con_event_client_add_free(e); + _ecore_con_event_count--; + if ((!_ecore_con_event_count) && (!_ecore_con_init_count)) + ecore_con_mempool_shutdown(); +} + +static void +_ecore_con_event_client_del_free(Ecore_Con_Server *svr, + void *ev) +{ + Ecore_Con_Event_Client_Del *e; + + e = ev; + if (e->client) + { + e->client->event_count = eina_list_remove(e->client->event_count, e); + if (e->client->host_server) + { + e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, ev); + if ((!svr->event_count) && (svr->delete_me)) + _ecore_con_server_free(svr); + } + if ((!e->client->event_count) && (e->client->delete_me)) + ecore_con_client_del(e->client); + } + ecore_con_event_client_del_free(e); + _ecore_con_event_count--; + if ((!_ecore_con_event_count) && (!_ecore_con_init_count)) + ecore_con_mempool_shutdown(); +} + +static void +_ecore_con_event_client_write_free(Ecore_Con_Server *svr, + Ecore_Con_Event_Client_Write *e) +{ + if (e->client) + { + e->client->event_count = eina_list_remove(e->client->event_count, e); + if (e->client->host_server) + { + e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, e); + if ((!svr->event_count) && (svr->delete_me)) + _ecore_con_server_free(svr); + } + if (((!e->client->event_count) && (e->client->delete_me)) || + ((e->client->host_server && + ((e->client->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_UDP || + (e->client->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_MCAST)))) + ecore_con_client_del(e->client); + } + ecore_con_event_client_write_free(e); + _ecore_con_event_count--; + if ((!_ecore_con_event_count) && (!_ecore_con_init_count)) + ecore_con_mempool_shutdown(); +} + +static void +_ecore_con_event_client_data_free(Ecore_Con_Server *svr, + void *ev) +{ + Ecore_Con_Event_Client_Data *e; + + e = ev; + if (e->client) + { + e->client->event_count = eina_list_remove(e->client->event_count, e); + if (e->client->host_server) + { + e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, ev); + } + if ((!svr->event_count) && (svr->delete_me)) + _ecore_con_server_free(svr); + if (((!e->client->event_count) && (e->client->delete_me)) || + ((e->client->host_server && + ((e->client->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_UDP || + (e->client->host_server->type & ECORE_CON_TYPE) == ECORE_CON_REMOTE_MCAST)))) + ecore_con_client_del(e->client); + } + free(e->data); + ecore_con_event_client_data_free(e); + _ecore_con_event_count--; + if ((!_ecore_con_event_count) && (!_ecore_con_init_count)) + ecore_con_mempool_shutdown(); +} + +static void +_ecore_con_event_server_add_free(void *data __UNUSED__, + void *ev) +{ + Ecore_Con_Event_Server_Add *e; + + e = ev; + if (e->server) + { + e->server->event_count = eina_list_remove(e->server->event_count, ev); + if ((!e->server->event_count) && (e->server->delete_me)) + _ecore_con_server_free(e->server); + } + ecore_con_event_server_add_free(e); + _ecore_con_event_count--; + if ((!_ecore_con_event_count) && (!_ecore_con_init_count)) + ecore_con_mempool_shutdown(); +} + +static void +_ecore_con_event_server_del_free(void *data __UNUSED__, + void *ev) +{ + Ecore_Con_Event_Server_Del *e; + + e = ev; + if (e->server) + { + e->server->event_count = eina_list_remove(e->server->event_count, ev); + if ((!e->server->event_count) && (e->server->delete_me)) + _ecore_con_server_free(e->server); + } + ecore_con_event_server_del_free(e); + _ecore_con_event_count--; + if ((!_ecore_con_event_count) && (!_ecore_con_init_count)) + ecore_con_mempool_shutdown(); +} + +static void +_ecore_con_event_server_write_free(void *data __UNUSED__, + Ecore_Con_Event_Server_Write *e) +{ + if (e->server) + { + e->server->event_count = eina_list_remove(e->server->event_count, e); + if ((!e->server->event_count) && (e->server->delete_me)) + _ecore_con_server_free(e->server); + } + + ecore_con_event_server_write_free(e); + _ecore_con_event_count--; + if ((!_ecore_con_event_count) && (!_ecore_con_init_count)) + ecore_con_mempool_shutdown(); +} + +static void +_ecore_con_event_server_data_free(void *data __UNUSED__, + void *ev) +{ + Ecore_Con_Event_Server_Data *e; + + e = ev; + if (e->server) + { + e->server->event_count = eina_list_remove(e->server->event_count, ev); + if ((!e->server->event_count) && (e->server->delete_me)) + _ecore_con_server_free(e->server); + } + + free(e->data); + ecore_con_event_server_data_free(e); + _ecore_con_event_count--; + if ((!_ecore_con_event_count) && (!_ecore_con_init_count)) + ecore_con_mempool_shutdown(); +} + + +static void +_ecore_con_event_server_error_free(void *data __UNUSED__, Ecore_Con_Event_Server_Error *e) +{ + if (e->server) + { + e->server->event_count = eina_list_remove(e->server->event_count, e); + if ((!e->server->event_count) && (e->server->delete_me)) + _ecore_con_server_free(e->server); + } + free(e->error); + ecore_con_event_server_error_free(e); + _ecore_con_event_count--; + if ((!_ecore_con_event_count) && (!_ecore_con_init_count)) + ecore_con_mempool_shutdown(); +} + +static void +_ecore_con_event_client_error_free(Ecore_Con_Server *svr, Ecore_Con_Event_Client_Error *e) +{ + if (e->client) + { + e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, e); + if ((!e->client->event_count) && (e->client->delete_me)) + _ecore_con_client_free(e->client); + if (e->client->host_server) + { + e->client->host_server->event_count = eina_list_remove(e->client->host_server->event_count, e); + if ((!svr->event_count) && (svr->delete_me)) + _ecore_con_server_free(svr); + } + } + free(e->error); + ecore_con_event_client_error_free(e); + _ecore_con_event_count--; + if ((!_ecore_con_event_count) && (!_ecore_con_init_count)) + ecore_con_mempool_shutdown(); +} + +static void +_ecore_con_lookup_done(void *data, + Ecore_Con_Info *infos) +{ + Ecore_Con_Server *svr; + Ecore_Con_Lookup *lk; + + svr = data; + lk = svr->data; + + if (infos) + lk->done_cb(infos->info.ai_canonname, infos->ip, + infos->info.ai_addr, infos->info.ai_addrlen, + (void *)lk->data); + else + lk->done_cb(NULL, NULL, NULL, 0, (void *)lk->data); + + free(svr->name); + free(lk); + free(svr); +} + diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_alloc.c b/libraries/ecore/src/lib/ecore_con/ecore_con_alloc.c new file mode 100644 index 0000000..206948b --- /dev/null +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_alloc.c @@ -0,0 +1,99 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "Ecore.h" +#include "ecore_private.h" +#include "Ecore_Con.h" +#include "ecore_con_private.h" + +typedef struct _Ecore_Con_Mempool Ecore_Con_Mempool; +struct _Ecore_Con_Mempool +{ + const char *name; + Eina_Mempool *mp; + size_t size; +}; + +#define GENERIC_ALLOC_FREE(TYPE, Type) \ + Ecore_Con_Mempool Type##_mp = { #TYPE, NULL, sizeof (TYPE) }; \ + \ + TYPE * \ + Type##_alloc(void) \ + { \ + return eina_mempool_malloc(Type##_mp.mp, sizeof (TYPE)); \ + } \ + \ + void \ + Type##_free(TYPE *e) \ + { \ + eina_mempool_free(Type##_mp.mp, e); \ + } + +GENERIC_ALLOC_FREE(Ecore_Con_Event_Client_Add, ecore_con_event_client_add); +GENERIC_ALLOC_FREE(Ecore_Con_Event_Client_Del, ecore_con_event_client_del); +GENERIC_ALLOC_FREE(Ecore_Con_Event_Client_Write, ecore_con_event_client_write); +GENERIC_ALLOC_FREE(Ecore_Con_Event_Client_Data, ecore_con_event_client_data); +GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Error, ecore_con_event_server_error); +GENERIC_ALLOC_FREE(Ecore_Con_Event_Client_Error, ecore_con_event_client_error); +GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Add, ecore_con_event_server_add); +GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Del, ecore_con_event_server_del); +GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Write, ecore_con_event_server_write); +GENERIC_ALLOC_FREE(Ecore_Con_Event_Server_Data, ecore_con_event_server_data); + +static Ecore_Con_Mempool *mempool_array[] = { + &ecore_con_event_client_add_mp, + &ecore_con_event_client_del_mp, + &ecore_con_event_client_write_mp, + &ecore_con_event_client_data_mp, + &ecore_con_event_server_error_mp, + &ecore_con_event_client_error_mp, + &ecore_con_event_server_add_mp, + &ecore_con_event_server_del_mp, + &ecore_con_event_server_write_mp, + &ecore_con_event_server_data_mp +}; + +void +ecore_con_mempool_init(void) +{ + const char *choice; + unsigned int i; + + choice = getenv("EINA_MEMPOOL"); + if (!choice || !choice[0]) + choice = "chained_mempool"; + + for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i) + { + retry: + mempool_array[i]->mp = eina_mempool_add(choice, mempool_array[i]->name, NULL, mempool_array[i]->size, 64); + if (!mempool_array[i]->mp) + { + if (strcmp(choice, "pass_through") != 0) + { + ERR("Falling back to pass through ! Previously tried '%s' mempool.", choice); + choice = "pass_through"; + goto retry; + } + else + { + ERR("Impossible to allocate mempool '%s' !", choice); + return ; + } + } + } +} + +void +ecore_con_mempool_shutdown(void) +{ + unsigned int i; + + for (i = 0; i < sizeof (mempool_array) / sizeof (mempool_array[0]); ++i) + { + eina_mempool_del(mempool_array[i]->mp); + mempool_array[i]->mp = NULL; + } +} + diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_ares.c b/libraries/ecore/src/lib/ecore_con/ecore_con_ares.c new file mode 100644 index 0000000..dd5a212 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_ares.c @@ -0,0 +1,628 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +/* + * This version of ecore_con_info use c-ares to provide asynchronous dns lookup. + * + * Note: It doesn't fork nor does it use libc getaddrinfo. + * http://c-ares.haxx.se/docs.html + */ + +#include +#include + +#ifdef HAVE_NETINET_IN_H +# include +#endif + +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#include + +#include "Ecore.h" +#include "Ecore_Con.h" +#include "ecore_con_private.h" + +typedef struct _Ecore_Con_FD Ecore_Con_FD; +typedef struct _Ecore_Con_CAres Ecore_Con_CAres; + +struct _Ecore_Con_FD +{ + Ecore_Fd_Handler *handler; + Ecore_Timer *timer; + int fd; +}; + +struct _Ecore_Con_CAres +{ + Ecore_Con_Server *svr; + Ecore_Con_Info_Cb done_cb; + void *data; + struct addrinfo hints; + Ecore_Con_Info *result; + + union { + struct in_addr v4; +#ifdef HAVE_IPV6 + struct in6_addr v6; +#endif + } addr; + + Eina_Bool byaddr : 1; + Eina_Bool isv6 : 1; +}; + +static ares_channel info_channel; +static int info_init = 0; +static Eina_List *info_fds = NULL; + +static void _ecore_con_info_ares_nameinfo(Ecore_Con_CAres *arg, + int status, + int timeouts, + char *node, + char *service); +static void _ecore_con_info_ares_host_cb(Ecore_Con_CAres *arg, + int status, + int timeouts, + struct hostent *hostent); +static Eina_Bool _ecore_con_info_cares_fd_cb(Ecore_Con_FD *ecf, + Ecore_Fd_Handler *fd_handler); +static Eina_Bool _ecore_con_info_cares_timeout_cb(void *data); + +static void +_ecore_con_info_cares_state_cb(void *data, + ares_socket_t fd, + int readable, + int writable); +static int +_ecore_con_info_fds_search(const Ecore_Con_FD *fd1, + const Ecore_Con_FD *fd2); + +int +ecore_con_info_init(void) +{ + struct ares_options opts; + + if (!info_init) + { + if (ares_library_init(ARES_LIB_INIT_ALL)) + return 0; + + opts.lookups = "fb"; /* hosts file then dns */ + opts.sock_state_cb = _ecore_con_info_cares_state_cb; + + if (ares_init_options(&info_channel, &opts, + ARES_OPT_LOOKUPS | ARES_OPT_SOCK_STATE_CB) != ARES_SUCCESS) + { + ares_library_cleanup(); + return 0; + } + } + + info_init++; + return info_init; +} + +int +ecore_con_info_shutdown(void) +{ + info_init--; + if (info_init == 0) + { + /* Cancel all ongoing request */ + ares_cancel(info_channel); + ares_destroy(info_channel); + + /* Shutdown ares */ + ares_library_cleanup(); + } + + return info_init; +} + +int +ecore_con_info_tcp_connect(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data) +{ + struct addrinfo hints; + + memset(&hints, 0, sizeof(struct addrinfo)); +#ifdef HAVE_IPV6 + hints.ai_family = AF_INET6; +#else + hints.ai_family = AF_INET; +#endif + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_CANONNAME; + hints.ai_protocol = IPPROTO_TCP; + hints.ai_canonname = NULL; + hints.ai_next = NULL; + hints.ai_addr = NULL; + + return ecore_con_info_get(svr, done_cb, data, &hints); +} + +int +ecore_con_info_tcp_listen(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data) +{ + struct addrinfo hints; + + memset(&hints, 0, sizeof(struct addrinfo)); +#ifdef HAVE_IPV6 + hints.ai_family = AF_INET6; +#else + hints.ai_family = AF_INET; +#endif + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_PASSIVE; + hints.ai_protocol = IPPROTO_TCP; + hints.ai_canonname = NULL; + hints.ai_next = NULL; + hints.ai_addr = NULL; + + return ecore_con_info_get(svr, done_cb, data, &hints); +} + +int +ecore_con_info_udp_connect(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data) +{ + struct addrinfo hints; + + memset(&hints, 0, sizeof(struct addrinfo)); +#ifdef HAVE_IPV6 + hints.ai_family = AF_INET6; +#else + hints.ai_family = AF_INET; +#endif + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = AI_CANONNAME; + hints.ai_protocol = IPPROTO_UDP; + hints.ai_canonname = NULL; + hints.ai_next = NULL; + hints.ai_addr = NULL; + + return ecore_con_info_get(svr, done_cb, data, &hints); +} + +int +ecore_con_info_udp_listen(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data) +{ + struct addrinfo hints; + + memset(&hints, 0, sizeof(struct addrinfo)); +#ifdef HAVE_IPV6 + hints.ai_family = AF_INET6; +#else + hints.ai_family = AF_INET; +#endif + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = AI_PASSIVE; + hints.ai_protocol = IPPROTO_UDP; + hints.ai_canonname = NULL; + hints.ai_next = NULL; + hints.ai_addr = NULL; + + return ecore_con_info_get(svr, done_cb, data, &hints); +} + +int +ecore_con_info_mcast_listen(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data) +{ + struct addrinfo hints; + + memset(&hints, 0, sizeof(struct addrinfo)); +#ifdef HAVE_IPV6 + hints.ai_family = AF_INET6; +#else + hints.ai_family = AF_INET; +#endif + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = 0; + hints.ai_protocol = IPPROTO_UDP; + hints.ai_canonname = NULL; + hints.ai_next = NULL; + hints.ai_addr = NULL; + + return ecore_con_info_get(svr, done_cb, data, &hints); +} + +static Eina_Bool +_ecore_con_info_ares_getnameinfo(Ecore_Con_CAres *arg, + int addrtype, + const char *name, + struct sockaddr *addr, + int addrlen) +{ + int length = 0; + + if (name) + length = strlen(name) + 1; + else + length = 1; + + arg->result = malloc(sizeof(Ecore_Con_Info) + length); + if (!arg->result) + return EINA_FALSE; + + /* FIXME: What to do when hint is not set ? */ + arg->result->info.ai_flags = arg->hints.ai_flags; + arg->result->info.ai_socktype = arg->hints.ai_socktype; + arg->result->info.ai_protocol = arg->hints.ai_protocol; + + arg->result->info.ai_family = addrtype; + arg->result->info.ai_addrlen = addrlen; + arg->result->info.ai_addr = addr; + arg->result->info.ai_canonname = (char *)(arg->result + 1); + + if (!name) + *arg->result->info.ai_canonname = '\0'; + else + strcpy(arg->result->info.ai_canonname, name); + + arg->result->info.ai_next = NULL; + + ares_getnameinfo( + info_channel, addr, addrlen, + ARES_NI_NUMERICSERV | ARES_NI_NUMERICHOST | + ARES_NI_LOOKUPSERVICE | ARES_NI_LOOKUPHOST, + (ares_nameinfo_callback)_ecore_con_info_ares_nameinfo, arg); + + return EINA_TRUE; +} + +EAPI int +ecore_con_info_get(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data, + struct addrinfo *hints) +{ + Ecore_Con_CAres *cares; +#ifdef HAVE_IPV6 + int ai_family = AF_INET6; +#else + int ai_family = AF_INET; +#endif + + cares = calloc(1, sizeof(Ecore_Con_CAres)); + if (!cares) + return 0; + + cares->svr = svr; + cares->done_cb = done_cb; + cares->data = data; + + if (hints) + { + ai_family = hints->ai_family; + memcpy(&cares->hints, hints, sizeof(struct addrinfo)); + } + + if (inet_pton(AF_INET, svr->name, &cares->addr.v4) == 1) + { + cares->byaddr = EINA_TRUE; + cares->isv6 = EINA_FALSE; + ares_gethostbyaddr(info_channel, &cares->addr.v4, + sizeof(cares->addr.v4), + AF_INET, + (ares_host_callback)_ecore_con_info_ares_host_cb, + cares); + } +#ifdef HAVE_IPV6 + else if (inet_pton(AF_INET6, svr->name, &cares->addr.v6) == 1) + { + cares->byaddr = EINA_TRUE; + cares->isv6 = EINA_TRUE; + ares_gethostbyaddr(info_channel, &cares->addr.v6, + sizeof(cares->addr.v6), + AF_INET6, + (ares_host_callback)_ecore_con_info_ares_host_cb, + cares); + } +#endif + else + { + cares->byaddr = EINA_FALSE; + ares_gethostbyname(info_channel, svr->name, ai_family, + (ares_host_callback)_ecore_con_info_ares_host_cb, + cares); + } + + svr->infos = eina_list_append(svr->infos, cares); + return 1; +} + +void +ecore_con_info_data_clear(void *info) +{ + Ecore_Con_CAres *cares = info; + if (cares) cares->data = NULL; +} + +static Eina_Bool +_ecore_con_info_cares_timeout_cb(void *data __UNUSED__) +{ + ares_process_fd(info_channel, ARES_SOCKET_BAD, ARES_SOCKET_BAD); + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_ecore_con_info_cares_fd_cb(Ecore_Con_FD *ecf, + Ecore_Fd_Handler *fd_handler) +{ + ares_socket_t read_fd, write_fd; + + read_fd = write_fd = ARES_SOCKET_BAD; + + if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) + read_fd = ecf->fd; + if (ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_WRITE)) + write_fd = ecf->fd; + + ares_process_fd(info_channel, read_fd, write_fd); + + return ECORE_CALLBACK_RENEW; +} + +static int +_ecore_con_info_fds_search(const Ecore_Con_FD *fd1, + const Ecore_Con_FD *fd2) +{ + return fd1->fd - fd2->fd; +} + +static void +_ecore_con_info_cares_state_cb(void *data __UNUSED__, + ares_socket_t fd, + int readable, + int writable) +{ + int flags = 0; + Ecore_Con_FD *search = NULL, *ecf = NULL; + + search = eina_list_search_unsorted(info_fds, + (Eina_Compare_Cb)_ecore_con_info_fds_search, &ecf); + + if (!(readable | writable)) + { + ares_process_fd(info_channel, ARES_SOCKET_BAD, ARES_SOCKET_BAD); + if (search) + { + info_fds = eina_list_remove(info_fds, search); + ecore_timer_del(search->timer); + ecore_main_fd_handler_del(search->handler); + free(search); + } + return; + } + + if (!search) + { + search = malloc(sizeof(Ecore_Con_FD)); + EINA_SAFETY_ON_NULL_RETURN(search); + + search->fd = fd; + search->handler = ecore_main_fd_handler_add(fd, ECORE_FD_WRITE | ECORE_FD_READ, + (Ecore_Fd_Cb)_ecore_con_info_cares_fd_cb, search, NULL, NULL); + /* c-ares default timeout is 5 seconds */ + search->timer = ecore_timer_add(5, _ecore_con_info_cares_timeout_cb, NULL); + info_fds = eina_list_append(info_fds, search); + } + + if (readable) flags |= ECORE_FD_READ; + if (writable) flags |= ECORE_FD_WRITE; + ecore_main_fd_handler_active_set(search->handler, flags); +} + +static void +_ecore_con_info_ares_host_cb(Ecore_Con_CAres *arg, + int status, + int timeouts __UNUSED__, + struct hostent *hostent) +{ + struct sockaddr *addr; + int addrlen; + + /* Found something ? */ + switch (status) + { + case ARES_SUCCESS: + if (!hostent->h_addr_list[0]) + { + ERR("No IP found"); + goto on_error; + } + + switch (hostent->h_addrtype) + { + case AF_INET: + { + struct sockaddr_in *addri; + + addrlen = sizeof(struct sockaddr_in); + addri = malloc(addrlen); + + if (!addri) + goto on_mem_error; + + addri->sin_family = AF_INET; + addri->sin_port = htons(arg->svr->port); + + memcpy(&addri->sin_addr.s_addr, + hostent->h_addr_list[0], sizeof(struct in_addr)); + + addr = (struct sockaddr *)addri; + break; + } +#ifdef HAVE_IPV6 + case AF_INET6: + { + struct sockaddr_in6 *addri6; + + addrlen = sizeof(struct sockaddr_in6); + addri6 = malloc(addrlen); + + if (!addri6) + goto on_mem_error; + + addri6->sin6_family = AF_INET6; + addri6->sin6_port = htons(arg->svr->port); + addri6->sin6_flowinfo = 0; + addri6->sin6_scope_id = 0; + + memcpy(&addri6->sin6_addr.s6_addr, + hostent->h_addr_list[0], sizeof(struct in6_addr)); + + addr = (struct sockaddr *)addri6; + break; + } +#endif + default: + ERR("Unknown addrtype %i", hostent->h_addrtype); + goto on_error; + } + + if (!_ecore_con_info_ares_getnameinfo(arg, hostent->h_addrtype, + hostent->h_name, + addr, addrlen)) + goto on_error; + + break; + + case ARES_ENOTFOUND: /* address notfound */ + if (arg->byaddr) + { +#ifdef HAVE_IPV6 + /* This happen when host doesn't have a reverse. */ + if (arg->isv6) + { + struct sockaddr_in6 *addri6; + + addrlen = sizeof(struct sockaddr_in6); + addri6 = malloc(addrlen); + + if (!addri6) + goto on_mem_error; + + addri6->sin6_family = AF_INET6; + addri6->sin6_port = htons(arg->svr->port); + addri6->sin6_flowinfo = 0; + addri6->sin6_scope_id = 0; + + memcpy(&addri6->sin6_addr.s6_addr, + &arg->addr.v6, sizeof(struct in6_addr)); + + addr = (struct sockaddr *)addri6; + } + else +#endif + { + struct sockaddr_in *addri; + + addrlen = sizeof(struct sockaddr_in); + addri = malloc(addrlen); + + if (!addri) + goto on_mem_error; + + addri->sin_family = AF_INET; + addri->sin_port = htons(arg->svr->port); + + memcpy(&addri->sin_addr.s_addr, + &arg->addr.v4, sizeof(struct in_addr)); + + addr = (struct sockaddr *)addri; + } + + if (!_ecore_con_info_ares_getnameinfo(arg, +#ifdef HAVE_IPV6 + arg->isv6 ? AF_INET6 : +#endif + AF_INET, + NULL, addr, + addrlen)) + goto on_error; + + break; + } + + case ARES_ENOTIMP: /* unknown family */ + case ARES_EBADNAME: /* not a valid internet address */ + case ARES_ENOMEM: /* not enough memory */ + case ARES_EDESTRUCTION: /* request canceled, shuting down */ + case ARES_ENODATA: /* no data returned */ + case ARES_ECONNREFUSED: /* connection refused */ + case ARES_ETIMEOUT: /* connection timed out */ + ecore_con_event_server_error(arg->svr, ares_strerror(status)); + goto on_error; + + default: + ERR("Unknown status returned by c-ares: %i assuming error", status); + ecore_con_event_server_error(arg->svr, ares_strerror(status)); + goto on_error; + } + + return; + +on_mem_error: + ERR("Not enough memory"); + +on_error: + if (arg->data) + { + ecore_con_server_infos_del(arg->data, arg); + arg->done_cb(arg->data, NULL); + } + free(arg); +} + +static void +_ecore_con_info_ares_nameinfo(Ecore_Con_CAres *arg, + int status, + int timeouts __UNUSED__, + char *node, + char *service) +{ + switch (status) + { + case ARES_SUCCESS: + if (node) + strcpy(arg->result->ip, node); + else + *arg->result->ip = '\0'; + + if (service) + strcpy(arg->result->service, service); + else + *arg->result->service = '\0'; + + if (arg->data) arg->done_cb(arg->data, arg->result); + break; + + case ARES_ENOTIMP: + case ARES_ENOTFOUND: + case ARES_ENOMEM: + case ARES_EDESTRUCTION: + case ARES_EBADFLAGS: + ecore_con_event_server_error(arg->svr, ares_strerror(status)); + if (arg->data) arg->done_cb(arg->data, NULL); + break; + } + + free(arg->result->info.ai_addr); + free(arg->result); + if (arg->data) ecore_con_server_infos_del(arg->data, arg); + free(arg); +} + diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_info.c b/libraries/ecore/src/lib/ecore_con/ecore_con_info.c new file mode 100644 index 0000000..4ece6b0 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_info.c @@ -0,0 +1,450 @@ +/* + * getaddrinfo with callback + * + * man getaddrinfo + * + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef HAVE_ALLOCA_H +# include +#elif defined __GNUC__ +# define alloca __builtin_alloca +#elif defined _AIX +# define alloca __alloca +#elif defined _MSC_VER +# include +# define alloca _alloca +#else +# include +# ifdef __cplusplus +extern "C" +# endif +void *alloca(size_t); +#endif + +#include +#include +#include +#include +#ifdef __OpenBSD__ +# include +#endif + +#ifdef HAVE_NETINET_IN_H +# include +#endif + +#ifdef HAVE_ARPA_INET_H +# include +#endif + +#ifdef HAVE_ARPA_NAMESER_H +# include +#endif + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif + +#ifdef HAVE_NETDB_H +# include +#endif + +#include + +#include "Ecore.h" +#include "ecore_private.h" +#include "ecore_con_private.h" + +typedef struct _CB_Data CB_Data; + +struct _CB_Data +{ + EINA_INLIST; + Ecore_Con_Info_Cb cb_done; + void *data; + Ecore_Fd_Handler *fdh; + pid_t pid; + Ecore_Event_Handler *handler; + int fd2; +}; + +static void _ecore_con_info_readdata(CB_Data *cbdata); +static void _ecore_con_info_slave_free(CB_Data *cbdata); +static Eina_Bool _ecore_con_info_data_handler(void *data, + Ecore_Fd_Handler *fd_handler); +static Eina_Bool _ecore_con_info_exit_handler(void *data, + int type __UNUSED__, + void *event); + +static int info_init = 0; +static CB_Data *info_slaves = NULL; + +int +ecore_con_info_init(void) +{ + info_init++; + return info_init; +} + +int +ecore_con_info_shutdown(void) +{ + info_init--; + if (info_init == 0) + while (info_slaves) _ecore_con_info_slave_free(info_slaves); + + return info_init; +} + +int +ecore_con_info_tcp_connect(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data) +{ + struct addrinfo hints; + + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_CANONNAME; + hints.ai_protocol = IPPROTO_TCP; + hints.ai_canonname = NULL; + hints.ai_next = NULL; + hints.ai_addr = NULL; + + return ecore_con_info_get(svr, done_cb, data, &hints); +} + +int +ecore_con_info_tcp_listen(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data) +{ + struct addrinfo hints; + + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + hints.ai_flags = AI_PASSIVE; + hints.ai_protocol = IPPROTO_TCP; + hints.ai_canonname = NULL; + hints.ai_next = NULL; + hints.ai_addr = NULL; + + return ecore_con_info_get(svr, done_cb, data, &hints); +} + +int +ecore_con_info_udp_connect(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data) +{ + struct addrinfo hints; + + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = AI_CANONNAME; + hints.ai_protocol = IPPROTO_UDP; + hints.ai_canonname = NULL; + hints.ai_next = NULL; + hints.ai_addr = NULL; + + return ecore_con_info_get(svr, done_cb, data, &hints); +} + +int +ecore_con_info_udp_listen(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data) +{ + struct addrinfo hints; + + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = AI_PASSIVE; + hints.ai_protocol = IPPROTO_UDP; + hints.ai_canonname = NULL; + hints.ai_next = NULL; + hints.ai_addr = NULL; + + return ecore_con_info_get(svr, done_cb, data, &hints); +} + +int +ecore_con_info_mcast_listen(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data) +{ + struct addrinfo hints; + + memset(&hints, 0, sizeof(struct addrinfo)); + hints.ai_family = AF_UNSPEC; + hints.ai_socktype = SOCK_DGRAM; + hints.ai_flags = 0; + hints.ai_protocol = IPPROTO_UDP; + hints.ai_canonname = NULL; + hints.ai_next = NULL; + hints.ai_addr = NULL; + + return ecore_con_info_get(svr, done_cb, data, &hints); +} + +EAPI int +ecore_con_info_get(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data, + struct addrinfo *hints) +{ + CB_Data *cbdata; + int fd[2]; + + if (pipe(fd) < 0) + { + ecore_con_event_server_error(svr, strerror(errno)); + return 0; + } + + cbdata = calloc(1, sizeof(CB_Data)); + if (!cbdata) + { + close(fd[0]); + close(fd[1]); + return 0; + } + + cbdata->cb_done = done_cb; + cbdata->data = data; + cbdata->fd2 = fd[1]; + if (!(cbdata->fdh = ecore_main_fd_handler_add(fd[0], ECORE_FD_READ, + _ecore_con_info_data_handler, + cbdata, + NULL, NULL))) + { + ecore_con_event_server_error(svr, "Memory allocation failure"); + free(cbdata); + close(fd[0]); + close(fd[1]); + return 0; + } + + if ((cbdata->pid = fork()) == 0) + { + Ecore_Con_Info *container; + struct addrinfo *result = NULL; + char service[NI_MAXSERV] = {0}; + char hbuf[NI_MAXHOST] = {0}; + char sbuf[NI_MAXSERV] = {0}; + unsigned char *tosend = NULL; + int tosend_len; + int canonname_len = 0; + int err; + + eina_convert_itoa(svr->port, service); + /* CHILD */ + if (!getaddrinfo(svr->name, service, hints, &result) && result) + { + if (result->ai_canonname) + canonname_len = strlen(result->ai_canonname) + 1; + + tosend_len = sizeof(Ecore_Con_Info) + result->ai_addrlen + + canonname_len; + + tosend = alloca(tosend_len); + memset(tosend, 0, tosend_len); + + container = (Ecore_Con_Info *)tosend; + container->size = tosend_len; + + memcpy(&container->info, + result, + sizeof(struct addrinfo)); + memcpy(tosend + sizeof(Ecore_Con_Info), + result->ai_addr, + result->ai_addrlen); + if (result->ai_canonname) /* FIXME: else... */ + memcpy(tosend + sizeof(Ecore_Con_Info) + result->ai_addrlen, + result->ai_canonname, + canonname_len); + + if (!getnameinfo(result->ai_addr, result->ai_addrlen, + hbuf, sizeof(hbuf), sbuf, sizeof(sbuf), + NI_NUMERICHOST | NI_NUMERICSERV)) + { + memcpy(container->ip, hbuf, sizeof(container->ip)); + memcpy(container->service, sbuf, sizeof(container->service)); + } + + err = write(fd[1], tosend, tosend_len); + } + + if (result) + freeaddrinfo(result); + + err = write(fd[1], "", 1); + close(fd[1]); +#if defined(__USE_ISOC99) && !defined(__UCLIBC__) + _Exit(0); +#else + _exit(0); +#endif + } + + /* PARENT */ + cbdata->handler = + ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _ecore_con_info_exit_handler, + cbdata); + close(fd[1]); + if (!cbdata->handler) + { + ecore_main_fd_handler_del(cbdata->fdh); + free(cbdata); + close(fd[0]); + return 0; + } + + info_slaves = (CB_Data *)eina_inlist_append(EINA_INLIST_GET( + info_slaves), + EINA_INLIST_GET(cbdata)); + svr->infos = eina_list_append(svr->infos, cbdata); + return 1; +} + +void +ecore_con_info_data_clear(void *info) +{ + CB_Data *cbdata = info; + cbdata->data = NULL; +} + +static void +_ecore_con_info_readdata(CB_Data *cbdata) +{ + Ecore_Con_Info container; + Ecore_Con_Info *recv_info; + unsigned char *torecv; + int torecv_len; + + ssize_t size; + + size = read(ecore_main_fd_handler_fd_get(cbdata->fdh), &container, + sizeof(Ecore_Con_Info)); + if (size == sizeof(Ecore_Con_Info)) + { + torecv_len = container.size; + torecv = malloc(torecv_len); + + memcpy(torecv, &container, sizeof(Ecore_Con_Info)); + + size = read(ecore_main_fd_handler_fd_get(cbdata->fdh), + torecv + sizeof(Ecore_Con_Info), + torecv_len - sizeof(Ecore_Con_Info)); + if ((size > 0) && + ((size_t)size == torecv_len - sizeof(Ecore_Con_Info))) + { + recv_info = (Ecore_Con_Info *)torecv; + + recv_info->info.ai_addr = + (struct sockaddr *)(torecv + sizeof(Ecore_Con_Info)); + if ((size_t)torecv_len != + (sizeof(Ecore_Con_Info) + recv_info->info.ai_addrlen)) + recv_info->info.ai_canonname = (char *) + (torecv + sizeof(Ecore_Con_Info) + recv_info->info.ai_addrlen); + else + recv_info->info.ai_canonname = NULL; + + recv_info->info.ai_next = NULL; + + if (cbdata->data) + { + cbdata->cb_done(cbdata->data, recv_info); + ecore_con_server_infos_del(cbdata->data, cbdata); + } + + free(torecv); + } + else + { + if (cbdata->data) + { + cbdata->cb_done(cbdata->data, NULL); + ecore_con_server_infos_del(cbdata->data, cbdata); + } + } + } + else + { + if (cbdata->data) + { + ecore_con_event_server_error(cbdata->data, strerror(errno)); + cbdata->cb_done(cbdata->data, NULL); + ecore_con_server_infos_del(cbdata->data, cbdata); + } + } + + cbdata->cb_done = NULL; +} + +static void +_ecore_con_info_slave_free(CB_Data *cbdata) +{ + info_slaves = (CB_Data *)eina_inlist_remove(EINA_INLIST_GET(info_slaves), + EINA_INLIST_GET(cbdata)); + ecore_main_fd_handler_del(cbdata->fdh); + ecore_event_handler_del(cbdata->handler); + close(ecore_main_fd_handler_fd_get(cbdata->fdh)); + if (cbdata->data) ecore_con_server_infos_del(cbdata->data, cbdata); + free(cbdata); +} + +static Eina_Bool +_ecore_con_info_data_handler(void *data, + Ecore_Fd_Handler *fd_handler) +{ + CB_Data *cbdata; + + cbdata = data; + if (cbdata->cb_done) + { + if (ecore_main_fd_handler_active_get(fd_handler, + ECORE_FD_READ)) + _ecore_con_info_readdata(cbdata); + else + { + if (cbdata->data) + { + cbdata->cb_done(cbdata->data, NULL); + cbdata->cb_done = NULL; + ecore_con_server_infos_del(cbdata->data, cbdata); + } + } + } + + _ecore_con_info_slave_free(cbdata); + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_ecore_con_info_exit_handler(void *data, + int type __UNUSED__, + void *event) +{ + CB_Data *cbdata; + Ecore_Exe_Event_Del *ev; + + ev = event; + cbdata = data; + if (cbdata->pid != ev->pid) + return ECORE_CALLBACK_RENEW; + + return ECORE_CALLBACK_CANCEL; /* FIXME: Woot ??? */ + _ecore_con_info_slave_free(cbdata); + return ECORE_CALLBACK_CANCEL; +} + diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_local.c b/libraries/ecore/src/lib/ecore_con/ecore_con_local.c new file mode 100644 index 0000000..f02cc1f --- /dev/null +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_local.c @@ -0,0 +1,317 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_SYS_SOCKET_H +# include +#endif + +#ifdef HAVE_SYS_UN_H +# include +#endif + +#ifdef HAVE_WS2TCPIP_H +# include +#endif + +#include +#include + +#include "Ecore_Con.h" +#include "ecore_con_private.h" + +#define LENGTH_OF_SOCKADDR_UN(s) (strlen((s)->sun_path) + \ + (size_t)(((struct sockaddr_un *)NULL)-> \ + sun_path)) +#define LENGTH_OF_ABSTRACT_SOCKADDR_UN(s, path) (strlen(path) + 1 + \ + (size_t)(((struct sockaddr_un \ + *)NULL)->sun_path)) + +static int _ecore_con_local_init_count = 0; + +int +ecore_con_local_init(void) +{ + if (++_ecore_con_local_init_count != 1) + return _ecore_con_local_init_count; + + return _ecore_con_local_init_count; +} + +int +ecore_con_local_shutdown(void) +{ + if (--_ecore_con_local_init_count != 0) + return _ecore_con_local_init_count; + + return _ecore_con_local_init_count; +} + +int +ecore_con_local_connect(Ecore_Con_Server *svr, + Eina_Bool (*cb_done)(void *data, Ecore_Fd_Handler *fd_handler), + void *data __UNUSED__) +{ +#ifndef HAVE_LOCAL_SOCKETS + return 0; +#else + char buf[4096]; + struct sockaddr_un socket_unix; + int curstate = 0; + const char *homedir; + int socket_unix_len; + + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER) + { + homedir = getenv("HOME"); + if (!homedir) + homedir = getenv("TMP"); + + if (!homedir) + homedir = "/tmp"; + + snprintf(buf, sizeof(buf), "%s/.ecore/%s/%i", homedir, svr->name, + svr->port); + } + else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM) + { + if (svr->port < 0) + { + if (svr->name[0] == '/') + strncpy(buf, svr->name, sizeof(buf)); + else + snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s", svr->name); + } + else + { + if (svr->name[0] == + '/') + snprintf(buf, sizeof(buf), "%s|%i", svr->name, + svr->port); + else + snprintf(buf, sizeof(buf), "/tmp/.ecore_service|%s|%i", + svr->name, + svr->port); + } + } + else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) + strncpy(buf, svr->name, + sizeof(buf)); + + svr->fd = socket(AF_UNIX, SOCK_STREAM, 0); + if (svr->fd < 0) + return 0; + + if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) + return 0; + + if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) + return 0; + + if (setsockopt(svr->fd, SOL_SOCKET, SO_REUSEADDR, (const void *)&curstate, + sizeof(curstate)) < 0) + return 0; + + socket_unix.sun_family = AF_UNIX; + + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) + { +#ifdef HAVE_ABSTRACT_SOCKETS + /* copy name insto sun_path, prefixed by null to indicate abstract namespace */ + snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", + svr->name); + socket_unix.sun_path[0] = '\0'; + socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, + svr->name); +#else + WRN("Your system does not support abstract sockets!"); + return 0; +#endif + } + else + { + strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); + socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix); + } + + if (connect(svr->fd, (struct sockaddr *)&socket_unix, + socket_unix_len) < 0) + return 0; + + svr->path = strdup(buf); + if (!svr->path) + return 0; + + if (svr->type & ECORE_CON_SSL) + ecore_con_ssl_server_init(svr); + + svr->fd_handler = + ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ, + cb_done, svr, NULL, NULL); + if (!svr->fd_handler) + return 0; + + if (!svr->delete_me) ecore_con_event_server_add(svr); + + return 1; +#endif +} + +int +ecore_con_local_listen( + Ecore_Con_Server *svr, + Eina_Bool (* + cb_listen)(void *data, + Ecore_Fd_Handler * + fd_handler), + void *data + __UNUSED__) +{ +#ifdef HAVE_LOCAL_SOCKETS + char buf[4096]; + struct sockaddr_un socket_unix; + struct linger lin; + mode_t pmode; + const char *homedir; + struct stat st; + mode_t mask; + int socket_unix_len; + + mask = S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH; + + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER) + { + homedir = getenv("HOME"); + if (!homedir) + homedir = getenv("TMP"); + + if (!homedir) + homedir = "/tmp"; + + mask = S_IRUSR | S_IWUSR | S_IXUSR; + snprintf(buf, sizeof(buf), "%s/.ecore", homedir); + if (stat(buf, &st) < 0) + mkdir(buf, mask); + + snprintf(buf, sizeof(buf), "%s/.ecore/%s", homedir, svr->name); + if (stat(buf, &st) < 0) + mkdir(buf, mask); + + snprintf(buf, + sizeof(buf), + "%s/.ecore/%s/%i", + homedir, + svr->name, + svr->port); + mask = S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH; + } + else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM) + { + mask = 0; + if (svr->name[0] == '/') + { + if (svr->port >= 0) + snprintf(buf, + sizeof(buf), + "%s|%i", + svr->name, + svr->port); + else + snprintf(buf, + sizeof(buf), + "%s", + svr->name); + } + else + snprintf(buf, + sizeof(buf), + "/tmp/.ecore_service|%s|%i", + svr->name, + svr->port); + } + else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) + strncpy(buf, svr->name, + sizeof(buf)); + + pmode = umask(mask); +start: + svr->fd = socket(AF_UNIX, SOCK_STREAM, 0); + if (svr->fd < 0) + goto error_umask; + + if (fcntl(svr->fd, F_SETFL, O_NONBLOCK) < 0) + goto error_umask; + + if (fcntl(svr->fd, F_SETFD, FD_CLOEXEC) < 0) + goto error_umask; + + lin.l_onoff = 1; + lin.l_linger = 0; + if (setsockopt(svr->fd, SOL_SOCKET, SO_LINGER, (const void *)&lin, + sizeof(struct linger)) < 0) + goto error_umask; + + socket_unix.sun_family = AF_UNIX; + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) + { +#ifdef HAVE_ABSTRACT_SOCKETS + /* . is a placeholder */ + snprintf(socket_unix.sun_path, sizeof(socket_unix.sun_path), ".%s", + svr->name); + /* first char null indicates abstract namespace */ + socket_unix.sun_path[0] = '\0'; + socket_unix_len = LENGTH_OF_ABSTRACT_SOCKADDR_UN(&socket_unix, + svr->name); +#else + ERR("Your system does not support abstract sockets!"); + goto error_umask; +#endif + } + else + { + strncpy(socket_unix.sun_path, buf, sizeof(socket_unix.sun_path)); + socket_unix_len = LENGTH_OF_SOCKADDR_UN(&socket_unix); + } + + if (bind(svr->fd, (struct sockaddr *)&socket_unix, socket_unix_len) < 0) + { + if ((((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER) || + ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM)) && + (connect(svr->fd, (struct sockaddr *)&socket_unix, + socket_unix_len) < 0) && + (unlink(buf) >= 0)) + goto start; + else + goto error_umask; + } + + if (listen(svr->fd, 4096) < 0) + goto error_umask; + + svr->path = strdup(buf); + if (!svr->path) + goto error_umask; + + svr->fd_handler = + ecore_main_fd_handler_add(svr->fd, ECORE_FD_READ, + cb_listen, svr, NULL, NULL); + umask(pmode); + if (!svr->fd_handler) + goto error; + + return 1; + +error_umask: + umask(pmode); +error: +#endif /* HAVE_LOCAL_SOCKETS */ + return 0; +} + diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_local_win32.c b/libraries/ecore/src/lib/ecore_con/ecore_con_local_win32.c new file mode 100644 index 0000000..858daa5 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_local_win32.c @@ -0,0 +1,769 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include +#include + +#include "Ecore_Con.h" +#include "ecore_con_private.h" + +#define BUFSIZE 512 + + +static int _ecore_con_local_init_count = 0; + +int +ecore_con_local_init(void) +{ + if (++_ecore_con_local_init_count != 1) + return _ecore_con_local_init_count; + + return _ecore_con_local_init_count; +} + +int +ecore_con_local_shutdown(void) +{ + if (--_ecore_con_local_init_count != 0) + return _ecore_con_local_init_count; + + return _ecore_con_local_init_count; +} + + +static Eina_Bool +_ecore_con_local_win32_server_read_client_handler(void *data, Ecore_Win32_Handler *wh) +{ + Ecore_Con_Client *cl; + void *buf; + DWORD n; + Eina_Bool broken_pipe = EINA_FALSE; + + cl = (Ecore_Con_Client *)data; + + if (!ResetEvent(cl->host_server->event_read)) + return ECORE_CALLBACK_RENEW; + + buf = malloc(cl->host_server->nbr_bytes); + if (!buf) + return ECORE_CALLBACK_RENEW; + + if (ReadFile(cl->host_server->pipe, buf, cl->host_server->nbr_bytes, &n, NULL)) + { + if (!cl->delete_me) + ecore_con_event_client_data(cl, buf, cl->host_server->nbr_bytes, EINA_FALSE); + cl->host_server->want_write = 1; + } + else + { + if (GetLastError() == ERROR_BROKEN_PIPE) + broken_pipe = EINA_TRUE; + } + + if (broken_pipe) + { +#if 0 + char *msg; + + msg = evil_last_error_get(); + if (msg) + { + ecore_con_event_client_error(cl, msg); + free(msg); + } +#endif + if (!cl->delete_me) + ecore_con_event_client_del(cl); + cl->dead = EINA_TRUE; + return ECORE_CALLBACK_CANCEL; + } + + if (cl->host_server->want_write) + ecore_con_local_win32_client_flush(cl); + + ecore_main_win32_handler_del(wh); + + return ECORE_CALLBACK_DONE; +} + +static Eina_Bool +_ecore_con_local_win32_server_peek_client_handler(void *data, Ecore_Win32_Handler *wh) +{ + Ecore_Con_Client *cl; +#if 0 + char *msg; +#endif + + cl = (Ecore_Con_Client *)data; + + if (!ResetEvent(cl->host_server->event_peek)) + return ECORE_CALLBACK_RENEW; + +#if 0 + msg = evil_last_error_get(); + if (msg) + { + ecore_con_event_server_error(cl->host_server, msg); + free(msg); + } +#endif + if (!cl->host_server->delete_me) + ecore_con_event_server_del(cl->host_server); + cl->host_server->dead = EINA_TRUE; + return ECORE_CALLBACK_CANCEL; + + ecore_main_win32_handler_del(wh); + + return ECORE_CALLBACK_DONE; +} + +static Eina_Bool +_ecore_con_local_win32_client_peek_server_handler(void *data, Ecore_Win32_Handler *wh) +{ + Ecore_Con_Server *svr; +#if 0 + char *msg; +#endif + + svr = (Ecore_Con_Server *)data; + + if (!ResetEvent(svr->event_peek)) + return ECORE_CALLBACK_RENEW; +#if 0 + msg = evil_last_error_get(); + if (msg) + { + ecore_con_event_server_error(svr, msg); + free(msg); + } +#endif + if (!svr->delete_me) + ecore_con_event_server_del(svr); + svr->dead = EINA_TRUE; + return ECORE_CALLBACK_CANCEL; + + ecore_main_win32_handler_del(wh); + + return ECORE_CALLBACK_DONE; +} + +static Eina_Bool +_ecore_con_local_win32_client_read_server_handler(void *data, Ecore_Win32_Handler *wh) +{ + Ecore_Con_Server *svr; + void *buf; + DWORD n; + Eina_Bool broken_pipe = EINA_FALSE; + + svr = (Ecore_Con_Server *)data; + + if (!ResetEvent(svr->event_read)) + return ECORE_CALLBACK_RENEW; + + buf = malloc(svr->nbr_bytes); + if (!buf) + return ECORE_CALLBACK_RENEW; + + if (ReadFile(svr->pipe, buf, svr->nbr_bytes, &n, NULL)) + { + if (!svr->delete_me) + ecore_con_event_server_data(svr, buf, svr->nbr_bytes, EINA_FALSE); + svr->want_write = 1; + } + else + { + if (GetLastError() == ERROR_BROKEN_PIPE) + broken_pipe = EINA_TRUE; + } + + if (broken_pipe) + { +#if 0 + char *msg; + + msg = evil_last_error_get(); + if (msg) + { + ecore_con_event_server_error(svr, msg); + free(msg); + } +#endif + if (!svr->delete_me) + ecore_con_event_server_del(svr); + svr->dead = EINA_TRUE; + return ECORE_CALLBACK_CANCEL; + } + + if (svr->want_write) + ecore_con_local_win32_server_flush(svr); + + ecore_main_win32_handler_del(wh); + + return ECORE_CALLBACK_DONE; +} + +/* thread to read data sent by the server to the client */ +static unsigned int __stdcall +_ecore_con_local_win32_client_read_server_thread(void *data) +{ + Ecore_Con_Server *svr; + DWORD nbr_bytes = 0; + + svr = (Ecore_Con_Server *)data; + + svr->read_stopped = EINA_FALSE; + + while (!svr->read_stop) + { + if (PeekNamedPipe(svr->pipe, NULL, 0, NULL, &nbr_bytes, NULL)) + { + if (nbr_bytes <= 0) + continue; + + svr->nbr_bytes = nbr_bytes; + if (!SetEvent(svr->event_read)) + continue; + } + else + { + if (GetLastError() == ERROR_BROKEN_PIPE) + { + if (!SetEvent(svr->event_peek)) + continue; + break; + } + } + } + + printf(" ### %s\n", __FUNCTION__); + svr->read_stopped = EINA_TRUE; + _endthreadex(0); + return 0; +} + +/* thread to read data sent by the client to the server */ +static unsigned int __stdcall +_ecore_con_local_win32_server_read_client_thread(void *data) +{ + Ecore_Con_Client *cl; + DWORD nbr_bytes = 0; + + cl = (Ecore_Con_Client *)data; + + cl->host_server->read_stopped = EINA_FALSE; + + while (!cl->host_server->read_stop) + { + if (PeekNamedPipe(cl->host_server->pipe, NULL, 0, NULL, &nbr_bytes, NULL)) + { + if (nbr_bytes <= 0) + continue; + + cl->host_server->nbr_bytes = nbr_bytes; + if (!SetEvent(cl->host_server->event_read)) + continue; + } + else + { + if (GetLastError() == ERROR_BROKEN_PIPE) + { + if (!SetEvent(cl->host_server->event_peek)) + continue; + break; + } + } + } + + printf(" ### %s\n", __FUNCTION__); + cl->host_server->read_stopped = EINA_TRUE; + _endthreadex(0); + return 0; +} + +static Eina_Bool +_ecore_con_local_win32_client_add(void *data, Ecore_Win32_Handler *wh) +{ + Ecore_Con_Client *cl = NULL; + Ecore_Con_Server *svr; + Ecore_Win32_Handler *handler_read; + Ecore_Win32_Handler *handler_peek; + + svr = (Ecore_Con_Server *)data; + + if (!svr->pipe) + return ECORE_CALLBACK_CANCEL; + + if (svr->dead) + return ECORE_CALLBACK_CANCEL; + + if (svr->delete_me) + return ECORE_CALLBACK_CANCEL; + + if ((svr->client_limit >= 0) && (!svr->reject_excess_clients) && + (svr->client_count >= (unsigned int)svr->client_limit)) + return ECORE_CALLBACK_CANCEL; + + cl = calloc(1, sizeof(Ecore_Con_Client)); + if (!cl) + { + ERR("allocation failed"); + return ECORE_CALLBACK_CANCEL; + } + + cl->host_server = svr; + ECORE_MAGIC_SET(cl, ECORE_MAGIC_CON_CLIENT); + + cl->host_server->event_read = CreateEvent(NULL, TRUE, FALSE, NULL); + if (!cl->host_server->event_read) + { + ERR("Can not create event read"); + goto free_cl; + } + + handler_read = ecore_main_win32_handler_add(cl->host_server->event_read, + _ecore_con_local_win32_server_read_client_handler, + cl); + if (!handler_read) + { + ERR("Can not create handler read"); + goto close_event_read; + } + + cl->host_server->event_peek = CreateEvent(NULL, TRUE, FALSE, NULL); + if (!cl->host_server->event_peek) + { + ERR("Can not create event peek"); + goto del_handler_read; + } + + handler_peek = ecore_main_win32_handler_add(cl->host_server->event_peek, + _ecore_con_local_win32_server_peek_client_handler, + cl); + if (!handler_peek) + { + ERR("Can not create handler peek"); + goto close_event_peek; + } + + cl->host_server->read_stopped = EINA_TRUE; + cl->host_server->thread_read = (HANDLE)_beginthreadex(NULL, 0, _ecore_con_local_win32_server_read_client_thread, cl, CREATE_SUSPENDED, NULL); + if (!cl->host_server->thread_read) + { + ERR("Can not launch thread"); + goto del_handler_peek; + } + + svr->clients = eina_list_append(svr->clients, cl); + svr->client_count++; + + if (!cl->delete_me) + ecore_con_event_client_add(cl); + + ecore_main_win32_handler_del(wh); + + ResumeThread(cl->host_server->thread_read); + return ECORE_CALLBACK_DONE; + + del_handler_peek: + ecore_main_win32_handler_del(handler_peek); + close_event_peek: + CloseHandle(cl->host_server->event_peek); + del_handler_read: + ecore_main_win32_handler_del(handler_read); + close_event_read: + CloseHandle(cl->host_server->event_read); + free_cl: + free(cl); + + return ECORE_CALLBACK_CANCEL; +} + +static unsigned int __stdcall +_ecore_con_local_win32_listening(void *data) +{ + Ecore_Con_Server *svr; + BOOL res; + + svr = (Ecore_Con_Server *)data; + + while (1) + { + res = ConnectNamedPipe(svr->pipe, NULL); + if (!res) + { + ERR("Opening the connection to the client failed"); + CloseHandle(svr->pipe); + svr->pipe = NULL; + } + break; + } + + DBG("Client connected"); + + printf(" ### %s\n", __FUNCTION__); + _endthreadex(0); + return 0; +} + +Eina_Bool +ecore_con_local_listen(Ecore_Con_Server *svr) +{ + char buf[256]; + HANDLE thread_listening; + Ecore_Win32_Handler *handler; + + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) + { + ERR("Your system does not support abstract sockets!"); + return EINA_FALSE; + } + + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER) + snprintf(buf, sizeof(buf), "\\\\.\\pipe\\%s", svr->name); + else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM) + { + const char *computername; + + computername = getenv("CoMPUTERNAME"); + snprintf(buf, sizeof(buf), "\\\\%s\\pipe\\%s", computername, svr->name); + } + + svr->path = strdup(buf); + if (!svr->path) + { + ERR("Allocation failed"); + return EINA_FALSE; + } + + /* + * synchronuous + * block mode + * wait mode + */ + svr->pipe = CreateNamedPipe(svr->path, + PIPE_ACCESS_DUPLEX, + PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT, + PIPE_UNLIMITED_INSTANCES, + BUFSIZE, + BUFSIZE, + 5000, + NULL); + if (svr->pipe == INVALID_HANDLE_VALUE) + { + ERR("Creation of the named pipe failed"); + goto free_path; + } + + /* + * We use ConnectNamedPipe() to wait for a client to connect. + * As the function is blocking, to let the main loop continuing + * its iterations, we call ConnectNamedPipe() in a thread + */ + thread_listening = (HANDLE)_beginthreadex(NULL, 0, _ecore_con_local_win32_listening, svr, CREATE_SUSPENDED, NULL); + if (!thread_listening) + { + ERR("Creation of the listening thread failed"); + goto close_pipe; + } + + handler = ecore_main_win32_handler_add(thread_listening, + _ecore_con_local_win32_client_add, + svr); + if (!handler) + { + ERR("Creation of the client add handler failed"); + goto del_handler; + } + + svr->read_stopped = EINA_TRUE; + ResumeThread(thread_listening); + + return EINA_TRUE; + + del_handler: + ecore_main_win32_handler_del(handler); + close_pipe: + CloseHandle(svr->pipe); + free_path: + free(svr->path); + svr->path = NULL; + + return EINA_FALSE; +} + +void +ecore_con_local_win32_server_del(Ecore_Con_Server *svr) +{ + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) + return; + + if (((svr->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_USER) && + ((svr->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_SYSTEM)) + return; + + svr->read_stop = 1; + while (!svr->read_stopped) + Sleep(100); + + if (svr->event_peek) + CloseHandle(svr->event_peek); + svr->event_peek = NULL; + if (svr->event_read) + CloseHandle(svr->event_read); + svr->event_read = NULL; + free(svr->path); + svr->path = NULL; + if (svr->pipe) + CloseHandle(svr->pipe); + svr->pipe = NULL; +} + +void +ecore_con_local_win32_client_del(Ecore_Con_Client *cl) +{ + if ((cl->host_server->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) + return; + + if (((cl->host_server->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_USER) && + ((cl->host_server->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_SYSTEM)) + return; + + cl->host_server->read_stop = 1; + while (!cl->host_server->read_stopped) + Sleep(100); + + if (cl->host_server->event_peek) + CloseHandle(cl->host_server->event_peek); + cl->host_server->event_peek = NULL; + if (cl->host_server->event_read) + CloseHandle(cl->host_server->event_read); + cl->host_server->event_read = NULL; + free(cl->host_server->path); + cl->host_server->path = NULL; + if (cl->host_server->pipe) + CloseHandle(cl->host_server->pipe); + cl->host_server->pipe = NULL; +} + +Eina_Bool +ecore_con_local_connect(Ecore_Con_Server *svr, + Eina_Bool (*cb_done)(void *data, + Ecore_Fd_Handler *fd_handler)) +{ + char buf[256]; + Ecore_Win32_Handler *handler_read; + Ecore_Win32_Handler *handler_peek; + + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) + { + ERR("Your system does not support abstract sockets!"); + return EINA_FALSE; + } + + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_USER) + snprintf(buf, sizeof(buf), "\\\\.\\pipe\\%s", svr->name); + else if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_SYSTEM) + { + const char *computername; + + computername = getenv("COMPUTERNAME"); + snprintf(buf, sizeof(buf), "\\\\%s\\pipe\\%s", computername, svr->name); + } + + while (1) + { + svr->pipe = CreateFile(buf, + GENERIC_READ | GENERIC_WRITE, + 0, + NULL, + OPEN_EXISTING, + 0, + NULL); + if (svr->pipe != INVALID_HANDLE_VALUE) + break; + + /* if pipe not busy, we exit */ + if (GetLastError() != ERROR_PIPE_BUSY) + { + ERR("Connection to a server failed"); + return EINA_FALSE; + } + + /* pipe busy, so we wait for it */ + if (!WaitNamedPipe(buf, NMPWAIT_WAIT_FOREVER)) + { + ERR("Can not wait for a server"); + goto close_pipe; + } + } + + svr->path = strdup(buf); + if (!svr->path) + { + ERR("Allocation failed"); + goto close_pipe; + } + + svr->event_read = CreateEvent(NULL, TRUE, FALSE, NULL); + if (!svr->event_read) + { + ERR("Can not create event read"); + goto free_path; + } + + handler_read = ecore_main_win32_handler_add(svr->event_read, + _ecore_con_local_win32_client_read_server_handler, + svr); + if (!handler_read) + { + ERR("Can not create handler read"); + goto close_event_read; + } + + svr->event_peek = CreateEvent(NULL, TRUE, FALSE, NULL); + if (!svr->event_peek) + { + ERR("Can not create event peek"); + goto del_handler_read; + } + + handler_peek = ecore_main_win32_handler_add(svr->event_peek, + _ecore_con_local_win32_client_peek_server_handler, + svr); + if (!handler_peek) + { + ERR("Can not create handler peek"); + goto close_event_peek; + } + + svr->thread_read = (HANDLE)_beginthreadex(NULL, 0, _ecore_con_local_win32_client_read_server_thread, svr, CREATE_SUSPENDED, NULL); + if (!svr->thread_read) + { + ERR("Can not launch thread"); + goto del_handler_peek; + } + + if (!svr->delete_me) ecore_con_event_server_add(svr); + + ResumeThread(svr->thread_read); + + return EINA_TRUE; + + del_handler_peek: + ecore_main_win32_handler_del(handler_peek); + close_event_peek: + CloseHandle(svr->event_peek); + del_handler_read: + ecore_main_win32_handler_del(handler_read); + close_event_read: + CloseHandle(svr->event_read); + free_path: + free(svr->path); + svr->path = NULL; + close_pipe: + CloseHandle(svr->pipe); + + return EINA_FALSE; +} + +Eina_Bool +ecore_con_local_win32_server_flush(Ecore_Con_Server *svr) +{ + int num; + BOOL res; + DWORD written; + + /* This check should never be true */ + if ((svr->type & ECORE_CON_TYPE) == ECORE_CON_LOCAL_ABSTRACT) + return EINA_TRUE; + + if (((svr->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_USER) && + ((svr->type & ECORE_CON_TYPE) != ECORE_CON_LOCAL_SYSTEM)) + return EINA_FALSE; + + num = eina_binbuf_length_get(svr->buf) - svr->write_buf_offset; + if (num <= 0) return EINA_TRUE; + + res = WriteFile(svr->pipe, eina_binbuf_string_get(svr->buf) + svr->write_buf_offset, num, &written, NULL); + if (!res) + { + char *msg; + + msg = evil_last_error_get(); + if (msg) + { + ecore_con_event_server_error(svr, msg); + free(msg); + } + if (!svr->delete_me) + ecore_con_event_server_del(svr); + svr->dead = EINA_TRUE; + } + + svr->write_buf_offset += written; + if (svr->write_buf_offset >= eina_binbuf_length_get(svr->buf)) + { + svr->write_buf_offset = 0; + eina_binbuf_free(svr->buf); + svr->buf = NULL; + svr->want_write = 0; + } + else if (written < (DWORD)num) + svr->want_write = 1; + + return EINA_TRUE; +} + +Eina_Bool +ecore_con_local_win32_client_flush(Ecore_Con_Client *cl) +{ + Ecore_Con_Type type; + int num; + BOOL res; + DWORD written; + + type = cl->host_server->type & ECORE_CON_TYPE; + + /* This check should never be true */ + if (type == ECORE_CON_LOCAL_ABSTRACT) + return EINA_TRUE; + + if ((type != ECORE_CON_LOCAL_USER) && + (type != ECORE_CON_LOCAL_SYSTEM)) + return EINA_FALSE; + + num = eina_binbuf_length_get(cl->buf) - cl->buf_offset; + if (num <= 0) return EINA_TRUE; + + res = WriteFile(cl->host_server->pipe, eina_binbuf_string_get(cl->buf) + cl->buf_offset, num, &written, NULL); + if (!res) + { + char *msg; + + msg = evil_last_error_get(); + if (msg) + { + ecore_con_event_client_error(cl, msg); + free(msg); + } + if (!cl->delete_me) + ecore_con_event_client_del(cl); + cl->dead = EINA_TRUE; + } + + cl->buf_offset += written; + if (cl->buf_offset >= eina_binbuf_length_get(cl->buf)) + { + cl->buf_offset = 0; + eina_binbuf_free(cl->buf); + cl->buf = NULL; + cl->host_server->want_write = 0; + } + else if (written < (DWORD)num) + cl->host_server->want_write = 1; + + return EINA_TRUE; +} diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_private.h b/libraries/ecore/src/lib/ecore_con/ecore_con_private.h new file mode 100644 index 0000000..f601465 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_private.h @@ -0,0 +1,321 @@ +#ifndef _ECORE_CON_PRIVATE_H +#define _ECORE_CON_PRIVATE_H + +#include "ecore_private.h" +#include "Ecore_Con.h" + +#define ECORE_MAGIC_CON_SERVER 0x77665544 +#define ECORE_MAGIC_CON_CLIENT 0x77556677 +#define ECORE_MAGIC_CON_URL 0x77074255 + +#define ECORE_CON_TYPE 0x0f +#define ECORE_CON_SSL 0xf0 + +#if USE_GNUTLS +# include +#elif USE_OPENSSL +# include +#endif +#ifdef HAVE_CURL +#include +#endif + +#define READBUFSIZ 65536 + +extern int _ecore_con_log_dom; + +#ifdef ECORE_CON_DEFAULT_LOG_COLOR +#undef ECORE_LOG_DEFAULT_LOG_COLOR +#endif +#define ECORE_CON_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_ecore_con_log_dom, __VA_ARGS__) + +#ifdef DBG +# undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_ecore_con_log_dom, __VA_ARGS__) + +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_ecore_con_log_dom, __VA_ARGS__) + +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_ecore_con_log_dom, __VA_ARGS__) + +#ifdef CRIT +# undef CRIT +#endif +#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_con_log_dom, __VA_ARGS__) + +typedef struct _Ecore_Con_Lookup Ecore_Con_Lookup; +typedef struct _Ecore_Con_Info Ecore_Con_Info; + +typedef void (*Ecore_Con_Info_Cb)(void *data, Ecore_Con_Info *infos); + +typedef enum _Ecore_Con_State +{ + ECORE_CON_CONNECTED, + ECORE_CON_DISCONNECTED, + ECORE_CON_INPROGRESS +} Ecore_Con_State; + +typedef enum _Ecore_Con_Ssl_Error +{ + ECORE_CON_SSL_ERROR_NONE = 0, + ECORE_CON_SSL_ERROR_NOT_SUPPORTED, + ECORE_CON_SSL_ERROR_INIT_FAILED, + ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED, + ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED +} Ecore_Con_Ssl_Error; + +typedef enum _Ecore_Con_Ssl_Handshake +{ + ECORE_CON_SSL_STATE_DONE = 0, + ECORE_CON_SSL_STATE_HANDSHAKING, + ECORE_CON_SSL_STATE_INIT +} Ecore_Con_Ssl_State; + +struct _Ecore_Con_Client +{ + ECORE_MAGIC; + int fd; + Ecore_Con_Server *host_server; + void *data; + Ecore_Fd_Handler *fd_handler; + unsigned int buf_offset; + Eina_Binbuf *buf; + const char *ip; + Eina_List *event_count; + struct sockaddr *client_addr; + int client_addr_len; + double start_time; + Ecore_Timer *until_deletion; + double disconnect_time; +#if USE_GNUTLS + gnutls_datum_t session_ticket; + gnutls_session_t session; +#elif USE_OPENSSL + SSL *ssl; + int ssl_err; +#endif + Ecore_Con_Ssl_State ssl_state; + Eina_Bool handshaking : 1; + Eina_Bool upgrade : 1; + Eina_Bool dead : 1; + Eina_Bool delete_me : 1; +}; + +struct _Ecore_Con_Server +{ + ECORE_MAGIC; + int fd; + Ecore_Con_Type type; + char *name; + int port; + char *path; + void *data; + Ecore_Fd_Handler *fd_handler; + Eina_List *clients; + unsigned int client_count; + Eina_Binbuf *buf; + unsigned int write_buf_offset; + Eina_List *infos; + Eina_List *event_count; + int client_limit; + pid_t ppid; +#if USE_GNUTLS + gnutls_session_t session; + gnutls_anon_client_credentials_t anoncred_c; + gnutls_anon_server_credentials_t anoncred_s; + gnutls_psk_client_credentials_t pskcred_c; + gnutls_psk_server_credentials_t pskcred_s; + gnutls_certificate_credentials_t cert; + char *cert_file; + gnutls_dh_params_t dh_params; +#elif USE_OPENSSL + SSL_CTX *ssl_ctx; + SSL *ssl; + int ssl_err; +#endif + double start_time; + Ecore_Timer *until_deletion; + double disconnect_time; + double client_disconnect_time; + const char *ip; + Eina_Bool dead : 1; + Eina_Bool created : 1; /* EINA_TRUE if server is our listening server */ + Eina_Bool connecting : 1; /* EINA_FALSE if just initialized or connected */ + Eina_Bool handshaking : 1; /* EINA_TRUE if server is ssl handshaking */ + Eina_Bool upgrade : 1; + Eina_Bool ssl_prepared : 1; + Eina_Bool use_cert : 1; /* EINA_TRUE if using certificate auth */ + Ecore_Con_Ssl_State ssl_state; /* current state of ssl handshake on the server */ + Eina_Bool verify : 1; /* EINA_TRUE if certificates will be verified */ + Eina_Bool verify_basic : 1; /* EINA_TRUE if certificates will be verified only against the hostname */ + Eina_Bool reject_excess_clients : 1; + Eina_Bool delete_me : 1; +#ifdef _WIN32 + Eina_Bool want_write : 1; + Eina_Bool read_stop : 1; + Eina_Bool read_stopped : 1; + HANDLE pipe; + HANDLE thread_read; + HANDLE event_read; + HANDLE event_peek; + DWORD nbr_bytes; +#endif +}; + +#ifdef HAVE_CURL +struct _Ecore_Con_Url +{ + ECORE_MAGIC; + CURL *curl_easy; + struct curl_slist *headers; + Eina_List *additional_headers; + Eina_List *response_headers; + const char *url; + + Ecore_Con_Url_Time time_condition; + double timestamp; + void *data; + + Ecore_Fd_Handler *fd_handler; + int fd; + int flags; + + int received; + int write_fd; + + Eina_Bool active : 1; +}; +#endif + +struct _Ecore_Con_Info +{ + unsigned int size; + struct addrinfo info; + char ip[NI_MAXHOST]; + char service[NI_MAXSERV]; +}; + +struct _Ecore_Con_Lookup +{ + Ecore_Con_Dns_Cb done_cb; + const void *data; +}; + +/* from ecore_con.c */ +void ecore_con_server_infos_del(Ecore_Con_Server *svr, void *info); +void ecore_con_event_server_data(Ecore_Con_Server *svr, unsigned char *buf, int num, Eina_Bool duplicate); +void ecore_con_event_server_del(Ecore_Con_Server *svr); +void ecore_con_event_server_error(Ecore_Con_Server *svr, const char *error); +void ecore_con_event_client_add(Ecore_Con_Client *cl); +void ecore_con_event_client_data(Ecore_Con_Client *cl, unsigned char *buf, int num, Eina_Bool duplicate); +void ecore_con_event_client_del(Ecore_Con_Client *cl); +void ecore_con_event_client_error(Ecore_Con_Client *cl, const char *error); + +/* from ecore_local_win32.c */ +#ifdef _WIN32 +Eina_Bool ecore_con_local_listen(Ecore_Con_Server *svr); +Eina_Bool ecore_con_local_connect(Ecore_Con_Server *svr, + Eina_Bool (*cb_done)(void *data, + Ecore_Fd_Handler *fd_handler)); +Eina_Bool ecore_con_local_win32_server_flush(Ecore_Con_Server *svr); +Eina_Bool ecore_con_local_win32_client_flush(Ecore_Con_Client *cl); +void ecore_con_local_win32_server_del(Ecore_Con_Server *svr); +void ecore_con_local_win32_client_del(Ecore_Con_Client *cl); +#else +/* from ecore_local.c */ +int ecore_con_local_init(void); +int ecore_con_local_shutdown(void); +int ecore_con_local_connect(Ecore_Con_Server *svr, + Eina_Bool (*cb_done)( + void *data, + Ecore_Fd_Handler *fd_handler), + void *data); +int ecore_con_local_listen(Ecore_Con_Server *svr, + Eina_Bool (*cb_listen)( + void *data, + Ecore_Fd_Handler *fd_handler), + void *data); +#endif + +/* from ecore_con_info.c */ +int ecore_con_info_init(void); +int ecore_con_info_shutdown(void); +int ecore_con_info_tcp_connect(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data); +int ecore_con_info_tcp_listen(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data); +int ecore_con_info_udp_connect(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data); +int ecore_con_info_udp_listen(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data); +int ecore_con_info_mcast_listen(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data); +void ecore_con_info_data_clear(void *info); + +void ecore_con_event_server_add(Ecore_Con_Server *svr); + + +/* from ecore_con_ssl.c */ +Ecore_Con_Ssl_Error ecore_con_ssl_init(void); +Ecore_Con_Ssl_Error ecore_con_ssl_shutdown(void); +Ecore_Con_Ssl_Error ecore_con_ssl_server_prepare(Ecore_Con_Server *svr, int ssl_type); +Ecore_Con_Ssl_Error ecore_con_ssl_server_init(Ecore_Con_Server *svr); +Ecore_Con_Ssl_Error ecore_con_ssl_server_shutdown(Ecore_Con_Server *svr); +int ecore_con_ssl_server_read(Ecore_Con_Server *svr, + unsigned char *buf, + int size); +int ecore_con_ssl_server_write(Ecore_Con_Server *svr, + const unsigned char *buf, + int size); +Ecore_Con_Ssl_Error ecore_con_ssl_client_init(Ecore_Con_Client *svr); +Ecore_Con_Ssl_Error ecore_con_ssl_client_shutdown(Ecore_Con_Client *svr); +int ecore_con_ssl_client_read(Ecore_Con_Client *svr, + unsigned char *buf, + int size); +int ecore_con_ssl_client_write(Ecore_Con_Client *svr, + const unsigned char *buf, + int size); + +int ecore_con_info_get(Ecore_Con_Server *svr, + Ecore_Con_Info_Cb done_cb, + void *data, + struct addrinfo *hints); + + +#define GENERIC_ALLOC_FREE_HEADER(TYPE, Type) \ + TYPE *Type##_alloc(void); \ + void Type##_free(TYPE *e); + +GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Client_Add, ecore_con_event_client_add); +GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Client_Del, ecore_con_event_client_del); +GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Client_Write, ecore_con_event_client_write); +GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Client_Data, ecore_con_event_client_data); +GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Error, ecore_con_event_server_error); +GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Client_Error, ecore_con_event_client_error); +GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Add, ecore_con_event_server_add); +GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Del, ecore_con_event_server_del); +GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Write, ecore_con_event_server_write); +GENERIC_ALLOC_FREE_HEADER(Ecore_Con_Event_Server_Data, ecore_con_event_server_data); + +void ecore_con_mempool_init(void); +void ecore_con_mempool_shutdown(void); + +#undef GENERIC_ALLOC_FREE_HEADER + +#endif diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c b/libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c new file mode 100644 index 0000000..c352e94 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_ssl.c @@ -0,0 +1,1777 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#if USE_GNUTLS +# include +# include +# include +#elif USE_OPENSSL +# include +# include +# include +#endif + +#ifdef HAVE_WS2TCPIP_H +# include +#endif + +#include "Ecore.h" +#include "ecore_con_private.h" + +EAPI int ECORE_CON_EVENT_CLIENT_UPGRADE = 0; +EAPI int ECORE_CON_EVENT_SERVER_UPGRADE = 0; + +static int _init_con_ssl_init_count = 0; + +#ifdef USE_GNUTLS +# ifdef EINA_HAVE_THREADS +GCRY_THREAD_OPTION_PTHREAD_IMPL; +# endif + +static int _client_connected = 0; + +# define SSL_SUFFIX(ssl_func) ssl_func ## _gnutls +# define _ECORE_CON_SSL_AVAILABLE 1 + +#elif USE_OPENSSL + +# define SSL_SUFFIX(ssl_func) ssl_func ## _openssl +# define _ECORE_CON_SSL_AVAILABLE 2 + +#else +# define SSL_SUFFIX(ssl_func) ssl_func ## _none +# define _ECORE_CON_SSL_AVAILABLE 0 + +#endif + +#if USE_GNUTLS +static void +_gnutls_print_errors(void *conn, int type, int ret) +{ + char buf[1024]; + + if (!ret) return; + + snprintf(buf, sizeof(buf), "GNUTLS error: %s - %s", gnutls_strerror_name(ret), gnutls_strerror(ret)); + if (type == ECORE_CON_EVENT_CLIENT_ERROR) + ecore_con_event_client_error(conn, buf); + else + ecore_con_event_server_error(conn, buf); +} + +#ifdef ISCOMFITOR +static void +_gnutls_log_func(int level, + const char *str) +{ + DBG("|<%d>| %s", level, str); +} +#endif + +static const char * +SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_description_t status) +{ + switch (status) + { + case GNUTLS_HANDSHAKE_HELLO_REQUEST: + return "Hello request"; + + case GNUTLS_HANDSHAKE_CLIENT_HELLO: + return "Client hello"; + + case GNUTLS_HANDSHAKE_SERVER_HELLO: + return "Server hello"; + + case GNUTLS_HANDSHAKE_NEW_SESSION_TICKET: + return "New session ticket"; + + case GNUTLS_HANDSHAKE_CERTIFICATE_PKT: + return "Certificate packet"; + + case GNUTLS_HANDSHAKE_SERVER_KEY_EXCHANGE: + return "Server key exchange"; + + case GNUTLS_HANDSHAKE_CERTIFICATE_REQUEST: + return "Certificate request"; + + case GNUTLS_HANDSHAKE_SERVER_HELLO_DONE: + return "Server hello done"; + + case GNUTLS_HANDSHAKE_CERTIFICATE_VERIFY: + return "Certificate verify"; + + case GNUTLS_HANDSHAKE_CLIENT_KEY_EXCHANGE: + return "Client key exchange"; + + case GNUTLS_HANDSHAKE_FINISHED: + return "Finished"; + + case GNUTLS_HANDSHAKE_SUPPLEMENTAL: + return "Supplemental"; + } + return NULL; +} + +#elif USE_OPENSSL + +static void +_openssl_print_errors(void *conn, int type) +{ + char buf[1024]; + do + { + unsigned long err; + + err = ERR_get_error(); + if (!err) break; + snprintf(buf, sizeof(buf), "OpenSSL error: %s", ERR_reason_error_string(err)); + if (type == ECORE_CON_EVENT_CLIENT_ERROR) + ecore_con_event_client_error(conn, buf); + else + ecore_con_event_server_error(conn, buf); + + } while (1); +} + +static Eina_Bool +_openssl_name_verify(const char *name, const char *svrname) +{ + if (name[0] == '*') + { + /* we allow *.domain.TLD with a wildcard, but nothing else */ + const char *p, *s; + + EINA_SAFETY_ON_TRUE_RETURN_VAL((name[1] != '.') || (!name[2]), EINA_FALSE); + p = strchr(name + 1, '*'); + EINA_SAFETY_ON_TRUE_RETURN_VAL(!!p, EINA_FALSE); + /* verify that we have a domain of at least *.X.TLD and not *.TLD */ + p = strchr(name + 2, '.'); + EINA_SAFETY_ON_TRUE_RETURN_VAL(!p, EINA_FALSE); + s = strchr(svrname, '.'); + EINA_SAFETY_ON_TRUE_RETURN_VAL(!s, EINA_FALSE); + /* same as above for the stored name */ + EINA_SAFETY_ON_TRUE_RETURN_VAL(!strchr(s + 1, '.'), EINA_FALSE); + EINA_SAFETY_ON_TRUE_RETURN_VAL(strcasecmp(s, name + 1), EINA_FALSE); + } + else + EINA_SAFETY_ON_TRUE_RETURN_VAL(strcasecmp(name, svrname), EINA_FALSE); + return EINA_TRUE; +} + +#endif + +#define SSL_ERROR_CHECK_GOTO_ERROR(X) \ + do \ + { \ + if ((X)) \ + { \ + ERR("Error at %s:%s:%d!", __FILE__, __PRETTY_FUNCTION__, __LINE__); \ + goto error; \ + } \ + } \ + while (0) + +static Ecore_Con_Ssl_Error + SSL_SUFFIX(_ecore_con_ssl_init) (void); +static Ecore_Con_Ssl_Error + SSL_SUFFIX(_ecore_con_ssl_shutdown) (void); + +static Eina_Bool SSL_SUFFIX(_ecore_con_ssl_server_cafile_add) (Ecore_Con_Server * svr, const char *ca_file); +static Eina_Bool SSL_SUFFIX(_ecore_con_ssl_server_crl_add) (Ecore_Con_Server * svr, const char *crl_file); +static Eina_Bool SSL_SUFFIX(_ecore_con_ssl_server_cert_add) (Ecore_Con_Server * svr, const char *cert); +static Eina_Bool SSL_SUFFIX(_ecore_con_ssl_server_privkey_add) (Ecore_Con_Server * svr, const char *key_file); + +static Ecore_Con_Ssl_Error SSL_SUFFIX(_ecore_con_ssl_server_prepare) (Ecore_Con_Server * svr, int ssl_type); +static Ecore_Con_Ssl_Error SSL_SUFFIX(_ecore_con_ssl_server_init) (Ecore_Con_Server * svr); +static Ecore_Con_Ssl_Error SSL_SUFFIX(_ecore_con_ssl_server_shutdown) (Ecore_Con_Server *svr); +static int SSL_SUFFIX(_ecore_con_ssl_server_read) (Ecore_Con_Server *svr, unsigned char *buf, int size); +static int SSL_SUFFIX(_ecore_con_ssl_server_write) (Ecore_Con_Server *svr, const unsigned char *buf, int size); + +static Ecore_Con_Ssl_Error SSL_SUFFIX(_ecore_con_ssl_client_init) (Ecore_Con_Client * cl); +static Ecore_Con_Ssl_Error SSL_SUFFIX(_ecore_con_ssl_client_shutdown) (Ecore_Con_Client *cl); +static int SSL_SUFFIX(_ecore_con_ssl_client_read) (Ecore_Con_Client * cl, + unsigned char *buf, int size); +static int SSL_SUFFIX(_ecore_con_ssl_client_write) (Ecore_Con_Client * cl, + const unsigned char *buf, int size); + +/* + * General SSL API + */ + +Ecore_Con_Ssl_Error +ecore_con_ssl_init(void) +{ + if (!_init_con_ssl_init_count++) + { + SSL_SUFFIX(_ecore_con_ssl_init) (); +#if _ECORE_CON_SSL_AVAILABLE != 0 + ECORE_CON_EVENT_CLIENT_UPGRADE = ecore_event_type_new(); + ECORE_CON_EVENT_SERVER_UPGRADE = ecore_event_type_new(); +#endif + } + + return _init_con_ssl_init_count; +} + +Ecore_Con_Ssl_Error +ecore_con_ssl_shutdown(void) +{ + if (!--_init_con_ssl_init_count) + SSL_SUFFIX(_ecore_con_ssl_shutdown) (); + + return _init_con_ssl_init_count; +} + +Ecore_Con_Ssl_Error +ecore_con_ssl_server_prepare(Ecore_Con_Server *svr, + int ssl_type) +{ + if (!ssl_type) + return ECORE_CON_SSL_ERROR_NONE; + return SSL_SUFFIX(_ecore_con_ssl_server_prepare) (svr, ssl_type); +} + +Ecore_Con_Ssl_Error +ecore_con_ssl_server_init(Ecore_Con_Server *svr) +{ + if (!(svr->type & ECORE_CON_SSL)) + return ECORE_CON_SSL_ERROR_NONE; + return SSL_SUFFIX(_ecore_con_ssl_server_init) (svr); +} + +Ecore_Con_Ssl_Error +ecore_con_ssl_server_shutdown(Ecore_Con_Server *svr) +{ + if (!(svr->type & ECORE_CON_SSL)) + return ECORE_CON_SSL_ERROR_NONE; + return SSL_SUFFIX(_ecore_con_ssl_server_shutdown) (svr); +} + +int +ecore_con_ssl_server_read(Ecore_Con_Server *svr, + unsigned char *buf, + int size) +{ + return SSL_SUFFIX(_ecore_con_ssl_server_read) (svr, buf, size); +} + +int +ecore_con_ssl_server_write(Ecore_Con_Server *svr, + const unsigned char *buf, + int size) +{ + return SSL_SUFFIX(_ecore_con_ssl_server_write) (svr, buf, size); +} + +Ecore_Con_Ssl_Error +ecore_con_ssl_client_init(Ecore_Con_Client *cl) +{ + if (!(cl->host_server->type & ECORE_CON_SSL)) + return ECORE_CON_SSL_ERROR_NONE; + return SSL_SUFFIX(_ecore_con_ssl_client_init) (cl); +} + +Ecore_Con_Ssl_Error +ecore_con_ssl_client_shutdown(Ecore_Con_Client *cl) +{ + if (!(cl->host_server->type & ECORE_CON_SSL)) + return ECORE_CON_SSL_ERROR_NONE; + return SSL_SUFFIX(_ecore_con_ssl_client_shutdown) (cl); +} + +int +ecore_con_ssl_client_read(Ecore_Con_Client *cl, + unsigned char *buf, + int size) +{ + return SSL_SUFFIX(_ecore_con_ssl_client_read) (cl, buf, size); +} + +int +ecore_con_ssl_client_write(Ecore_Con_Client *cl, + const unsigned char *buf, + int size) +{ + return SSL_SUFFIX(_ecore_con_ssl_client_write) (cl, buf, size); +} + +/** + * Returns if SSL support is available + * @return 1 if SSL is available and provided by gnutls, 2 if provided by openssl, + * 0 if it is not available. + * @ingroup Ecore_Con_Client_Group + */ +EAPI int +ecore_con_ssl_available_get(void) +{ + return _ECORE_CON_SSL_AVAILABLE; +} + +/** + * @addtogroup Ecore_Con_SSL_Group Ecore Connection SSL Functions + * + * Functions that operate on Ecore connection objects pertaining to SSL. + * + * @{ + */ + +/** + * @brief Enable certificate verification on a server object + * + * Call this function on a server object before main loop has started + * to enable verification of certificates against loaded certificates. + * @param svr The server object + */ +EAPI void +ecore_con_ssl_server_verify(Ecore_Con_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_ssl_server_verify"); + return; + } + svr->verify = EINA_TRUE; +} + +/** + * @brief Enable hostname-based certificate verification on a server object + * + * Call this function on a server object before main loop has started + * to enable verification of certificates using ONLY their hostnames. + * @param svr The server object + * @note This function has no effect when used on a listening server created by + * ecore_con_server_add + * @since 1.1 + */ +EAPI void +ecore_con_ssl_server_verify_basic(Ecore_Con_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, __func__); + return; + } + svr->verify_basic = EINA_TRUE; +} + +/** + * @brief Add an ssl certificate for use in ecore_con functions. + * + * Use this function to add a SSL PEM certificate. + * Simply specify the cert here to use it in the server object for connecting or listening. + * If there is an error loading the certificate, an error will automatically be logged. + * @param cert The path to the certificate. + * @return EINA_FALSE if the file cannot be loaded, otherwise EINA_TRUE. + */ + +EAPI Eina_Bool +ecore_con_ssl_server_cert_add(Ecore_Con_Server *svr, + const char *cert) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_ssl_server_cert_add"); + return EINA_FALSE; + } + + return SSL_SUFFIX(_ecore_con_ssl_server_cert_add) (svr, cert); +} + +/** + * @brief Add an ssl CA file for use in ecore_con functions. + * + * Use this function to add a SSL PEM CA file. + * Simply specify the file here to use it in the server object for connecting or listening. + * If there is an error loading the CAs, an error will automatically be logged. + * @param ca_file The path to the CA file. + * @return EINA_FALSE if the file cannot be loaded, otherwise EINA_TRUE. + */ + +EAPI Eina_Bool +ecore_con_ssl_server_cafile_add(Ecore_Con_Server *svr, + const char *ca_file) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_ssl_server_cafile_add"); + return EINA_FALSE; + } + + return SSL_SUFFIX(_ecore_con_ssl_server_cafile_add) (svr, ca_file); +} + +/** + * @brief Add an ssl private key for use in ecore_con functions. + * + * Use this function to add a SSL PEM private key + * Simply specify the key file here to use it in the server object for connecting or listening. + * If there is an error loading the key, an error will automatically be logged. + * @param key_file The path to the key file. + * @return EINA_FALSE if the file cannot be loaded, + * otherwise EINA_TRUE. + */ + +EAPI Eina_Bool +ecore_con_ssl_server_privkey_add(Ecore_Con_Server *svr, + const char *key_file) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_ssl_server_privkey_add"); + return EINA_FALSE; + } + + return SSL_SUFFIX(_ecore_con_ssl_server_privkey_add) (svr, key_file); +} + +/** + * @brief Add an ssl CRL for use in ecore_con functions. + * + * Use this function to add a SSL PEM CRL file + * Simply specify the CRL file here to use it in the server object for connecting or listening. + * If there is an error loading the CRL, an error will automatically be logged. + * @param crl_file The path to the CRL file. + * @return EINA_FALSE if the file cannot be loaded, + * otherwise EINA_TRUE. + */ + +EAPI Eina_Bool +ecore_con_ssl_server_crl_add(Ecore_Con_Server *svr, + const char *crl_file) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, "ecore_con_ssl_server_crl_add"); + return EINA_FALSE; + } + + return SSL_SUFFIX(_ecore_con_ssl_server_crl_add) (svr, crl_file); +} + +/** + * @brief Upgrade a connection to a specified level of encryption + * + * Use this function to begin an SSL handshake on a connection (STARTTLS or similar). + * Once the upgrade has been completed, an ECORE_CON_EVENT_SERVER_UPGRADE event will be emitted. + * The connection should be treated as disconnected until the next event. + * @param svr The server object + * @param ssl_type The SSL connection type (ONLY). + * @return EINA_FALSE if the connection cannot be upgraded, otherwise EINA_TRUE. + * @note This function is NEVER to be used on a server object created with ecore_con_server_add + * @warning Setting a wrong value for @p compl_type WILL mess up your program. + * @since 1.1 + */ + +EAPI Eina_Bool +ecore_con_ssl_server_upgrade(Ecore_Con_Server *svr, Ecore_Con_Type ssl_type) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_CON_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_CON_SERVER, __func__); + return EINA_FALSE; + } +#if _ECORE_CON_SSL_AVAILABLE == 0 + return EINA_FALSE; +#endif + + if (!svr->ssl_prepared) + { + if (ecore_con_ssl_server_prepare(svr, ssl_type)) + return EINA_FALSE; + } + svr->type |= ssl_type; + svr->upgrade = EINA_TRUE; + svr->handshaking = EINA_TRUE; + svr->ssl_state = ECORE_CON_SSL_STATE_INIT; + return !SSL_SUFFIX(_ecore_con_ssl_server_init) (svr); +} + +/** + * @brief Upgrade a connection to a specified level of encryption + * + * Use this function to begin an SSL handshake on a connection (STARTTLS or similar). + * Once the upgrade has been completed, an ECORE_CON_EVENT_CLIENT_UPGRADE event will be emitted. + * The connection should be treated as disconnected until the next event. + * @param cl The client object + * @param compl_type The SSL connection type (ONLY). + * @return EINA_FALSE if the connection cannot be upgraded, otherwise EINA_TRUE. + * @warning Setting a wrong value for @p compl_type WILL mess up your program. + * @since 1.1 + */ + +EAPI Eina_Bool +ecore_con_ssl_client_upgrade(Ecore_Con_Client *cl, Ecore_Con_Type ssl_type) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_CON_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_CON_CLIENT, __func__); + return EINA_FALSE; + } +#if _ECORE_CON_SSL_AVAILABLE == 0 + return EINA_FALSE; +#endif + + if (!cl->host_server->ssl_prepared) + { + if (ecore_con_ssl_server_prepare(cl->host_server, ssl_type)) + return EINA_FALSE; + } + cl->host_server->type |= ssl_type; + cl->upgrade = EINA_TRUE; + cl->host_server->upgrade = EINA_TRUE; + cl->handshaking = EINA_TRUE; + cl->ssl_state = ECORE_CON_SSL_STATE_INIT; + return SSL_SUFFIX(_ecore_con_ssl_client_init) (cl); +} + +/** + * @} + */ + +#if USE_GNUTLS + +/* + * GnuTLS + */ + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_init_gnutls(void) +{ +#ifdef EINA_HAVE_THREADS + if (gcry_control(GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread)) + WRN("YOU ARE USING PTHREADS, BUT I CANNOT INITIALIZE THREADSAFE GCRYPT OPERATIONS!"); +#endif + if (gnutls_global_init()) + return ECORE_CON_SSL_ERROR_INIT_FAILED; + +#ifdef ISCOMFITOR + gnutls_global_set_log_level(9); + gnutls_global_set_log_function(_gnutls_log_func); +#endif + return ECORE_CON_SSL_ERROR_NONE; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_shutdown_gnutls(void) +{ + gnutls_global_deinit(); + + return ECORE_CON_SSL_ERROR_NONE; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_server_prepare_gnutls(Ecore_Con_Server *svr, + int ssl_type) +{ + int ret; + + if (ssl_type & ECORE_CON_USE_SSL2) + return ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED; + + switch (ssl_type) + { + case ECORE_CON_USE_SSL3: + case ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT: + case ECORE_CON_USE_TLS: + case ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT: + case ECORE_CON_USE_MIXED: + case ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT: + break; + + default: + return ECORE_CON_SSL_ERROR_NONE; + } + + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_certificate_allocate_credentials(&svr->cert)); + + if (svr->use_cert) + { + if (svr->created) + { + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_dh_params_init(&svr->dh_params)); + INF("Generating DH params"); + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_dh_params_generate2(svr->dh_params, 1024)); + + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_anon_allocate_server_credentials(&svr->anoncred_s)); + /* TODO: implement PSK */ + // SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_psk_allocate_server_credentials(&svr->pskcred_s)); + + gnutls_anon_set_server_dh_params(svr->anoncred_s, svr->dh_params); + gnutls_certificate_set_dh_params(svr->cert, svr->dh_params); + //gnutls_psk_set_server_dh_params(svr->pskcred_s, svr->dh_params); + INF("DH params successfully generated and applied!"); + } + else + { + //SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_psk_allocate_client_credentials(&svr->pskcred_c)); + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_anon_allocate_client_credentials(&svr->anoncred_c)); + } + } + + svr->ssl_prepared = EINA_TRUE; + return ECORE_CON_SSL_ERROR_NONE; + +error: + _gnutls_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR, ret); + _ecore_con_ssl_server_shutdown_gnutls(svr); + return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED; +} + + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_server_init_gnutls(Ecore_Con_Server *svr) +{ + const gnutls_datum_t *cert_list; + unsigned int iter, cert_list_size; + gnutls_x509_crt_t cert = NULL; + const char *priority = "NONE:%VERIFY_ALLOW_X509_V1_CA_CRT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+COMP-DEFLATE:+COMP-NULL:+CTYPE-X509:+SHA1:+SHA256:+SHA384:+SHA512:+AES-256-CBC:+AES-128-CBC:+3DES-CBC:+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:+VERS-SSL3.0"; + int ret = 0; + + switch (svr->ssl_state) + { + case ECORE_CON_SSL_STATE_DONE: + return ECORE_CON_SSL_ERROR_NONE; + + case ECORE_CON_SSL_STATE_INIT: + if (svr->type & ECORE_CON_USE_SSL2) /* not supported because of security issues */ + return ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED; + + switch (svr->type & ECORE_CON_SSL) + { + case ECORE_CON_USE_SSL3: + case ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT: + priority = "NONE:%VERIFY_ALLOW_X509_V1_CA_CRT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+COMP-DEFLATE:+COMP-NULL:+CTYPE-X509:+SHA1:+SHA256:+SHA384:+SHA512:+AES-256-CBC:+AES-128-CBC:+3DES-CBC:!VERS-TLS1.0:!VERS-TLS1.1"; + break; + + case ECORE_CON_USE_TLS: + case ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT: + priority = "NONE:%VERIFY_ALLOW_X509_V1_CA_CRT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+COMP-DEFLATE:+COMP-NULL:+CTYPE-X509:+SHA1:+SHA256:+SHA384:+SHA512:+AES-256-CBC:+AES-128-CBC:+3DES-CBC:!VERS-SSL3.0"; + break; + + case ECORE_CON_USE_MIXED: + case ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT: + break; + + default: + return ECORE_CON_SSL_ERROR_NONE; + } + + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_init(&svr->session, GNUTLS_CLIENT)); + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_session_ticket_enable_client(svr->session)); + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_server_name_set(svr->session, GNUTLS_NAME_DNS, svr->name, strlen(svr->name))); + INF("Applying priority string: %s", priority); + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_priority_set_direct(svr->session, priority, NULL)); + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_credentials_set(svr->session, GNUTLS_CRD_CERTIFICATE, svr->cert)); + // SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_credentials_set(svr->session, GNUTLS_CRD_PSK, svr->pskcred_c)); + if (!svr->use_cert) + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_credentials_set(svr->session, GNUTLS_CRD_ANON, svr->anoncred_c)); + + gnutls_dh_set_prime_bits(svr->session, 512); + gnutls_transport_set_ptr(svr->session, (gnutls_transport_ptr_t)((intptr_t)svr->fd)); + svr->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING; + + case ECORE_CON_SSL_STATE_HANDSHAKING: + if (!svr->session) + { + DBG("Server was previously lost, going to error condition"); + goto error; + } + ret = gnutls_handshake(svr->session); + DBG("calling gnutls_handshake(): returned with '%s'", gnutls_strerror_name(ret)); + SSL_ERROR_CHECK_GOTO_ERROR(gnutls_error_is_fatal(ret)); + if (!ret) + { + svr->handshaking = EINA_FALSE; + svr->ssl_state = ECORE_CON_SSL_STATE_DONE; + } + else + { + if (gnutls_record_get_direction(svr->session)) + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE); + else + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ); + return ECORE_CON_SSL_ERROR_NONE; + } + + default: + break; + } + + if ((!svr->verify) && (!svr->verify_basic)) + /* not verifying certificates, so we're done! */ + return ECORE_CON_SSL_ERROR_NONE; + if (svr->verify) + { + /* use CRL/CA lists to verify */ + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_certificate_verify_peers2(svr->session, &iter)); + if (iter & GNUTLS_CERT_INVALID) + ERR("The certificate is not trusted."); + else if (iter & GNUTLS_CERT_SIGNER_NOT_FOUND) + ERR("The certificate hasn't got a known issuer."); + else if (iter & GNUTLS_CERT_REVOKED) + ERR("The certificate has been revoked."); + else if (iter & GNUTLS_CERT_EXPIRED) + ERR("The certificate has expired"); + else if (iter & GNUTLS_CERT_NOT_ACTIVATED) + ERR("The certificate is not yet activated"); + + if (iter) + goto error; + } + if (gnutls_certificate_type_get(svr->session) != GNUTLS_CRT_X509) + { + ERR("Warning: PGP certificates are not yet supported!"); + goto error; + } + + SSL_ERROR_CHECK_GOTO_ERROR(!(cert_list = gnutls_certificate_get_peers(svr->session, &cert_list_size))); + SSL_ERROR_CHECK_GOTO_ERROR(!cert_list_size); + + SSL_ERROR_CHECK_GOTO_ERROR(gnutls_x509_crt_init(&cert)); + SSL_ERROR_CHECK_GOTO_ERROR(gnutls_x509_crt_import(cert, &cert_list[0], GNUTLS_X509_FMT_DER)); + + SSL_ERROR_CHECK_GOTO_ERROR(!gnutls_x509_crt_check_hostname(cert, svr->name)); + gnutls_x509_crt_deinit(cert); + DBG("SSL certificate verification succeeded!"); + return ECORE_CON_SSL_ERROR_NONE; + +error: + _gnutls_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR, ret); + if ((ret == GNUTLS_E_WARNING_ALERT_RECEIVED) || (ret == GNUTLS_E_FATAL_ALERT_RECEIVED)) + ERR("Also received alert: %s", gnutls_alert_get_name(gnutls_alert_get(svr->session))); + if (svr->session && (svr->ssl_state != ECORE_CON_SSL_STATE_DONE)) + { + ERR("last out: %s", SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_get_last_out(svr->session))); + ERR("last in: %s", SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_get_last_in(svr->session))); + } + if (cert) + gnutls_x509_crt_deinit(cert); + _ecore_con_ssl_server_shutdown_gnutls(svr); + return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED; +} + +static Eina_Bool +_ecore_con_ssl_server_cafile_add_gnutls(Ecore_Con_Server *svr, + const char *ca_file) +{ + SSL_ERROR_CHECK_GOTO_ERROR(gnutls_certificate_set_x509_trust_file(svr->cert, ca_file, + GNUTLS_X509_FMT_PEM) < 1); + + return EINA_TRUE; +error: + ERR("Could not load CA file!"); + return EINA_FALSE; +} + +static Eina_Bool +_ecore_con_ssl_server_crl_add_gnutls(Ecore_Con_Server *svr, + const char *crl_file) +{ + SSL_ERROR_CHECK_GOTO_ERROR(gnutls_certificate_set_x509_crl_file(svr->cert, crl_file, + GNUTLS_X509_FMT_PEM) < 1); + + return EINA_TRUE; +error: + ERR("Could not load CRL file!"); + return EINA_FALSE; +} + +static Eina_Bool +_ecore_con_ssl_server_privkey_add_gnutls(Ecore_Con_Server *svr, + const char *key_file) +{ + SSL_ERROR_CHECK_GOTO_ERROR(gnutls_certificate_set_x509_key_file(svr->cert, svr->cert_file, key_file, + GNUTLS_X509_FMT_PEM)); + + return EINA_TRUE; +error: + ERR("Could not load certificate/key file!"); + return EINA_FALSE; +} + +static Eina_Bool +_ecore_con_ssl_server_cert_add_gnutls(Ecore_Con_Server *svr, + const char *cert_file) +{ + if (!(svr->cert_file = strdup(cert_file))) + return EINA_FALSE; + + return EINA_TRUE; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_server_shutdown_gnutls(Ecore_Con_Server *svr) +{ + if (svr->session) + { + gnutls_bye(svr->session, GNUTLS_SHUT_RDWR); + gnutls_deinit(svr->session); + } + + free(svr->cert_file); + svr->cert_file = NULL; + if (svr->cert) + gnutls_certificate_free_credentials(svr->cert); + svr->cert = NULL; + + if ((svr->type & ECORE_CON_SSL) && svr->created) + { + if (svr->dh_params) + { + gnutls_dh_params_deinit(svr->dh_params); + svr->dh_params = NULL; + } + if (svr->anoncred_s) + gnutls_anon_free_server_credentials(svr->anoncred_s); + // if (svr->pskcred_s) + // gnutls_psk_free_server_credentials(svr->pskcred_s); + + svr->anoncred_s = NULL; + svr->pskcred_s = NULL; + } + else if (svr->type & ECORE_CON_SSL) + { + if (svr->anoncred_c) + gnutls_anon_free_client_credentials(svr->anoncred_c); + // if (svr->pskcred_c) + // gnutls_psk_free_client_credentials(svr->pskcred_c); + + svr->anoncred_c = NULL; + svr->pskcred_c = NULL; + } + + svr->session = NULL; + + return ECORE_CON_SSL_ERROR_NONE; +} + +static int +_ecore_con_ssl_server_read_gnutls(Ecore_Con_Server *svr, + unsigned char *buf, + int size) +{ + int num; + + if (svr->ssl_state == ECORE_CON_SSL_STATE_HANDSHAKING) + { + DBG("Continuing gnutls handshake"); + if (!_ecore_con_ssl_server_init_gnutls(svr)) + return 0; + return -1; + } + + num = gnutls_record_recv(svr->session, buf, size); + if (num > 0) + return num; + + if (num == GNUTLS_E_REHANDSHAKE) + { + WRN("Rehandshake request ignored"); + return 0; + + svr->handshaking = EINA_TRUE; + svr->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING; + if (!_ecore_con_ssl_server_init_gnutls(svr)) + return 0; + } + else if ((!gnutls_error_is_fatal(num)) && (num != GNUTLS_E_SUCCESS)) + return 0; + + return -1; +} + +static int +_ecore_con_ssl_server_write_gnutls(Ecore_Con_Server *svr, + const unsigned char *buf, + int size) +{ + int num; + + if (svr->ssl_state == ECORE_CON_SSL_STATE_HANDSHAKING) + { + DBG("Continuing gnutls handshake"); + if (!_ecore_con_ssl_server_init_gnutls(svr)) + return 0; + return -1; + } + + num = gnutls_record_send(svr->session, buf, size); + if (num > 0) + return num; + + if (num == GNUTLS_E_REHANDSHAKE) + { + WRN("Rehandshake request ignored"); + return 0; +/* this is only partly functional I think? */ + svr->handshaking = EINA_TRUE; + svr->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING; + if (!_ecore_con_ssl_server_init_gnutls(svr)) + return 0; + } + else if (!gnutls_error_is_fatal(num)) + return 0; + + return -1; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_client_init_gnutls(Ecore_Con_Client *cl) +{ + const gnutls_datum_t *cert_list; + unsigned int iter, cert_list_size; + const char *priority = "NONE:%VERIFY_ALLOW_X509_V1_CA_CRT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+COMP-DEFLATE:+COMP-NULL:+CTYPE-X509:+SHA1:+SHA256:+SHA384:+SHA512:+AES-256-CBC:+AES-128-CBC:+3DES-CBC:+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:+VERS-SSL3.0"; + int ret = 0; + + switch (cl->ssl_state) + { + case ECORE_CON_SSL_STATE_DONE: + return ECORE_CON_SSL_ERROR_NONE; + + case ECORE_CON_SSL_STATE_INIT: + if (cl->host_server->type & ECORE_CON_USE_SSL2) /* not supported because of security issues */ + return ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED; + + switch (cl->host_server->type & ECORE_CON_SSL) + { + case ECORE_CON_USE_SSL3: + case ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT: + priority = "NONE:%VERIFY_ALLOW_X509_V1_CA_CRT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+COMP-DEFLATE:+COMP-NULL:+CTYPE-X509:+SHA1:+SHA256:+SHA384:+SHA512:+AES-256-CBC:+AES-128-CBC:+3DES-CBC:!VERS-TLS1.0:!VERS-TLS1.1"; + break; + + case ECORE_CON_USE_TLS: + case ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT: + priority = "NONE:%VERIFY_ALLOW_X509_V1_CA_CRT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+COMP-DEFLATE:+COMP-NULL:+CTYPE-X509:+SHA1:+SHA256:+SHA384:+SHA512:+AES-256-CBC:+AES-128-CBC:+3DES-CBC:!VERS-SSL3.0"; + break; + + case ECORE_CON_USE_MIXED: + case ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT: + break; + + default: + return ECORE_CON_SSL_ERROR_NONE; + } + + _client_connected++; + + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_init(&cl->session, GNUTLS_SERVER)); + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_session_ticket_key_generate(&cl->session_ticket)); + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_session_ticket_enable_server(cl->session, &cl->session_ticket)); + INF("Applying priority string: %s", priority); + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_priority_set_direct(cl->session, priority, NULL)); + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_credentials_set(cl->session, GNUTLS_CRD_CERTIFICATE, cl->host_server->cert)); + // SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_credentials_set(cl->session, GNUTLS_CRD_PSK, cl->host_server->pskcred_s)); + if (!cl->host_server->use_cert) + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_credentials_set(cl->session, GNUTLS_CRD_ANON, cl->host_server->anoncred_s)); + + gnutls_certificate_server_set_request(cl->session, GNUTLS_CERT_REQUEST); + + gnutls_dh_set_prime_bits(cl->session, 2048); + gnutls_transport_set_ptr(cl->session, (gnutls_transport_ptr_t)((intptr_t)cl->fd)); + cl->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING; + + case ECORE_CON_SSL_STATE_HANDSHAKING: + if (!cl->session) + { + DBG("Client was previously lost, going to error condition"); + goto error; + } + DBG("calling gnutls_handshake()"); + ret = gnutls_handshake(cl->session); + SSL_ERROR_CHECK_GOTO_ERROR(gnutls_error_is_fatal(ret)); + + if (!ret) + { + cl->handshaking = EINA_FALSE; + cl->ssl_state = ECORE_CON_SSL_STATE_DONE; + } + else + { + if (gnutls_record_get_direction(cl->session)) + ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE); + else + ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ); + return ECORE_CON_SSL_ERROR_NONE; + } + + default: + break; + } + + if (!cl->host_server->verify) + /* not verifying certificates, so we're done! */ + return ECORE_CON_SSL_ERROR_NONE; + /* use CRL/CA lists to verify */ + SSL_ERROR_CHECK_GOTO_ERROR(ret = gnutls_certificate_verify_peers2(cl->session, &iter)); + if (iter & GNUTLS_CERT_INVALID) + ERR("The certificate is not trusted."); + else if (iter & GNUTLS_CERT_SIGNER_NOT_FOUND) + ERR("The certificate hasn't got a known issuer."); + else if (iter & GNUTLS_CERT_REVOKED) + ERR("The certificate has been revoked."); + else if (iter & GNUTLS_CERT_EXPIRED) + ERR("The certificate has expired"); + else if (iter & GNUTLS_CERT_NOT_ACTIVATED) + ERR("The certificate is not yet activated"); + + if (iter) + goto error; + if (gnutls_certificate_type_get(cl->session) != GNUTLS_CRT_X509) + { + ERR("Warning: PGP certificates are not yet supported!"); + goto error; + } + + SSL_ERROR_CHECK_GOTO_ERROR(!(cert_list = gnutls_certificate_get_peers(cl->session, &cert_list_size))); + SSL_ERROR_CHECK_GOTO_ERROR(!cert_list_size); + +/* + gnutls_x509_crt_t cert = NULL; + SSL_ERROR_CHECK_GOTO_ERROR(gnutls_x509_crt_init(&cert)); + SSL_ERROR_CHECK_GOTO_ERROR(gnutls_x509_crt_import(cert, &cert_list[0], GNUTLS_X509_FMT_DER)); + + SSL_ERROR_CHECK_GOTO_ERROR(!gnutls_x509_crt_check_hostname(cert, cl->host_server->name)); + gnutls_x509_crt_deinit(cert); +*/ + DBG("SSL certificate verification succeeded!"); + return ECORE_CON_SSL_ERROR_NONE; + +error: + _gnutls_print_errors(cl, ECORE_CON_EVENT_CLIENT_ERROR, ret); + if ((ret == GNUTLS_E_WARNING_ALERT_RECEIVED) || (ret == GNUTLS_E_FATAL_ALERT_RECEIVED)) + ERR("Also received alert: %s", gnutls_alert_get_name(gnutls_alert_get(cl->session))); + if (cl->session && (cl->ssl_state != ECORE_CON_SSL_STATE_DONE)) + { + ERR("last out: %s", SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_get_last_out(cl->session))); + ERR("last in: %s", SSL_GNUTLS_PRINT_HANDSHAKE_STATUS(gnutls_handshake_get_last_in(cl->session))); + } +/* + if (cert) + gnutls_x509_crt_deinit(cert); +*/ + _ecore_con_ssl_client_shutdown_gnutls(cl); + return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_client_shutdown_gnutls(Ecore_Con_Client *cl) +{ + if (cl->session) + { + gnutls_bye(cl->session, GNUTLS_SHUT_RDWR); + gnutls_deinit(cl->session); + gnutls_free(cl->session_ticket.data); + cl->session_ticket.data = NULL; + } + + cl->session = NULL; + + return ECORE_CON_SSL_ERROR_NONE; +} + +static int +_ecore_con_ssl_client_read_gnutls(Ecore_Con_Client *cl, + unsigned char *buf, + int size) +{ + int num; + + if (cl->ssl_state == ECORE_CON_SSL_STATE_HANDSHAKING) + { + if (!_ecore_con_ssl_client_init_gnutls(cl)) + return 0; + return -1; + } + + num = gnutls_record_recv(cl->session, buf, size); + if (num > 0) + return num; + + if (num == GNUTLS_E_REHANDSHAKE) + { + WRN("Rehandshake request ignored"); + return 0; + cl->handshaking = EINA_TRUE; + cl->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING; + if (!_ecore_con_ssl_client_init_gnutls(cl)) + return 0; + WRN("Rehandshake request ignored"); + return 0; + } + else if ((!gnutls_error_is_fatal(num)) && (num != GNUTLS_E_SUCCESS)) + return 0; + + return -1; +} + +static int +_ecore_con_ssl_client_write_gnutls(Ecore_Con_Client *cl, + const unsigned char *buf, + int size) +{ + int num; + + if (cl->ssl_state == ECORE_CON_SSL_STATE_HANDSHAKING) + { + if (!_ecore_con_ssl_client_init_gnutls(cl)) + return 0; + return -1; + } + + num = gnutls_record_send(cl->session, buf, size); + if (num > 0) + return num; + + if (num == GNUTLS_E_REHANDSHAKE) + { + WRN("Rehandshake request ignored"); + return 0; + cl->handshaking = EINA_TRUE; + cl->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING; + if (!_ecore_con_ssl_client_init_gnutls(cl)) + return 0; + } + else if (!gnutls_error_is_fatal(num)) + return 0; + + return -1; +} + +#elif USE_OPENSSL && !USE_GNUTLS + +/* + * OpenSSL + */ + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_init_openssl(void) +{ + SSL_library_init(); + SSL_load_error_strings(); + OpenSSL_add_all_algorithms(); + + return ECORE_CON_SSL_ERROR_NONE; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_shutdown_openssl(void) +{ + ERR_free_strings(); + EVP_cleanup(); + return ECORE_CON_SSL_ERROR_NONE; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_server_prepare_openssl(Ecore_Con_Server *svr, + int ssl_type) +{ + long options; + int dh = 0; + + if (ssl_type & ECORE_CON_USE_SSL2) + return ECORE_CON_SSL_ERROR_SSL2_NOT_SUPPORTED; + + switch (ssl_type) + { + case ECORE_CON_USE_SSL3: + case ECORE_CON_USE_SSL3 | ECORE_CON_LOAD_CERT: + if (!svr->created) + SSL_ERROR_CHECK_GOTO_ERROR(!(svr->ssl_ctx = SSL_CTX_new(SSLv3_client_method()))); + else + SSL_ERROR_CHECK_GOTO_ERROR(!(svr->ssl_ctx = SSL_CTX_new(SSLv3_server_method()))); + break; + + case ECORE_CON_USE_TLS: + case ECORE_CON_USE_TLS | ECORE_CON_LOAD_CERT: + if (!svr->created) + SSL_ERROR_CHECK_GOTO_ERROR(!(svr->ssl_ctx = SSL_CTX_new(TLSv1_client_method()))); + else + SSL_ERROR_CHECK_GOTO_ERROR(!(svr->ssl_ctx = SSL_CTX_new(TLSv1_server_method()))); + break; + + case ECORE_CON_USE_MIXED: + case ECORE_CON_USE_MIXED | ECORE_CON_LOAD_CERT: + if (!svr->created) + SSL_ERROR_CHECK_GOTO_ERROR(!(svr->ssl_ctx = SSL_CTX_new(SSLv23_client_method()))); + else + SSL_ERROR_CHECK_GOTO_ERROR(!(svr->ssl_ctx = SSL_CTX_new(SSLv23_server_method()))); + options = SSL_CTX_get_options(svr->ssl_ctx); + SSL_CTX_set_options(svr->ssl_ctx, options | SSL_OP_NO_SSLv2 | SSL_OP_SINGLE_DH_USE); + break; + + default: + return ECORE_CON_SSL_ERROR_NONE; + } + + if ((!svr->use_cert) && svr->created) + { + DH *dh_params; + INF("Generating DH params"); + SSL_ERROR_CHECK_GOTO_ERROR(!(dh_params = DH_new())); + SSL_ERROR_CHECK_GOTO_ERROR(!DH_generate_parameters_ex(dh_params, 1024, DH_GENERATOR_5, NULL)); + SSL_ERROR_CHECK_GOTO_ERROR(!DH_check(dh_params, &dh)); + SSL_ERROR_CHECK_GOTO_ERROR((dh & DH_CHECK_P_NOT_PRIME) || (dh & DH_CHECK_P_NOT_SAFE_PRIME)); + SSL_ERROR_CHECK_GOTO_ERROR(!DH_generate_key(dh_params)); + SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_set_tmp_dh(svr->ssl_ctx, dh_params)); + DH_free(dh_params); + INF("DH params successfully generated and applied!"); + SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_set_cipher_list(svr->ssl_ctx, "aNULL:!eNULL:!LOW:!EXPORT:@STRENGTH")); + } + else if (!svr->use_cert) + SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_set_cipher_list(svr->ssl_ctx, "aNULL:!eNULL:!LOW:!EXPORT:!ECDH:RSA:AES:!PSK:@STRENGTH")); + + return ECORE_CON_SSL_ERROR_NONE; + +error: + if (dh) + { + if (dh & DH_CHECK_P_NOT_PRIME) + ERR("openssl error: dh_params could not generate a prime!"); + else + ERR("openssl error: dh_params could not generate a safe prime!"); + } + else + _openssl_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR); + _ecore_con_ssl_server_shutdown_openssl(svr); + return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_server_init_openssl(Ecore_Con_Server *svr) +{ + int ret = -1; + + switch (svr->ssl_state) + { + case ECORE_CON_SSL_STATE_DONE: + return ECORE_CON_SSL_ERROR_NONE; + + case ECORE_CON_SSL_STATE_INIT: + SSL_ERROR_CHECK_GOTO_ERROR(!(svr->ssl = SSL_new(svr->ssl_ctx))); + + SSL_ERROR_CHECK_GOTO_ERROR(!SSL_set_fd(svr->ssl, svr->fd)); + SSL_set_connect_state(svr->ssl); + svr->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING; + + case ECORE_CON_SSL_STATE_HANDSHAKING: + if (!svr->ssl) + { + DBG("Server was previously lost, going to error condition"); + goto error; + } + ret = SSL_do_handshake(svr->ssl); + svr->ssl_err = SSL_get_error(svr->ssl, ret); + SSL_ERROR_CHECK_GOTO_ERROR((svr->ssl_err == SSL_ERROR_SYSCALL) || (svr->ssl_err == SSL_ERROR_SSL)); + + if (ret == 1) + { + svr->handshaking = EINA_FALSE; + svr->ssl_state = ECORE_CON_SSL_STATE_DONE; + } + else + { + if (svr->ssl_err == SSL_ERROR_WANT_READ) + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ); + else if (svr->ssl_err == SSL_ERROR_WANT_WRITE) + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE); + return ECORE_CON_SSL_ERROR_NONE; + } + + default: + break; + } + +#ifdef ISCOMFITOR + { + /* print session info into DBG */ + SSL_SESSION *s; + BIO *b; + char log[4096]; + + memset(log, 0, sizeof(log)); + s = SSL_get_session(svr->ssl); + b = BIO_new(BIO_s_mem()); + SSL_SESSION_print(b, s); + while (BIO_read(b, log, sizeof(log)) > 0) + DBG("%s", log); + + BIO_free(b); + } +#endif + if ((!svr->verify) && (!svr->verify_basic)) + /* not verifying certificates, so we're done! */ + return ECORE_CON_SSL_ERROR_NONE; + + { + X509 *cert; + SSL_set_verify(svr->ssl, SSL_VERIFY_PEER, NULL); + /* use CRL/CA lists to verify */ + cert = SSL_get_peer_certificate(svr->ssl); + if (cert) + { + char buf[256] = {0}; + if (svr->verify) + SSL_ERROR_CHECK_GOTO_ERROR(SSL_get_verify_result(svr->ssl)); + X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_subject_alt_name, buf, sizeof(buf)); + if (buf[0]) + SSL_ERROR_CHECK_GOTO_ERROR(!_openssl_name_verify(buf, svr->name)); + else + { + X509_NAME_get_text_by_NID(X509_get_subject_name(cert), NID_commonName, buf, sizeof(buf)); + SSL_ERROR_CHECK_GOTO_ERROR(!_openssl_name_verify(buf, svr->name)); + } + } + } + + DBG("SSL certificate verification succeeded!"); + + return ECORE_CON_SSL_ERROR_NONE; + +error: + _openssl_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR); + _ecore_con_ssl_server_shutdown_openssl(svr); + return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED; +} + +static Eina_Bool +_ecore_con_ssl_server_cafile_add_openssl(Ecore_Con_Server *svr, + const char *ca_file) +{ + SSL_ERROR_CHECK_GOTO_ERROR(!SSL_CTX_load_verify_locations(svr->ssl_ctx, ca_file, NULL)); + return EINA_TRUE; + +error: + _openssl_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR); + return EINA_FALSE; +} + +static Eina_Bool +_ecore_con_ssl_server_crl_add_openssl(Ecore_Con_Server *svr, + const char *crl_file) +{ + X509_STORE *st; + X509_LOOKUP *lu; + static Eina_Bool flag = EINA_FALSE; + + SSL_ERROR_CHECK_GOTO_ERROR(!(st = SSL_CTX_get_cert_store(svr->ssl_ctx))); + SSL_ERROR_CHECK_GOTO_ERROR(!(lu = X509_STORE_add_lookup(st, X509_LOOKUP_file()))); + SSL_ERROR_CHECK_GOTO_ERROR(X509_load_crl_file(lu, crl_file, X509_FILETYPE_PEM) < 1); + if (!flag) + { + X509_STORE_set_flags(st, X509_V_FLAG_CRL_CHECK | X509_V_FLAG_CRL_CHECK_ALL); + flag = EINA_TRUE; + } + + return EINA_TRUE; + +error: + _openssl_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR); + return EINA_FALSE; +} + +static Eina_Bool +_ecore_con_ssl_server_privkey_add_openssl(Ecore_Con_Server *svr, + const char *key_file) +{ + FILE *fp = NULL; + EVP_PKEY *privkey = NULL; + + if (!(fp = fopen(key_file, "r"))) + goto error; + + SSL_ERROR_CHECK_GOTO_ERROR(!(privkey = PEM_read_PrivateKey(fp, NULL, NULL, NULL))); + + fclose(fp); + SSL_ERROR_CHECK_GOTO_ERROR(SSL_CTX_use_PrivateKey(svr->ssl_ctx, privkey) < 1); + SSL_ERROR_CHECK_GOTO_ERROR(SSL_CTX_check_private_key(svr->ssl_ctx) < 1); + + return EINA_TRUE; + +error: + if (fp) + fclose(fp); + _openssl_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR); + return EINA_FALSE; +} + +static Eina_Bool +_ecore_con_ssl_server_cert_add_openssl(Ecore_Con_Server *svr, + const char *cert_file) +{ + FILE *fp = NULL; + X509 *cert = NULL; + + if (!(fp = fopen(cert_file, "r"))) + goto error; + + SSL_ERROR_CHECK_GOTO_ERROR(!(cert = PEM_read_X509(fp, NULL, NULL, NULL))); + + fclose(fp); + + SSL_ERROR_CHECK_GOTO_ERROR(SSL_CTX_use_certificate(svr->ssl_ctx, cert) < 1); + + return EINA_TRUE; + +error: + if (fp) + fclose(fp); + _openssl_print_errors(svr, ECORE_CON_EVENT_SERVER_ERROR); + return EINA_FALSE; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_server_shutdown_openssl(Ecore_Con_Server *svr) +{ + if (svr->ssl) + { + if (!SSL_shutdown(svr->ssl)) + SSL_shutdown(svr->ssl); + + SSL_free(svr->ssl); + } + + if (svr->ssl_ctx) + SSL_CTX_free(svr->ssl_ctx); + + svr->ssl = NULL; + svr->ssl_ctx = NULL; + svr->ssl_err = SSL_ERROR_NONE; + + return ECORE_CON_SSL_ERROR_NONE; +} + +static int +_ecore_con_ssl_server_read_openssl(Ecore_Con_Server *svr, + unsigned char *buf, + int size) +{ + int num; + + if (!svr->ssl) return -1; + num = SSL_read(svr->ssl, buf, size); + svr->ssl_err = SSL_get_error(svr->ssl, num); + + if (svr->fd_handler) + { + if (svr->ssl && svr->ssl_err == SSL_ERROR_WANT_READ) + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ); + else if (svr->ssl && svr->ssl_err == SSL_ERROR_WANT_WRITE) + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE); + } + + if ((svr->ssl_err == SSL_ERROR_ZERO_RETURN) || + (svr->ssl_err == SSL_ERROR_SYSCALL) || + (svr->ssl_err == SSL_ERROR_SSL)) + return -1; + + if (num < 0) + return 0; + + return num; +} + +static int +_ecore_con_ssl_server_write_openssl(Ecore_Con_Server *svr, + const unsigned char *buf, + int size) +{ + int num; + + num = SSL_write(svr->ssl, buf, size); + svr->ssl_err = SSL_get_error(svr->ssl, num); + + if (svr->fd_handler) + { + if (svr->ssl && svr->ssl_err == SSL_ERROR_WANT_READ) + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_READ); + else if (svr->ssl && svr->ssl_err == SSL_ERROR_WANT_WRITE) + ecore_main_fd_handler_active_set(svr->fd_handler, ECORE_FD_WRITE); + } + + if ((svr->ssl_err == SSL_ERROR_ZERO_RETURN) || + (svr->ssl_err == SSL_ERROR_SYSCALL) || + (svr->ssl_err == SSL_ERROR_SSL)) + return -1; + + if (num < 0) + return 0; + + return num; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_client_init_openssl(Ecore_Con_Client *cl) +{ + int ret = -1; + switch (cl->ssl_state) + { + case ECORE_CON_SSL_STATE_DONE: + return ECORE_CON_SSL_ERROR_NONE; + + case ECORE_CON_SSL_STATE_INIT: + SSL_ERROR_CHECK_GOTO_ERROR(!(cl->ssl = SSL_new(cl->host_server->ssl_ctx))); + + SSL_ERROR_CHECK_GOTO_ERROR(!SSL_set_fd(cl->ssl, cl->fd)); + SSL_set_accept_state(cl->ssl); + cl->ssl_state = ECORE_CON_SSL_STATE_HANDSHAKING; + + case ECORE_CON_SSL_STATE_HANDSHAKING: + if (!cl->ssl) + { + DBG("Client was previously lost, going to error condition"); + goto error; + } + ret = SSL_do_handshake(cl->ssl); + cl->ssl_err = SSL_get_error(cl->ssl, ret); + SSL_ERROR_CHECK_GOTO_ERROR((cl->ssl_err == SSL_ERROR_SYSCALL) || (cl->ssl_err == SSL_ERROR_SSL)); + if (ret == 1) + { + cl->handshaking = EINA_FALSE; + cl->ssl_state = ECORE_CON_SSL_STATE_DONE; + } + else + { + if (cl->ssl_err == SSL_ERROR_WANT_READ) + ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ); + else if (cl->ssl_err == SSL_ERROR_WANT_WRITE) + ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE); + return ECORE_CON_SSL_ERROR_NONE; + } + + default: + break; + } + +#ifdef ISCOMFITOR + { + /* print session info into DBG */ + SSL_SESSION *s; + BIO *b; + char log[4096]; + + memset(log, 0, sizeof(log)); + s = SSL_get_session(cl->ssl); + b = BIO_new(BIO_s_mem()); + SSL_SESSION_print(b, s); + while (BIO_read(b, log, sizeof(log)) > 0) + DBG("%s", log); + + BIO_free(b); + } +#endif + + if (!cl->host_server->verify) + /* not verifying certificates, so we're done! */ + return ECORE_CON_SSL_ERROR_NONE; + SSL_set_verify(cl->ssl, SSL_VERIFY_PEER, NULL); + /* use CRL/CA lists to verify */ + if (SSL_get_peer_certificate(cl->ssl)) + SSL_ERROR_CHECK_GOTO_ERROR(SSL_get_verify_result(cl->ssl)); + + return ECORE_CON_SSL_ERROR_NONE; + +error: + _openssl_print_errors(cl, ECORE_CON_EVENT_CLIENT_ERROR); + _ecore_con_ssl_client_shutdown_openssl(cl); + return ECORE_CON_SSL_ERROR_SERVER_INIT_FAILED; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_client_shutdown_openssl(Ecore_Con_Client *cl) +{ + if (cl->ssl) + { + if (!SSL_shutdown(cl->ssl)) + SSL_shutdown(cl->ssl); + + SSL_free(cl->ssl); + } + + cl->ssl = NULL; + cl->ssl_err = SSL_ERROR_NONE; + + return ECORE_CON_SSL_ERROR_NONE; +} + +static int +_ecore_con_ssl_client_read_openssl(Ecore_Con_Client *cl, + unsigned char *buf, + int size) +{ + int num; + + if (!cl->ssl) return -1; + num = SSL_read(cl->ssl, buf, size); + cl->ssl_err = SSL_get_error(cl->ssl, num); + + if (cl->fd_handler) + { + if (cl->ssl && cl->ssl_err == SSL_ERROR_WANT_READ) + ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ); + else if (cl->ssl && cl->ssl_err == SSL_ERROR_WANT_WRITE) + ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE); + } + + if ((cl->ssl_err == SSL_ERROR_ZERO_RETURN) || + (cl->ssl_err == SSL_ERROR_SYSCALL) || + (cl->ssl_err == SSL_ERROR_SSL)) + return -1; + + if (num < 0) + return 0; + + return num; +} + +static int +_ecore_con_ssl_client_write_openssl(Ecore_Con_Client *cl, + const unsigned char *buf, + int size) +{ + int num; + + num = SSL_write(cl->ssl, buf, size); + cl->ssl_err = SSL_get_error(cl->ssl, num); + + if (cl->fd_handler) + { + if (cl->ssl && cl->ssl_err == SSL_ERROR_WANT_READ) + ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_READ); + else if (cl->ssl && cl->ssl_err == SSL_ERROR_WANT_WRITE) + ecore_main_fd_handler_active_set(cl->fd_handler, ECORE_FD_WRITE); + } + + if ((cl->ssl_err == SSL_ERROR_ZERO_RETURN) || + (cl->ssl_err == SSL_ERROR_SYSCALL) || + (cl->ssl_err == SSL_ERROR_SSL)) + return -1; + + if (num < 0) + return 0; + + return num; +} + +#else + +/* + * No Ssl + */ + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_init_none(void) +{ + return ECORE_CON_SSL_ERROR_NONE; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_shutdown_none(void) +{ + return ECORE_CON_SSL_ERROR_NONE; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_server_prepare_none(Ecore_Con_Server *svr __UNUSED__, + int ssl_type __UNUSED__) +{ + return ECORE_CON_SSL_ERROR_NONE; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_server_upgrade_none(Ecore_Con_Server *svr __UNUSED__) +{ + return ECORE_CON_SSL_ERROR_NOT_SUPPORTED; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_server_init_none(Ecore_Con_Server *svr __UNUSED__) +{ + return ECORE_CON_SSL_ERROR_NOT_SUPPORTED; +} + +static Eina_Bool +_ecore_con_ssl_server_cafile_add_none(Ecore_Con_Server *svr __UNUSED__, + const char *ca_file __UNUSED__) +{ + return EINA_FALSE; +} + +static Eina_Bool +_ecore_con_ssl_server_cert_add_none(Ecore_Con_Server *svr __UNUSED__, + const char *cert_file __UNUSED__) +{ + return EINA_FALSE; +} + +static Eina_Bool +_ecore_con_ssl_server_privkey_add_none(Ecore_Con_Server *svr __UNUSED__, + const char *key_file __UNUSED__) +{ + return EINA_FALSE; +} + +static Eina_Bool +_ecore_con_ssl_server_crl_add_none(Ecore_Con_Server *svr __UNUSED__, + const char *crl_file __UNUSED__) +{ + return EINA_FALSE; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_server_shutdown_none(Ecore_Con_Server *svr __UNUSED__) +{ + return ECORE_CON_SSL_ERROR_NOT_SUPPORTED; +} + +static int +_ecore_con_ssl_server_read_none(Ecore_Con_Server *svr __UNUSED__, + unsigned char *buf __UNUSED__, + int size __UNUSED__) +{ + return -1; +} + +static int +_ecore_con_ssl_server_write_none(Ecore_Con_Server *svr __UNUSED__, + const unsigned char *buf __UNUSED__, + int size __UNUSED__) +{ + return -1; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_client_upgrade_none(Ecore_Con_Client *cl __UNUSED__) +{ + return ECORE_CON_SSL_ERROR_NOT_SUPPORTED; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_client_init_none(Ecore_Con_Client *cl __UNUSED__) +{ + return ECORE_CON_SSL_ERROR_NOT_SUPPORTED; +} + +static Ecore_Con_Ssl_Error +_ecore_con_ssl_client_shutdown_none(Ecore_Con_Client *cl __UNUSED__) +{ + return ECORE_CON_SSL_ERROR_NOT_SUPPORTED; +} + +static int +_ecore_con_ssl_client_read_none(Ecore_Con_Client *cl __UNUSED__, + unsigned char *buf __UNUSED__, + int size __UNUSED__) +{ + return -1; +} + +static int +_ecore_con_ssl_client_write_none(Ecore_Con_Client *cl __UNUSED__, + const unsigned char *buf __UNUSED__, + int size __UNUSED__) +{ + return -1; +} + +#endif diff --git a/libraries/ecore/src/lib/ecore_con/ecore_con_url.c b/libraries/ecore/src/lib/ecore_con/ecore_con_url.c new file mode 100644 index 0000000..cfcf095 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_con/ecore_con_url.c @@ -0,0 +1,1572 @@ +/* + * For info on how to use libcurl, see: + * http://curl.haxx.se/libcurl/c/libcurl-tutorial.html + */ + +/* + * FIXME: Support more CURL features... + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include + +#ifdef HAVE_WS2TCPIP_H +# include +#endif + +#ifdef HAVE_ESCAPE +# include +#endif + +#include "Ecore.h" +#include "ecore_private.h" +#include "Ecore_Con.h" +#include "ecore_con_private.h" + +int ECORE_CON_EVENT_URL_DATA = 0; +int ECORE_CON_EVENT_URL_COMPLETE = 0; +int ECORE_CON_EVENT_URL_PROGRESS = 0; + +#ifdef HAVE_CURL +static Eina_Bool _ecore_con_url_fd_handler(void *data, + Ecore_Fd_Handler *fd_handler); +static Eina_Bool _ecore_con_url_perform(Ecore_Con_Url *url_con); +static size_t _ecore_con_url_header_cb(void *ptr, + size_t size, + size_t nitems, + void *stream); +static size_t _ecore_con_url_data_cb(void *buffer, + size_t size, + size_t nitems, + void *userp); +static int _ecore_con_url_progress_cb(void *clientp, + double dltotal, + double dlnow, + double ultotal, + double ulnow); +static size_t _ecore_con_url_read_cb(void *ptr, + size_t size, + size_t nitems, + void *stream); +static void _ecore_con_event_url_free(void *data __UNUSED__, + void *ev); +static int _ecore_con_url_process_completed_jobs( + Ecore_Con_Url *url_con_to_match); +static Eina_Bool _ecore_con_url_idler_handler(void *data); + +static Ecore_Idler *_fd_idler_handler = NULL; +static Eina_List *_url_con_list = NULL; +static CURLM *_curlm = NULL; +static fd_set _current_fd_set; +static int _init_count = 0; +static Ecore_Timer *_curl_timeout = NULL; +static Eina_Bool pipelining = EINA_FALSE; + +typedef struct _Ecore_Con_Url_Event Ecore_Con_Url_Event; +struct _Ecore_Con_Url_Event +{ + int type; + void *ev; +}; + +static Eina_Bool +_url_complete_idler_cb(void *data) +{ + Ecore_Con_Url_Event *lev; + + lev = data; + ecore_event_add(lev->type, lev->ev, _ecore_con_event_url_free, NULL); + free(lev); + + return ECORE_CALLBACK_CANCEL; +} + +static void +_url_complete_push_event(int type, + void *ev) +{ + Ecore_Con_Url_Event *lev; + + lev = malloc(sizeof(Ecore_Con_Url_Event)); + lev->type = type; + lev->ev = ev; + + ecore_idler_add(_url_complete_idler_cb, lev); +} + +#endif + +/** + * @addtogroup Ecore_Con_Url_Group Ecore URL Connection Functions + * + * @{ + */ + +EAPI int +ecore_con_url_init(void) +{ +#ifdef HAVE_CURL + _init_count++; + + if (_init_count > 1) + return _init_count; + + if (!ECORE_CON_EVENT_URL_DATA) + { + ECORE_CON_EVENT_URL_DATA = ecore_event_type_new(); + ECORE_CON_EVENT_URL_COMPLETE = ecore_event_type_new(); + ECORE_CON_EVENT_URL_PROGRESS = ecore_event_type_new(); + } + + if (!_curlm) + { + long ms; + + FD_ZERO(&_current_fd_set); + if (curl_global_init(CURL_GLOBAL_ALL)) + { + while (_url_con_list) + ecore_con_url_free(eina_list_data_get(_url_con_list)); + return 0; + } + + _curlm = curl_multi_init(); + if (!_curlm) + { + while (_url_con_list) + ecore_con_url_free(eina_list_data_get(_url_con_list)); + + _init_count--; + return 0; + } + + curl_multi_timeout(_curlm, &ms); + if (ms <= 0) + ms = 1000; + + _curl_timeout = + ecore_timer_add((double)ms / 1000, _ecore_con_url_idler_handler, + (void *)0xACE); + ecore_timer_freeze(_curl_timeout); + } + + return 1; +#else + return 0; +#endif +} + +EAPI int +ecore_con_url_shutdown(void) +{ +#ifdef HAVE_CURL + if (!_init_count) + return 0; + + _init_count--; + + if (_init_count != 0) + return _init_count; + + if (_fd_idler_handler) + ecore_idler_del(_fd_idler_handler); + + _fd_idler_handler = NULL; + + if (_curl_timeout) + ecore_timer_del(_curl_timeout); + + _curl_timeout = NULL; + + while (_url_con_list) + ecore_con_url_free(eina_list_data_get(_url_con_list)); + + if (_curlm) + { + curl_multi_cleanup(_curlm); + _curlm = NULL; + } + + curl_global_cleanup(); +#endif + return 1; +} + +EAPI void +ecore_con_url_pipeline_set(Eina_Bool enable) +{ +#ifdef HAVE_CURL + if (enable) + curl_multi_setopt(_curlm, CURLMOPT_PIPELINING, 1); + else + curl_multi_setopt(_curlm, CURLMOPT_PIPELINING, 0); + pipelining = enable; +#else + return; + (void)enable; +#endif +} + +EAPI Eina_Bool +ecore_con_url_pipeline_get(void) +{ +#ifdef HAVE_CURL + return pipelining; +#endif + return EINA_FALSE; +} + +EAPI Ecore_Con_Url * +ecore_con_url_new(const char *url) +{ +#ifdef HAVE_CURL + Ecore_Con_Url *url_con; + CURLcode ret; + + if (!_init_count) + return NULL; + + url_con = calloc(1, sizeof(Ecore_Con_Url)); + if (!url_con) + return NULL; + + url_con->fd = -1; + url_con->write_fd = -1; + + url_con->curl_easy = curl_easy_init(); + if (!url_con->curl_easy) + { + free(url_con); + return NULL; + } + + ECORE_MAGIC_SET(url_con, ECORE_MAGIC_CON_URL); + + if (!ecore_con_url_url_set(url_con, url)) + { + ecore_con_url_free(url_con); + return NULL; + } + + ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_ENCODING, "gzip,deflate"); + if (ret != CURLE_OK) + { + ERR("Could not set CURLOPT_ENCODING to \"gzip,deflate\": %s", + curl_easy_strerror(ret)); + ecore_con_url_free(url_con); + return NULL; + } + + curl_easy_setopt(url_con->curl_easy, CURLOPT_WRITEFUNCTION, + _ecore_con_url_data_cb); + curl_easy_setopt(url_con->curl_easy, CURLOPT_WRITEDATA, url_con); + + curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSFUNCTION, + _ecore_con_url_progress_cb); + curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSDATA, url_con); + curl_easy_setopt(url_con->curl_easy, CURLOPT_NOPROGRESS, EINA_FALSE); + + curl_easy_setopt(url_con->curl_easy, CURLOPT_HEADERFUNCTION, + _ecore_con_url_header_cb); + curl_easy_setopt(url_con->curl_easy, CURLOPT_HEADERDATA, url_con); + + /* + * FIXME: Check that these timeouts are sensible defaults + * FIXME: Provide a means to change these timeouts + */ + curl_easy_setopt(url_con->curl_easy, CURLOPT_CONNECTTIMEOUT, 30); + curl_easy_setopt(url_con->curl_easy, CURLOPT_FOLLOWLOCATION, 1); + + return url_con; +#else + return NULL; + url = NULL; +#endif +} + +EAPI Ecore_Con_Url * +ecore_con_url_custom_new(const char *url, + const char *custom_request) +{ +#ifdef HAVE_CURL + Ecore_Con_Url *url_con; + CURLcode ret; + + if (!url) + return NULL; + + if (!custom_request) + return NULL; + + url_con = ecore_con_url_new(url); + + if (!url_con) + return NULL; + + ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_CUSTOMREQUEST, custom_request); + if (ret != CURLE_OK) + { + ERR("Could not set a custom request string: %s", + curl_easy_strerror(ret)); + ecore_con_url_free(url_con); + return NULL; + } + + return url_con; +#else + return NULL; + url = NULL; + custom_request = NULL; +#endif +} + +EAPI void +ecore_con_url_free(Ecore_Con_Url *url_con) +{ +#ifdef HAVE_CURL + char *s; + CURLMcode ret; + + if (!url_con) + return; + + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_free"); + return; + } + + ECORE_MAGIC_SET(url_con, ECORE_MAGIC_NONE); + if(url_con->fd != -1) + { + FD_CLR(url_con->fd, &_current_fd_set); + if (url_con->fd_handler) + ecore_main_fd_handler_del(url_con->fd_handler); + + url_con->fd = -1; + url_con->fd_handler = NULL; + } + + if (url_con->curl_easy) + { + // FIXME: For an unknown reason, progress continue to arrive after destruction + // this prevent any further call to the callback. + curl_easy_setopt(url_con->curl_easy, CURLOPT_PROGRESSFUNCTION, NULL); + curl_easy_setopt(url_con->curl_easy, CURLOPT_NOPROGRESS, EINA_TRUE); + + if (url_con->active) + { + url_con->active = EINA_FALSE; + + ret = curl_multi_remove_handle(_curlm, url_con->curl_easy); + if (ret != CURLM_OK) + ERR("curl_multi_remove_handle failed: %s", + curl_multi_strerror(ret)); + } + + curl_easy_cleanup(url_con->curl_easy); + } + + _url_con_list = eina_list_remove(_url_con_list, url_con); + curl_slist_free_all(url_con->headers); + EINA_LIST_FREE(url_con->additional_headers, s) + free(s); + EINA_LIST_FREE(url_con->response_headers, s) + free(s); + eina_stringshare_del(url_con->url); + free(url_con); +#else + return; + (void)url_con; +#endif +} + +EAPI const char * +ecore_con_url_url_get(Ecore_Con_Url *url_con) +{ +#ifdef HAVE_CURL + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, __func__); + return NULL; + } + return url_con->url; +#else + return NULL; + (void)url_con; +#endif +} + +EAPI Eina_Bool +ecore_con_url_url_set(Ecore_Con_Url *url_con, + const char *url) +{ +#ifdef HAVE_CURL + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_url_set"); + return EINA_FALSE; + } + + if (url_con->active) + return EINA_FALSE; + + eina_stringshare_replace(&url_con->url, url); + + if (url_con->url) + curl_easy_setopt(url_con->curl_easy, CURLOPT_URL, + url_con->url); + else + curl_easy_setopt(url_con->curl_easy, CURLOPT_URL, ""); + + return EINA_TRUE; +#else + return EINA_FALSE; + (void)url; + (void)url_con; +#endif +} + +EAPI void +ecore_con_url_data_set(Ecore_Con_Url *url_con, + void *data) +{ +#ifdef HAVE_CURL + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_data_set"); + return; + } + + url_con->data = data; +#else + return; + url_con = NULL; + data = NULL; +#endif +} + +EAPI void +ecore_con_url_additional_header_add(Ecore_Con_Url *url_con, + const char *key, + const char *value) +{ +#ifdef HAVE_CURL + char *tmp; + + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, + "ecore_con_url_additional_header_add"); + return; + } + + tmp = malloc(strlen(key) + strlen(value) + 3); + if (!tmp) + return; + + sprintf(tmp, "%s: %s", key, value); + url_con->additional_headers = eina_list_append(url_con->additional_headers, + tmp); +#else + return; + url_con = NULL; + key = NULL; + value = NULL; +#endif +} + +EAPI void +ecore_con_url_additional_headers_clear(Ecore_Con_Url *url_con) +{ +#ifdef HAVE_CURL + char *s; + + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, + "ecore_con_url_additional_headers_clear"); + return; + } + + EINA_LIST_FREE(url_con->additional_headers, s) + free(s); +#else + return; + url_con = NULL; +#endif +} + +EAPI void * +ecore_con_url_data_get(Ecore_Con_Url *url_con) +{ +#ifdef HAVE_CURL + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_data_get"); + return NULL; + } + + return url_con->data; +#else + return NULL; + url_con = NULL; +#endif +} + +EAPI void +ecore_con_url_time(Ecore_Con_Url *url_con, + Ecore_Con_Url_Time condition, + double timestamp) +{ +#ifdef HAVE_CURL + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_time"); + return; + } + + url_con->time_condition = condition; + url_con->timestamp = timestamp; +#else + return; + (void)url_con; + (void)condition; + (void)timestamp; +#endif +} + +EAPI void +ecore_con_url_fd_set(Ecore_Con_Url *url_con, + int fd) +{ +#ifdef HAVE_CURL + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_set"); + return; + } + + url_con->write_fd = fd; +#else + return; + (void)url_con; + (void)fd; +#endif +} + +EAPI int +ecore_con_url_received_bytes_get(Ecore_Con_Url *url_con) +{ +#ifdef HAVE_CURL + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, + "ecore_con_url_received_bytes_get"); + return -1; + } + + return url_con->received; +#else + return 0; + (void)url_con; +#endif +} + +EAPI const Eina_List * +ecore_con_url_response_headers_get(Ecore_Con_Url *url_con) +{ +#ifdef HAVE_CURL + return url_con->response_headers; +#else + return NULL; + (void)url_con; +#endif +} + +EAPI Eina_Bool +ecore_con_url_httpauth_set(Ecore_Con_Url *url_con, + const char *username, + const char *password, + Eina_Bool safe) +{ +#ifdef HAVE_CURL + CURLcode ret; + + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, + "ecore_con_url_httpauth_set"); + return EINA_FALSE; + } + +# if LIBCURL_VERSION_NUM >= 0x071301 + if ((username) && (password)) + { + if (safe) + curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPAUTH, + CURLAUTH_ANYSAFE); + else + curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPAUTH, CURLAUTH_ANY); + + ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_USERNAME, username); + if (ret != CURLE_OK) + { + ERR("Could not set username for HTTP authentication: %s", + curl_easy_strerror(ret)); + return EINA_FALSE; + } + + ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_PASSWORD, password); + if (ret != CURLE_OK) + { + ERR("Could not set password for HTTP authentication: %s", + curl_easy_strerror(ret)); + return EINA_FALSE; + } + + return EINA_TRUE; + } +# endif +#else + return EINA_FALSE; + (void)url_con; + (void)username; + (void)password; + (void)safe; +#endif + + return EINA_FALSE; +} + +#define MODE_AUTO 0 +#define MODE_GET 1 +#define MODE_POST 2 + +static Eina_Bool +_ecore_con_url_send(Ecore_Con_Url *url_con, + int mode, + const void *data, + long length, + const char *content_type) +{ +#ifdef HAVE_CURL + Eina_List *l; + const char *s; + char tmp[256]; + + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_send"); + return EINA_FALSE; + } + + if (url_con->active) + return EINA_FALSE; + + if (!url_con->url) + return EINA_FALSE; + + /* Free response headers from previous send() calls */ + EINA_LIST_FREE(url_con->response_headers, s) + free((char *)s); + url_con->response_headers = NULL; + + curl_slist_free_all(url_con->headers); + url_con->headers = NULL; + + if ((mode == MODE_POST) || (mode == MODE_AUTO)) + { + if (data) + { + if ((content_type) && (strlen(content_type) < 200)) + { + snprintf(tmp, sizeof(tmp), "Content-Type: %s", content_type); + url_con->headers = curl_slist_append(url_con->headers, tmp); + } + + curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDS, data); + curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, length); + } + else curl_easy_setopt(url_con->curl_easy, CURLOPT_POSTFIELDSIZE, 0); + if (mode == MODE_POST) + curl_easy_setopt(url_con->curl_easy, CURLOPT_POST, 1); + } + + switch (url_con->time_condition) + { + case ECORE_CON_URL_TIME_NONE: + curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION, + CURL_TIMECOND_NONE); + break; + + case ECORE_CON_URL_TIME_IFMODSINCE: + curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION, + CURL_TIMECOND_IFMODSINCE); + curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE, + (long)url_con->timestamp); + break; + + case ECORE_CON_URL_TIME_IFUNMODSINCE: + curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMECONDITION, + CURL_TIMECOND_IFUNMODSINCE); + curl_easy_setopt(url_con->curl_easy, CURLOPT_TIMEVALUE, + (long)url_con->timestamp); + break; + } + + /* Additional headers */ + EINA_LIST_FOREACH(url_con->additional_headers, l, s) + url_con->headers = curl_slist_append(url_con->headers, s); + + curl_easy_setopt(url_con->curl_easy, CURLOPT_HTTPHEADER, url_con->headers); + + url_con->received = 0; + + return _ecore_con_url_perform(url_con); +#else + return EINA_FALSE; + (void)url_con; + (void)mode; + (void)data; + (void)length; + (void)content_type; +#endif +} + +EINA_DEPRECATED EAPI Eina_Bool +ecore_con_url_send(Ecore_Con_Url *url_con, + const void *data, + long length, + const char *content_type) +{ + return _ecore_con_url_send(url_con, MODE_AUTO, data, length, content_type); +} + +EAPI Eina_Bool +ecore_con_url_get(Ecore_Con_Url *url_con) +{ + return _ecore_con_url_send(url_con, MODE_GET, NULL, 0, NULL); +} + +EAPI Eina_Bool +ecore_con_url_post(Ecore_Con_Url *url_con, + const void *data, + long length, + const char *content_type) +{ + return _ecore_con_url_send(url_con, MODE_POST, data, length, content_type); +} + +EAPI Eina_Bool +ecore_con_url_ftp_upload(Ecore_Con_Url *url_con, + const char *filename, + const char *user, + const char *pass, + const char *upload_dir) +{ +#ifdef HAVE_CURL + char url[4096]; + char userpwd[4096]; + FILE *fd; + struct stat file_info; + CURLcode ret; + + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, + ECORE_MAGIC_CON_URL, + "ecore_con_url_ftp_upload"); + return EINA_FALSE; + } + + if (url_con->active) + return EINA_FALSE; + + if (!url_con->url) + return EINA_FALSE; + + if (filename) + { + if (stat(filename, &file_info)) + return EINA_FALSE; + + snprintf(userpwd, sizeof(userpwd), "%s:%s", user, pass); + ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_USERPWD, userpwd); + if (ret != CURLE_OK) + { + ERR("Could not set username and password for FTP upload: %s", + curl_easy_strerror(ret)); + return EINA_FALSE; + } + + char tmp[PATH_MAX]; + snprintf(tmp, PATH_MAX, "%s", filename); + + if (upload_dir) + snprintf(url, sizeof(url), "ftp://%s/%s/%s", url_con->url, + upload_dir, basename(tmp)); + else + snprintf(url, sizeof(url), "ftp://%s/%s", url_con->url, + basename(tmp)); + + if (!ecore_con_url_url_set(url_con, url)) + return EINA_FALSE; + + curl_easy_setopt(url_con->curl_easy, CURLOPT_INFILESIZE_LARGE, + (curl_off_t)file_info.st_size); + curl_easy_setopt(url_con->curl_easy, CURLOPT_UPLOAD, 1); + curl_easy_setopt(url_con->curl_easy, CURLOPT_READFUNCTION, + _ecore_con_url_read_cb); + + fd = fopen(filename, "rb"); + if (!fd) + { + ERR("Could not open \"%s\" for FTP upload", filename); + return EINA_FALSE; + } + curl_easy_setopt(url_con->curl_easy, CURLOPT_READDATA, fd); + + return _ecore_con_url_perform(url_con); + } +#else + return EINA_FALSE; + (void)url_con; + (void)filename; + (void)user; + (void)pass; + (void)upload_dir; +#endif + + return EINA_FALSE; +} + +EAPI void +ecore_con_url_cookies_init(Ecore_Con_Url *url_con) +{ +#ifdef HAVE_CURL + if (!url_con) + return; + + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, + "ecore_con_url_cookies_init"); + return; + } + + curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEFILE, ""); +#else + return; + (void)url_con; +#endif +} + +EAPI void +ecore_con_url_cookies_ignore_old_session_set(Ecore_Con_Url *url_con, Eina_Bool ignore) +{ +#ifdef HAVE_CURL + if (!url_con) + return; + + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, + "ecore_con_url_cookies_ignore_old_session_set"); + return; + } + + curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIESESSION, ignore); +#else + return; + (void)url_con; + (void)ignore; +#endif +} + +EAPI void +ecore_con_url_cookies_clear(Ecore_Con_Url *url_con) +{ +#ifdef HAVE_CURL + if (!url_con) + return; + + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, + "ecore_con_url_cookies_clear"); + return; + } + + curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "ALL"); +#else + return; + (void)url_con; +#endif +} + +EAPI void +ecore_con_url_cookies_session_clear(Ecore_Con_Url *url_con) +{ +#ifdef HAVE_CURL + if (!url_con) + return; + + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, + "ecore_con_url_cookies_session_clear"); + return; + } + + curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "SESS"); +#else + return; + (void)url_con; +#endif +} + +EAPI void +ecore_con_url_cookies_file_add(Ecore_Con_Url *url_con, const char * const file_name) +{ +#ifdef HAVE_CURL + if (!url_con) + return; + + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, + "ecore_con_url_cookies_file_add"); + return; + } + + curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEFILE, file_name); +#else + return; + (void)url_con; + (void)file_name; +#endif +} + +EAPI Eina_Bool +ecore_con_url_cookies_jar_file_set(Ecore_Con_Url *url_con, const char * const cookiejar_file) +{ +#ifdef HAVE_CURL + CURLcode ret; + + if (!url_con) + return EINA_FALSE; + + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, + "ecore_con_url_cookies_jar_file_set"); + return EINA_FALSE; + } + + ret = curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIEJAR, + cookiejar_file); + if (ret != CURLE_OK) + { + ERR("Setting the cookie-jar name failed: %s", + curl_easy_strerror(ret)); + return EINA_FALSE; + } + + return EINA_TRUE; +#else + return EINA_FALSE; + (void)url_con; + (void)cookiejar_file; +#endif +} + +EAPI void +ecore_con_url_cookies_jar_write(Ecore_Con_Url *url_con) +{ +#ifdef HAVE_CURL + if (!url_con) + return; + + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, + "ecore_con_url_cookies_jar_write"); + return; + } + + curl_easy_setopt(url_con->curl_easy, CURLOPT_COOKIELIST, "FLUSH"); +#else + return; + (void)url_con; +#endif +} + +EAPI void +ecore_con_url_verbose_set(Ecore_Con_Url *url_con, + Eina_Bool verbose) +{ +#ifdef HAVE_CURL + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, + "ecore_con_url_verbose_set"); + return; + } + + if (url_con->active) + return; + + if (!url_con->url) + return; + + curl_easy_setopt(url_con->curl_easy, CURLOPT_VERBOSE, (int)verbose); +#else + return; + (void)url_con; + (void)verbose; +#endif +} + +EAPI void +ecore_con_url_ftp_use_epsv_set(Ecore_Con_Url *url_con, + Eina_Bool use_epsv) +{ +#ifdef HAVE_CURL + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, + "ecore_con_url_ftp_use_epsv_set"); + return; + } + + if (url_con->active) + return; + + if (!url_con->url) + return; + + curl_easy_setopt(url_con->curl_easy, CURLOPT_FTP_USE_EPSV, (int)use_epsv); +#else + return; + (void)url_con; + (void)use_epsv; +#endif +} + +/** + * Toggle libcurl's verify peer's certificate option. + * + * If @p verify is @c EINA_TRUE, libcurl will verify + * the authenticity of the peer's certificate, otherwise + * it will not. Default behavior of libcurl is to check + * peer's certificate. + * + * @param url_con Ecore_Con_Url instance which will be acted upon. + * @param verify Whether or not libcurl will check peer's certificate. + * @since 1.1.0 + */ +EAPI void +ecore_con_url_ssl_verify_peer_set(Ecore_Con_Url *url_con, + Eina_Bool verify) +{ +#ifdef HAVE_CURL + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, + "ecore_con_url_ssl_verify_peer_set"); + return; + } + + if (url_con->active) + return; + + if (!url_con->url) + return; + + curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, (int)verify); +#else + return; + (void)url_con; + (void)verify; +#endif +} + +/** + * Set a custom CA to trust for SSL/TLS connections. + * + * Specify the path of a file (in PEM format) containing one or more + * CA certificate(s) to use for the validation of the server certificate. + * + * This function can also disable CA validation if @p ca_path is @c NULL. + * However, the server certificate still needs to be valid for the connection + * to succeed (i.e., the certificate must concern the server the + * connection is made to). + * + * @param url_con Connection object that will use the custom CA. + * @param ca_path Path to a CA certificate(s) file or @c NULL to disable + * CA validation. + * + * @return @c 0 on success. When cURL is used, non-zero return values + * are equal to cURL error codes. + */ +EAPI int +ecore_con_url_ssl_ca_set(Ecore_Con_Url *url_con, const char *ca_path) +{ + int res = -1; + +#ifdef HAVE_CURL + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_ssl_ca_set"); + return -1; + } + + if (url_con->active) return -1; + if (!url_con->url) return -1; + if (ca_path == NULL) + res = curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, 0); + else + { + res = curl_easy_setopt(url_con->curl_easy, CURLOPT_SSL_VERIFYPEER, 1); + if (!res) + res = curl_easy_setopt(url_con->curl_easy, CURLOPT_CAINFO, ca_path); + } +#else + return -1; + (void)url_con; + (void)ca_path; +#endif + + return res; +} + + +/** + * @} + */ + +#ifdef HAVE_CURL +static int +_ecore_con_url_suspend_fd_handler(void) +{ + Eina_List *l; + Ecore_Con_Url *url_con; + int deleted = 0; + + if (!_url_con_list) + return 0; + + EINA_LIST_FOREACH(_url_con_list, l, url_con) + { + if (url_con->active && url_con->fd_handler) + { + ecore_main_fd_handler_del(url_con->fd_handler); + url_con->fd_handler = NULL; + deleted++; + } + } + + return deleted; +} + +static int +_ecore_con_url_restart_fd_handler(void) +{ + Eina_List *l; + Ecore_Con_Url *url_con; + int activated = 0; + + if (!_url_con_list) + return 0; + + EINA_LIST_FOREACH(_url_con_list, l, url_con) + { + if (!url_con->fd_handler && url_con->fd != -1) + { + url_con->fd_handler = + ecore_main_fd_handler_add(url_con->fd, url_con->flags, + _ecore_con_url_fd_handler, + NULL, NULL, NULL); + activated++; + } + } + + return activated; +} + +static size_t +_ecore_con_url_data_cb(void *buffer, + size_t size, + size_t nitems, + void *userp) +{ + Ecore_Con_Url *url_con; + Ecore_Con_Event_Url_Data *e; + size_t real_size = size * nitems; + + url_con = (Ecore_Con_Url *)userp; + + if (!url_con) + return -1; + + if (!ECORE_MAGIC_CHECK(url_con, ECORE_MAGIC_CON_URL)) + { + ECORE_MAGIC_FAIL(url_con, ECORE_MAGIC_CON_URL, "ecore_con_url_data_cb"); + return -1; + } + + url_con->received += real_size; + + if (url_con->write_fd < 0) + { + e = + malloc(sizeof(Ecore_Con_Event_Url_Data) + sizeof(unsigned char) * + (real_size - 1)); + if (e) + { + e->url_con = url_con; + e->size = real_size; + memcpy(e->data, buffer, real_size); + ecore_event_add(ECORE_CON_EVENT_URL_DATA, e, + _ecore_con_event_url_free, NULL); + } + } + else + { + ssize_t count = 0; + size_t total_size = real_size; + size_t offset = 0; + + while (total_size > 0) + { + count = write(url_con->write_fd, + (char *)buffer + offset, + total_size); + if (count < 0) + { + if (errno != EAGAIN && errno != EINTR) + return -1; + } + else + { + total_size -= count; + offset += count; + } + } + } + + return real_size; +} + +#define ECORE_CON_URL_TRANSMISSION(Transmit, Event, Url_con, Total, Now) \ + { \ + Ecore_Con_Event_Url_Progress *e; \ + if ((Total != 0) || (Now != 0)) \ + { \ + e = calloc(1, sizeof(Ecore_Con_Event_Url_Progress)); \ + if (e) \ + { \ + e->url_con = url_con; \ + e->total = Total; \ + e->now = Now; \ + ecore_event_add(Event, e, _ecore_con_event_url_free, NULL); \ + } \ + } \ + } + +static size_t +_ecore_con_url_header_cb(void *ptr, + size_t size, + size_t nitems, + void *stream) +{ + size_t real_size = size * nitems; + Ecore_Con_Url *url_con = stream; + + char *header = malloc(sizeof(char) * (real_size + 1)); + if (!header) + return real_size; + + memcpy(header, ptr, real_size); + header[real_size] = '\0'; + + url_con->response_headers = eina_list_append(url_con->response_headers, + header); + + return real_size; +} + +static int +_ecore_con_url_progress_cb(void *clientp, + double dltotal, + double dlnow, + double ultotal, + double ulnow) +{ + Ecore_Con_Event_Url_Progress *e; + Ecore_Con_Url *url_con; + + url_con = clientp; + + e = malloc(sizeof(Ecore_Con_Event_Url_Progress)); + if (e) + { + e->url_con = url_con; + e->down.total = dltotal; + e->down.now = dlnow; + e->up.total = ultotal; + e->up.now = ulnow; + ecore_event_add(ECORE_CON_EVENT_URL_PROGRESS, e, + _ecore_con_event_url_free, NULL); + } + + return 0; +} + +static size_t +_ecore_con_url_read_cb(void *ptr, + size_t size, + size_t nitems, + void *stream) +{ + size_t retcode = fread(ptr, size, nitems, stream); + + if (ferror((FILE *)stream)) + { + fclose(stream); + return CURL_READFUNC_ABORT; + } + else if (retcode == 0) + { + fclose((FILE *)stream); + return 0; + } + +#ifdef _WIN32 + INF("*** We read %Iu bytes from file", retcode); +#else + INF("*** We read %zu bytes from file", retcode); +#endif + return retcode; +} + +static Eina_Bool +_ecore_con_url_perform(Ecore_Con_Url *url_con) +{ + fd_set read_set, write_set, exc_set; + int fd_max, fd; + int flags, still_running; + int completed_immediately = 0; + CURLMcode ret; + + _url_con_list = eina_list_append(_url_con_list, url_con); + + url_con->active = EINA_TRUE; + curl_multi_add_handle(_curlm, url_con->curl_easy); + curl_multi_perform(_curlm, &still_running); + + completed_immediately = _ecore_con_url_process_completed_jobs(url_con); + + if (!completed_immediately) + { + if (url_con->fd_handler) + ecore_main_fd_handler_del(url_con->fd_handler); + + url_con->fd_handler = NULL; + + /* url_con still active -- set up an fd_handler */ + FD_ZERO(&read_set); + FD_ZERO(&write_set); + FD_ZERO(&exc_set); + + /* Stupid curl, why can't I get the fd to the current added job? */ + ret = curl_multi_fdset(_curlm, &read_set, &write_set, &exc_set, + &fd_max); + if (ret != CURLM_OK) + { + ERR("curl_multi_fdset failed: %s", curl_multi_strerror(ret)); + return EINA_FALSE; + } + + for (fd = 0; fd <= fd_max; fd++) + { + if (!FD_ISSET(fd, &_current_fd_set)) + { + flags = 0; + if (FD_ISSET(fd, &read_set)) + flags |= ECORE_FD_READ; + + if (FD_ISSET(fd, &write_set)) + flags |= ECORE_FD_WRITE; + + if (FD_ISSET(fd, &exc_set)) + flags |= ECORE_FD_ERROR; + + if (flags) + { + long ms = 0; + + ret = curl_multi_timeout(_curlm, &ms); + if (ret != CURLM_OK) + ERR("curl_multi_timeout failed: %s", + curl_multi_strerror(ret)); + + if (ms == 0) + ms = 1000; + + FD_SET(fd, &_current_fd_set); + url_con->fd = fd; + url_con->flags = flags; + url_con->fd_handler = + ecore_main_fd_handler_add(fd, flags, + _ecore_con_url_fd_handler, + NULL, NULL, NULL); + break; + } + } + } + if (!url_con->fd_handler) + { + /* Failed to set up an fd_handler */ + ecore_timer_freeze(_curl_timeout); + + ret = curl_multi_remove_handle(_curlm, url_con->curl_easy); + if (ret != CURLM_OK) + ERR("curl_multi_remove_handle failed: %s", + curl_multi_strerror(ret)); + + url_con->active = EINA_FALSE; + url_con->fd = -1; + return EINA_FALSE; + } + + ecore_timer_thaw(_curl_timeout); + } + + return EINA_TRUE; +} + +static Eina_Bool +_ecore_con_url_idler_handler(void *data) +{ + int done, still_running; + + done = (curl_multi_perform(_curlm, &still_running) != CURLM_CALL_MULTI_PERFORM); + + _ecore_con_url_process_completed_jobs(NULL); + + if (done) + { + _ecore_con_url_restart_fd_handler(); + _fd_idler_handler = NULL; + + if (!_url_con_list) + ecore_timer_freeze(_curl_timeout); + + return data == + (void *)0xACE ? ECORE_CALLBACK_RENEW : ECORE_CALLBACK_CANCEL; + } + + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_ecore_con_url_fd_handler(void *data __UNUSED__, + Ecore_Fd_Handler *fd_handler __UNUSED__) +{ + _ecore_con_url_suspend_fd_handler(); + + if (!_fd_idler_handler) + _fd_idler_handler = ecore_idler_add( + _ecore_con_url_idler_handler, NULL); + + return ECORE_CALLBACK_RENEW; +} + +static int +_ecore_con_url_process_completed_jobs(Ecore_Con_Url *url_con_to_match) +{ + Eina_List *l; + Ecore_Con_Url *url_con; + Ecore_Con_Event_Url_Complete *e; + CURLMsg *curlmsg; + CURLMcode ret; + int n_remaining; + int job_matched = 0; + + /* Loop jobs and check if any are done */ + while ((curlmsg = curl_multi_info_read(_curlm, &n_remaining))) + { + if (curlmsg->msg != CURLMSG_DONE) + continue; + + /* find the job which is done */ + EINA_LIST_FOREACH(_url_con_list, l, url_con) + { + if (curlmsg->easy_handle == url_con->curl_easy) + { + if (url_con_to_match && + (url_con == url_con_to_match)) + job_matched = 1; + + if(url_con->fd != -1) + { + FD_CLR(url_con->fd, &_current_fd_set); + if (url_con->fd_handler) + ecore_main_fd_handler_del( + url_con->fd_handler); + + url_con->fd = -1; + url_con->fd_handler = NULL; + } + + _url_con_list = eina_list_remove(_url_con_list, url_con); + url_con->active = EINA_FALSE; + e = calloc(1, sizeof(Ecore_Con_Event_Url_Complete)); + if (e) + { + e->url_con = url_con; + e->status = 0; + if (curlmsg->data.result == CURLE_OK) + { + long status; /* curl API uses long, not int */ + + status = 0; + curl_easy_getinfo(curlmsg->easy_handle, + CURLINFO_RESPONSE_CODE, + &status); + e->status = status; + } + + _url_complete_push_event(ECORE_CON_EVENT_URL_COMPLETE, e); + } + + ret = curl_multi_remove_handle(_curlm, url_con->curl_easy); + if (ret != CURLM_OK) + ERR("curl_multi_remove_handle failed: %s", + curl_multi_strerror(ret)); + + break; + } + } + } + + return job_matched; +} + +static void +_ecore_con_event_url_free(void *data __UNUSED__, + void *ev) +{ + free(ev); +} + +#endif diff --git a/libraries/ecore/src/lib/ecore_config/Ecore_Config.h b/libraries/ecore/src/lib/ecore_config/Ecore_Config.h new file mode 100644 index 0000000..6733d7b --- /dev/null +++ b/libraries/ecore/src/lib/ecore_config/Ecore_Config.h @@ -0,0 +1,312 @@ +#ifndef _ECORE_CONFIG_H +# define _ECORE_CONFIG_H + +#ifdef EAPI +#undef EAPI +#endif +#ifdef _MSC_VER +# ifdef BUILDING_DLL +# define EAPI __declspec(dllexport) +# else +# define EAPI __declspec(dllimport) +# endif +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif + +/** + * @file + * @brief Provides the Enlightened Property Library. + * + * This file provies all headers and structs for use with Ecore_Config. + * Using individual header files should not be necessary. + */ + +# define DIR_DELIMITER '/' +# define ECORE_CONFIG_FLOAT_PRECISION 1000 + +/* FIXME: this should only be included if evas is present */ +# include + +# define ECORE_CONFIG_GLOBAL_ID "_system" + +/* structures */ + +/** + * Valid configuration property types. + */ +typedef enum Ecore_Config_Type +{ + ECORE_CONFIG_NIL = 0, /**< Property with no value. */ + ECORE_CONFIG_INT = 1, /**< Integer property type. */ + ECORE_CONFIG_FLT = 2, /**< Float property type. */ + ECORE_CONFIG_STR = 3, /**< String property type. */ + ECORE_CONFIG_RGB = 4, /**< Colour property type. */ + ECORE_CONFIG_THM = 5, /**< Theme property type. */ + ECORE_CONFIG_BLN = 6, /**< Boolean property type. */ + ECORE_CONFIG_SCT = 7, /**< Structure property type */ +} Ecore_Config_Type; + +typedef enum Ecore_Config_Flag +{ + ECORE_CONFIG_FLAG_NONE = 0, + ECORE_CONFIG_FLAG_BOUNDS = 1, + ECORE_CONFIG_FLAG_MODIFIED = 2, + ECORE_CONFIG_FLAG_SYSTEM = 4, + ECORE_CONFIG_FLAG_CMDLN = 8 +} Ecore_Config_Flag; + +/** + * Property change callback function prototype. + */ +typedef int (*Ecore_Config_Listener) (const char *key, + const Ecore_Config_Type type, + const int tag, void *data); + +typedef struct Ecore_Config_Listener_List +{ + Ecore_Config_Listener listener; + const char *name; + void *data; + int tag; + struct Ecore_Config_Listener_List *next; +} Ecore_Config_Listener_List; + +/** + * The actual property for storing a key-value pair. + */ +typedef struct Ecore_Config_Prop +{ + char *key; /* Property key. */ + char *description; /* Description set by ecore_config_descibe. */ + char short_opt; /* short identifier on command line (-f) */ + char *long_opt; /* long identifier on command line (--foo) */ + char *ptr; /* Used as the value when the property is a string or theme. */ + Ecore_Config_Type type; /* Property type. */ + long val; /* Used as the value when the property is an integer, float or colour. */ + long lo; /* Lower bound for the value when the property is an integer or float. */ + long hi; /* Higher bound for the value when the property is an integer or float. */ + long step; /* Increment for the value when the property is an integer or float. */ + Ecore_Config_Flag flags; /// < Configuration flags. + Ecore_Config_Listener_List *listeners; /* List of change listeners. */ + void *data; /// < Stores extra data for the property. + struct Ecore_Config_Prop *parent; /* if we are in a struct we have a parent to notify of changes etc */ + struct Ecore_Config_Prop *next; /* Pointer to the next property in the list. */ +} Ecore_Config_Prop; + +/* + * A container for a list of properties. Provided so that an + * application can use different set of properties at any time. This + * is useful for multiple window support. + */ +typedef struct Ecore_Config_Bundle +{ + char *identifier; /* Identifier for this set of properties (window ID for example) */ + char *owner; /* This is used to store the application name related to the bundle */ + long serial; /* Unique identifier to identify bundle */ + Ecore_Config_Prop *data; /* Pointer to root of property list */ + void *user_data; /* App specific pointer to "other data" */ + struct Ecore_Config_Bundle *next; /* Pointer to next bundle in this application */ +} Ecore_Config_Bundle; + +typedef struct Ecore_Config_Server +{ + void *server; + char *name; + Ecore_Config_Bundle *bundles; /* data anchor */ + struct Ecore_Config_Server *next; +} Ecore_Config_Server; + +# ifdef __cplusplus +extern "C" +{ +# endif + +/* global ptrs to save passing them through the API */ + EAPI extern Ecore_Config_Server *__ecore_config_server_global; + EAPI extern Ecore_Config_Server *__ecore_config_server_local; + EAPI extern Ecore_Config_Bundle *__ecore_config_bundle_local; + EAPI extern char *__ecore_config_app_name; + + EAPI Ecore_Config_Prop *ecore_config_get(const char *key); + EAPI const char *ecore_config_type_get(const Ecore_Config_Prop *e); + EAPI int ecore_config_boolean_get(const char *key); + EAPI char *ecore_config_string_get(const char *key); + EAPI long ecore_config_int_get(const char *key); + EAPI int ecore_config_argb_get(const char *key, int *a, int *r, + int *g, int *b); + EAPI long ecore_config_argbint_get(const char *key); + EAPI char *ecore_config_argbstr_get(const char *key); + EAPI float ecore_config_float_get(const char *key); + EAPI char *ecore_config_theme_get(const char *key); + EAPI char *ecore_config_as_string_get(const char *key); + EAPI int ecore_config_bound(Ecore_Config_Prop *e); + EAPI int ecore_config_describe(const char *key, const char *desc); + EAPI int ecore_config_short_opt_set(const char *key, + char short_opt); + EAPI int ecore_config_long_opt_set(const char *key, + const char *long_opt); + EAPI int ecore_config_set(const char *key, const char *val); + EAPI int ecore_config_typed_set(const char *key, const void *val, + int type); + EAPI int ecore_config_boolean_set(const char *key, int val); + EAPI int ecore_config_string_set(const char *key, const char *val); + EAPI int ecore_config_int_set(const char *key, int val); + EAPI int ecore_config_argb_set(const char *key, int a, int r, int g, int b); + EAPI int ecore_config_argbint_set(const char *key, long argb); + EAPI int ecore_config_argbstr_set(const char *key, const char *val); + EAPI int ecore_config_float_set(const char *key, float val); + EAPI int ecore_config_theme_set(const char *key, const char *val); + EAPI int ecore_config_theme_preview_group_set(const char *key, + const char *group); + EAPI int ecore_config_as_string_set(const char *key, const char *val); + + EAPI int ecore_config_default(const char *key, const char *val, + float lo, float hi, float step); + EAPI int ecore_config_typed_default(const char *key, const void *val, + int type); + EAPI int ecore_config_boolean_default(const char *key, int val); + EAPI int ecore_config_int_default(const char *key, int val); + EAPI int ecore_config_int_default_bound(const char *key, int val, + int lo, int hi, int step); + EAPI int ecore_config_string_default(const char *key, const char *val); + EAPI int ecore_config_float_default(const char *key, float val); + EAPI int ecore_config_float_default_bound(const char *key, + float val, float lo, + float hi, float step); + EAPI int ecore_config_argb_default(const char *key, int a, int r, int g, int b); + EAPI int ecore_config_argbint_default(const char *key, long argb); + EAPI int ecore_config_argbstr_default(const char *key, const char *val); + EAPI int ecore_config_theme_default(const char *key, const char *val); + EAPI int ecore_config_struct_default(const char *key); + EAPI int ecore_config_struct_int_add(const char *key, const char *name, int val); + EAPI int ecore_config_struct_float_add(const char *key, const char *name, float val); + EAPI int ecore_config_struct_create(const char *key); + EAPI int ecore_config_struct_string_add(const char *key, const char *name, const char* val); + EAPI int ecore_config_struct_theme_add(const char *key, const char *name, const char* val); + EAPI int ecore_config_struct_argb_add(const char *key, const char *name, int a, int r, int g, int b); + EAPI int ecore_config_struct_boolean_add(const char *key, const char *name, int val); + EAPI int ecore_config_struct_get(const char *key, void *data); + + EAPI int ecore_config_listen(const char *name, const char *key, + Ecore_Config_Listener listener, + int tag, void *data); + EAPI int ecore_config_deaf(const char *name, const char *key, + Ecore_Config_Listener listener); + EAPI Ecore_Config_Prop *ecore_config_dst(Ecore_Config_Prop *e); + EAPI int ecore_config_type_guess(const char *key, const char *val); + + EAPI Ecore_Config_Bundle *ecore_config_bundle_new(Ecore_Config_Server *srv, + const char *id); + EAPI Ecore_Config_Bundle *ecore_config_bundle_1st_get(Ecore_Config_Server *srv); + EAPI Ecore_Config_Bundle *ecore_config_bundle_next_get(Ecore_Config_Bundle *ns); + EAPI Ecore_Config_Bundle *ecore_config_bundle_by_serial_get(Ecore_Config_Server *srv, + long serial); + EAPI Ecore_Config_Bundle *ecore_config_bundle_by_label_get(Ecore_Config_Server *srv, + const char *label); + EAPI long ecore_config_bundle_serial_get(Ecore_Config_Bundle *ns); + EAPI char *ecore_config_bundle_label_get(Ecore_Config_Bundle *ns); + + EAPI int ecore_config_init(const char *name); + EAPI int ecore_config_shutdown(void); + + EAPI int ecore_config_system_init(void); + EAPI int ecore_config_system_shutdown(void); + + EAPI int ecore_config_load(void); + EAPI int ecore_config_file_load(const char *file); + EAPI int ecore_config_save(void); + EAPI int ecore_config_file_save(const char *file); + +/* error codes */ +# define ECORE_CONFIG_ERR_NOTSUPP (-16) +# define ECORE_CONFIG_ERR_NOFILE (-15) +# define ECORE_CONFIG_ERR_META_DLFAIL (-14) +# define ECORE_CONFIG_ERR_META_FILE (-13) +# define ECORE_CONFIG_ERR_META_FORMAT (-12) +# define ECORE_CONFIG_ERR_MONMIS (-11) +# define ECORE_CONFIG_ERR_NOEXEC (-10) +# define ECORE_CONFIG_ERR_PARTIAL (-9) +# define ECORE_CONFIG_ERR_PATHEX (-8) +# define ECORE_CONFIG_ERR_TYPEMISMATCH (-7) +# define ECORE_CONFIG_ERR_MUTEX (-6) +# define ECORE_CONFIG_ERR_NOTFOUND (-5) /* Error indicating that the item searched for could not be found. */ +# define ECORE_CONFIG_ERR_OOM (-4) /* Error given when the program runs out of memory. */ +# define ECORE_CONFIG_ERR_IGNORED (-3) /* Error occurred, but was ignored. */ +# define ECORE_CONFIG_ERR_NODATA (-2) /* Error given when necessary data is not provided. */ +# define ECORE_CONFIG_ERR_FAIL (-1) /* Failure result. */ +# define ECORE_CONFIG_ERR_SUCC (0) /* Success result. */ + +# define ECORE_CONFIG_PARSE_HELP (-2) /* Help was displayed */ +# define ECORE_CONFIG_PARSE_EXIT (-1) /* An error occurred */ +# define ECORE_CONFIG_PARSE_CONTINUE (0) /* Arguments parsed successfully */ + +/* convenience mathods in convenience.c */ + /* FIXME: this should only be included if evas is present */ + EAPI int ecore_config_evas_font_path_apply(Evas *evas); + EAPI char *ecore_config_theme_search_path_get(void); + EAPI int ecore_config_theme_search_path_append(const char *append); + + EAPI char *ecore_config_theme_default_path_get(void); + EAPI char *ecore_config_theme_with_path_from_name_get(char *name); + EAPI char *ecore_config_theme_with_path_get(const char *key); + EAPI void ecore_config_args_display(void); + EAPI int ecore_config_args_parse(void); + EAPI void ecore_config_args_callback_str_add(char short_opt, + char *long_opt, char *desc, + void (*func)(char *val, void *data), + void *data); + EAPI void ecore_config_args_callback_noarg_add(char short_opt, + char *long_opt, char *desc, + void (*func)(char *val, void *data), + void *data); + EAPI void ecore_config_app_describe(char *description); + + EAPI int ecore_config_create(const char *key, void *val, + char short_opt, char *long_opt, + char *desc); + EAPI int ecore_config_typed_create(const char *key, void *val, + int type, char short_opt, + char *long_opt, char *desc); + EAPI int ecore_config_boolean_create(const char *key, int val, + char short_opt, char *long_opt, + char *desc); + EAPI int ecore_config_int_create(const char *key, int val, + char short_opt, char *long_opt, + char *desc); + EAPI int ecore_config_int_create_bound(const char *key, int val, + int low, int high, + int step, char short_opt, + char *long_opt, + char *desc); + EAPI int ecore_config_string_create(const char *key, char *val, + char short_opt, + char *long_opt, char *desc); + EAPI int ecore_config_float_create(const char *key, float val, + char short_opt, char *long_opt, + char *desc); + EAPI int ecore_config_float_create_bound(const char *key, + float val, float low, + float high, float step, + char short_opt, + char *long_opt, + char *desc); + EAPI int ecore_config_argb_create(const char *key, char *val, + char short_opt, char *long_opt, + char *desc); + EAPI int ecore_config_theme_create(const char *key, char *val, + char short_opt, char *long_opt, + char *desc); + +# ifdef __cplusplus +} +# endif +#endif diff --git a/libraries/ecore/src/lib/ecore_config/Makefile.am b/libraries/ecore/src/lib/ecore_config/Makefile.am new file mode 100644 index 0000000..c459351 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_config/Makefile.am @@ -0,0 +1,62 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_ipc \ +-I$(top_srcdir)/ \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_ipc \ +-I$(top_builddir)/ \ +-DPACKAGE_BIN_DIR=\"$(bindir)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@EVAS_CFLAGS@ \ +@EET_CFLAGS@ \ +@EINA_CFLAGS@ + +CLEANFILES = $(DB) + +#DB = system.db +#$(DB): Makefile +# edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /e/theme/name str "winter" +# edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /e/font/path str "$(pkgdatadir)/data/fonts" +# edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /apps/web/browser str `which firefox 2>/dev/null || which phoenix 2>/dev/null || which mozilla 2>/dev/null || which opera 2>/dev/null || which konqueror 2>/dev/null || which epiphany 2>/dev/null` +# edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /apps/web/email str `which thunderbird 2>/dev/null || which mozilla 2>/dev/null || which kmail 2>/dev/null || which sylpheed 2>/dev/null || which evolution 2>/dev/null` + +lib_LTLIBRARIES = libecore_config.la + +includes_HEADERS = Ecore_Config.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_config_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@ + +#config_DATA = $(DB) +#configdir = $(pkgdatadir) + +libecore_config_la_SOURCES = \ +ecore_config.c \ +ecore_config_util.c \ +ecore_config_storage.c \ +ecore_config_extra.c \ +ecore_config_db.c + +libecore_config_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EET_LIBS@ \ +@EINA_LIBS@ \ +@EVAS_LIBS@ + +if BUILD_ECORE_IPC + +libecore_config_la_SOURCES += \ +ecore_config_ipc_main.c \ +ecore_config_ipc_ecore.c + +libecore_config_la_LIBADD += $(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la + +endif + +EXTRA_DIST = \ +ecore_config_ipc.h \ +ecore_config_private.h \ +ecore_config_util.h diff --git a/libraries/ecore/src/lib/ecore_config/Makefile.in b/libraries/ecore/src/lib/ecore_config/Makefile.in new file mode 100644 index 0000000..1732a34 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_config/Makefile.in @@ -0,0 +1,855 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@BUILD_ECORE_IPC_TRUE@am__append_1 = \ +@BUILD_ECORE_IPC_TRUE@ecore_config_ipc_main.c \ +@BUILD_ECORE_IPC_TRUE@ecore_config_ipc_ecore.c + +@BUILD_ECORE_IPC_TRUE@am__append_2 = $(top_builddir)/src/lib/ecore_ipc/libecore_ipc.la +subdir = src/lib/ecore_config +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_config_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore/libecore.la $(am__append_2) +am__libecore_config_la_SOURCES_DIST = ecore_config.c \ + ecore_config_util.c ecore_config_storage.c \ + ecore_config_extra.c ecore_config_db.c ecore_config_ipc_main.c \ + ecore_config_ipc_ecore.c +@BUILD_ECORE_IPC_TRUE@am__objects_1 = ecore_config_ipc_main.lo \ +@BUILD_ECORE_IPC_TRUE@ ecore_config_ipc_ecore.lo +am_libecore_config_la_OBJECTS = ecore_config.lo ecore_config_util.lo \ + ecore_config_storage.lo ecore_config_extra.lo \ + ecore_config_db.lo $(am__objects_1) +libecore_config_la_OBJECTS = $(am_libecore_config_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_config_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libecore_config_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_config_la_SOURCES) +DIST_SOURCES = $(am__libecore_config_la_SOURCES_DIST) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_ipc \ +-I$(top_srcdir)/ \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_ipc \ +-I$(top_builddir)/ \ +-DPACKAGE_BIN_DIR=\"$(bindir)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@EVAS_CFLAGS@ \ +@EET_CFLAGS@ \ +@EINA_CFLAGS@ + +CLEANFILES = $(DB) + +#DB = system.db +#$(DB): Makefile +# edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /e/theme/name str "winter" +# edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /e/font/path str "$(pkgdatadir)/data/fonts" +# edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /apps/web/browser str `which firefox 2>/dev/null || which phoenix 2>/dev/null || which mozilla 2>/dev/null || which opera 2>/dev/null || which konqueror 2>/dev/null || which epiphany 2>/dev/null` +# edb_ed $(top_builddir)/src/lib/ecore_config/$(DB) add /apps/web/email str `which thunderbird 2>/dev/null || which mozilla 2>/dev/null || which kmail 2>/dev/null || which sylpheed 2>/dev/null || which evolution 2>/dev/null` +lib_LTLIBRARIES = libecore_config.la +includes_HEADERS = Ecore_Config.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_config_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@ + +#config_DATA = $(DB) +#configdir = $(pkgdatadir) +libecore_config_la_SOURCES = ecore_config.c ecore_config_util.c \ + ecore_config_storage.c ecore_config_extra.c ecore_config_db.c \ + $(am__append_1) +libecore_config_la_LIBADD = $(top_builddir)/src/lib/ecore/libecore.la \ + @EET_LIBS@ @EINA_LIBS@ @EVAS_LIBS@ $(am__append_2) +EXTRA_DIST = \ +ecore_config_ipc.h \ +ecore_config_private.h \ +ecore_config_util.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_config/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_config/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_config.la: $(libecore_config_la_OBJECTS) $(libecore_config_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_config_la_LINK) -rpath $(libdir) $(libecore_config_la_OBJECTS) $(libecore_config_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_db.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_extra.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_ipc_ecore.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_ipc_main.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_storage.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_config_util.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config.c b/libraries/ecore/src/lib/ecore_config/ecore_config.c new file mode 100644 index 0000000..e81538e --- /dev/null +++ b/libraries/ecore/src/lib/ecore_config/ecore_config.c @@ -0,0 +1,1870 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include "Ecore_Config.h" +#include "ecore_config_private.h" +#include "ecore_config_ipc.h" + +#include "ecore_config_util.h" +int _ecore_config_log_dom = -1; +int DEBUG = 0; +EAPI Ecore_Config_Server *__ecore_config_server_global = NULL; +EAPI Ecore_Config_Server *__ecore_config_server_local = NULL; +EAPI Ecore_Config_Bundle *__ecore_config_bundle_local = NULL; +EAPI char *__ecore_config_app_name = NULL; +int __ecore_config_system_init = 0; + +static int _ecore_config_system_init_no_load(void); +static int _ecore_config_system_load(void); + +static inline void *__ecore_argb_to_long(int a, int r, int g, int b, long *v); +static inline void *__ecore_argbstr_to_long(const char *argb, long *v); + +static const char *_ecore_config_type[] = + { "undefined", "integer", "float", "string", "colour", "theme", "boolean", "structure" }; + +/** + * @defgroup Ecore_Config_Property_Group Ecore Config Property Functions + * + * Functions that retrieve or set the attributes relating to a property. + */ + +/** + * Removes the given property from the local configuration and destroys it. + * @param e Property to destroy. + * @return @c NULL + * @ingroup Ecore_Config_Property_Group + */ +EAPI Ecore_Config_Prop * +ecore_config_dst(Ecore_Config_Prop * e) +{ + Ecore_Config_Bundle *t; + Ecore_Config_Prop *p, *c; + Ecore_Config_Listener_List *l; + + p = NULL; + t = __ecore_config_bundle_local; + c = t->data; + + if (!e || !e->key) + return NULL; + if (t) + { + if (t->data == e) + t->data = e->next; + else + { + do + { + p = c; + c = c->next; + } + while (c && (c != e)); + if (c) /* remove from list if even in there */ + p->next = c->next; + } + } + + while (e->listeners) + { + l = e->listeners; + e->listeners = e->listeners->next; + free(l); + } + + if (e->key) + free(e->key); + if (e->ptr && ((e->type == ECORE_CONFIG_STR) || (e->type == ECORE_CONFIG_THM))) + free(e->ptr); + + memset(e, 0, sizeof(Ecore_Config_Prop)); + free(e); + + return NULL; +} + +/** + * @defgroup Ecore_Config_Get_Group Configuration Retrieve Functions + * + * Functions that retrieve configuration values, based on type. + */ + +/** + * Returns the property with the given key. + * @param key The unique name of the wanted property. + * @return The property that corresponds to the given key. @c NULL if the + * key could not be found. + * @ingroup Ecore_Config_Get_Group + */ +EAPI Ecore_Config_Prop * +ecore_config_get(const char *key) +{ + Ecore_Config_Bundle *t; + Ecore_Config_Prop *e; + + t = __ecore_config_bundle_local; + if (!t || !key) + return NULL; + e = t->data; + while (e) + { + if (!strcmp(key, e->key)) + return e; + e = e->next; + } + return NULL; +} + +/** + * Returns the type of the property. + * @param e Property to get the type of. + * @returns The type of the property. If the property is invalid, then the + * string "not found" is returned. + * @ingroup Ecore_Config_Property_Group + */ +EAPI const char * +ecore_config_type_get(const Ecore_Config_Prop * e) +{ + if (e) + { + return _ecore_config_type[e->type]; + } + return "not found"; +} + +/** + * Returns the specified property as a string. + * @param key The property key. + * @return The string value of the property. The function returns @c NULL if + * the property is not a string or is not set. + * @ingroup Ecore_Config_Get_Group + */ +EAPI char * +ecore_config_string_get(const char *key) +{ + return _ecore_config_string_get( ecore_config_get(key) ); +} + +char * +_ecore_config_string_get(Ecore_Config_Prop *e) +{ + return (e && (e->type == ECORE_CONFIG_STR) && e->ptr) ? strdup(e->ptr) : NULL; +} + +/** + * Returns the specified property as an integer. + * @param key The property key. + * @return The value of the property. The function returns -1 if the + * property is not an integer or is not set. + * @ingroup Ecore_Config_Get_Group + */ +EAPI int +ecore_config_boolean_get(const char *key) +{ + return _ecore_config_boolean_get( ecore_config_get(key) ); +} + +int +_ecore_config_boolean_get(Ecore_Config_Prop *e) +{ + return (e && ((e->type == ECORE_CONFIG_INT) || (e->type == ECORE_CONFIG_BLN))) ? (e->val != 0) : -1; +} + +/** + * Returns the specified property as a long integer. + * @param key The property key. + * @return The integer value of the property. The function returns 0 if the + * property is not an integer or is not set. + * @ingroup Ecore_Config_Get_Group + */ +EAPI long +ecore_config_int_get(const char *key) +{ + return _ecore_config_int_get( ecore_config_get(key) ); +} + +long +_ecore_config_int_get(Ecore_Config_Prop *e) +{ + return (e && ((e->type == ECORE_CONFIG_INT) || (e->type == ECORE_CONFIG_RGB))) ? e->val : 0L; +} + +/** + * Returns the specified property as a float. + * @param key The property key. + * @return The float value of the property. The function returns 0.0 if the + * property is not a float or is not set. + * @ingroup Ecore_Config_Get_Group + */ +EAPI float +ecore_config_float_get(const char *key) +{ + return _ecore_config_float_get( ecore_config_get(key) ); +} + +float +_ecore_config_float_get(Ecore_Config_Prop *e) +{ + return (e && (e->type == ECORE_CONFIG_FLT)) ? ((float)e->val / ECORE_CONFIG_FLOAT_PRECISION) : 0.0; +} + +/** + * Finds the alpha, red, green and blue values of a color property. + * @param key The property key. + * @param a A pointer to an integer to store the alpha value into. + * @param r A pointer to an integer to store the red value into. + * @param g A pointer to an integer to store the green value into. + * @param b A pointer to an integer to store the blue value into. + * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_FAIL + * otherwise. + * @ingroup Ecore_Config_Get_Group + */ +EAPI int +ecore_config_argb_get(const char *key, int *a, int *r, int *g, int *b) +{ + return _ecore_config_argb_get( ecore_config_get(key), a, r, g, b); +} + +int +_ecore_config_argb_get(Ecore_Config_Prop *e, int *a, int *r, int *g, int *b) +{ + if (e && ((e->type == ECORE_CONFIG_RGB))) + { + if(a) *a = (e->val >> 24) & 0xff; + if(r) *r = (e->val >> 16) & 0xff; + if(g) *g = (e->val >> 8) & 0xff; + if(b) *b = e->val & 0xff; + return ECORE_CONFIG_ERR_SUCC; + } + return ECORE_CONFIG_ERR_FAIL; +} + +/** + * Returns a color property as a long + * @param key The property key. + * @return ARGB data as long + * @ingroup Ecore_Config_Get_Group + */ +EAPI long +ecore_config_argbint_get(const char *key) +{ + return _ecore_config_argbint_get( ecore_config_get(key) ); +} + +long +_ecore_config_argbint_get(Ecore_Config_Prop *e) +{ + if (e && ((e->type == ECORE_CONFIG_RGB))) + { + return e->val; + } + return 0L; +} + +/** + * Returns a color property as a string of hexadecimal characters. + * @param key The property key. + * @return A string of hexadecimal characters in the format #aarrggbb. + * @ingroup Ecore_Config_Get_Group + */ +EAPI char * +ecore_config_argbstr_get(const char *key) +{ + return _ecore_config_argbstr_get( ecore_config_get(key) ); +} + +char * +_ecore_config_argbstr_get(Ecore_Config_Prop *e) +{ + char *r; + + r = NULL; + esprintf(&r, "#%08x", _ecore_config_int_get(e)); + return r; +} + +/** + * Returns a theme property. + * @param key The property key. + * @return The name of the theme the property refers to. The function returns + * @c NULL if the property is not a theme or is not set. + * @ingroup Ecore_Config_Get_Group + */ +EAPI char * +ecore_config_theme_get(const char *key) +{ + return _ecore_config_theme_get( ecore_config_get(key) ); +} + +char * +_ecore_config_theme_get(Ecore_Config_Prop *e) +{ + return (e && (e->type == ECORE_CONFIG_THM)) ? strdup(e->ptr) : NULL; +} + +/** + * Retrieves the key as a string. + * @param key The property key. + * @return Returns a character array in the form of 'key:type=value'. @c NULL + * is returned if the property does not exist. + * @ingroup Ecore_Config_Get_Group + */ +EAPI char * +ecore_config_as_string_get(const char *key) +{ + Ecore_Config_Prop *e; + char *val; + char *r; + + val = NULL; + r = NULL; + if (!(e = ecore_config_get(key))) + ERR("no such property, \"%s\"...", key); + else + { + switch (e->type) + { + case ECORE_CONFIG_NIL: + val = strdup(""); + break; + case ECORE_CONFIG_INT: + esprintf(&val, "%ld", _ecore_config_int_get(e)); + break; + case ECORE_CONFIG_BLN: + esprintf(&val, "%ld", _ecore_config_boolean_get(e)); + break; + case ECORE_CONFIG_FLT: + esprintf(&val, "%lf", _ecore_config_float_get(e)); + break; + case ECORE_CONFIG_STR: + esprintf(&val, "\"%s\"", _ecore_config_string_get(e)); + break; + case ECORE_CONFIG_RGB: + esprintf(&val, "#%08x", _ecore_config_int_get(e)); + break; + case ECORE_CONFIG_THM: + esprintf(&val, "\"%s\"", _ecore_config_theme_get(e)); + break; + case ECORE_CONFIG_SCT: + break; + default: + esprintf(&r, "%s:unknown_type", key); + break; + } + if (val) + { + esprintf(&r, "%s:%s=%s", key, _ecore_config_type[e->type], val); + free(val); + } + } + return r; +} + +EAPI int +ecore_config_bound(Ecore_Config_Prop * e) +{ + int ret; + long v; + + ret = ECORE_CONFIG_ERR_SUCC; + + if (!e) + return ECORE_CONFIG_ERR_FAIL; + if (e->flags & ECORE_CONFIG_FLAG_BOUNDS) + { + if ((e->val < e->lo)) + { + WRN("ecore_config_bounds(\"%s\",%ld): value out of range; adjusted to %ld...", + e->key, e->val, e->lo); + e->val = e->lo; + } + else if ((e->val > e->hi)) + { + WRN("ecore_config_bounds(\"%s\",%ld): value out of range; adjusted to %ld...", + e->key, e->val, e->hi); + e->val = e->hi; + } + else + ret = ECORE_CONFIG_ERR_IGNORED; + } + else + ret = ECORE_CONFIG_ERR_IGNORED; + + if (e->step) + { + v = ((int)(e->val / e->step)) * e->step; + if (v != e->val) + { + if (e->type == ECORE_CONFIG_FLT) + WRN("ecore_config_bound(\"%s\"): float value %f not a multiple of %f, adjusted to %f...", + e->key, ((double)e->val) / ECORE_CONFIG_FLOAT_PRECISION, + ((double)e->step) / ECORE_CONFIG_FLOAT_PRECISION, + ((double)v) / ECORE_CONFIG_FLOAT_PRECISION); + else + WRN("ecore_config_bound(\"%s\"): integer value %ld not a multiple of %ld, adjusted to %ld...", + e->key, e->val, e->step, v); + ret = ECORE_CONFIG_ERR_SUCC; + e->val = v; + } + } + + return ret; +} + +/** + * Tries to guess the type of a property. + * + * This function first checks to see if the property exists. If it does, then + * the type of the stored property is returned. Otherwise, the function tries + * to guess the type of the property based on @p val. + * + * @param key The property key. + * @param val The value in string form. + * @return The type of the property determined by the function. Note that if + * val is @c NULL, @c ECORE_CONFIG_NIL will be returned. + */ +EAPI int +ecore_config_type_guess(const char *key, const char *val) +{ + Ecore_Config_Prop *p; + char *l; + + l = NULL; + + if (key && (p = ecore_config_get(key)) && p->type != ECORE_CONFIG_NIL) + return p->type; + + if (!val) + return ECORE_CONFIG_NIL; + if (val[0] == '#') + return ECORE_CONFIG_RGB; + strtol(val, &l, 10); + if (*l) + { + float f; + + if (sscanf(val, "%f%*s", &f) != 1) + return ECORE_CONFIG_STR; + return ECORE_CONFIG_FLT; + } + return ECORE_CONFIG_INT; +} + +static int +ecore_config_typed_val(Ecore_Config_Prop * e, const void *val, int type) +{ + + if (!e) + return ECORE_CONFIG_ERR_NODATA; + + if (!(val) && (type != ECORE_CONFIG_NIL && type != ECORE_CONFIG_SCT)) + e->ptr = NULL; + else + { + if (type == ECORE_CONFIG_INT || type == ECORE_CONFIG_BLN) + { + e->val = (long) *((int *)val); + e->type = type; + } + else if (type == ECORE_CONFIG_STR || type == ECORE_CONFIG_THM) + { + if (!(e->ptr = strdup(val))) + return ECORE_CONFIG_ERR_OOM; + if (e->type == ECORE_CONFIG_NIL) + e->type = type; + } + else if (type == ECORE_CONFIG_RGB) + { + __ecore_argbstr_to_long((char *)val, &e->val); + e->type = ECORE_CONFIG_RGB; + } + else if (type == ECORE_CONFIG_FLT) + { + e->val = (long) ((*((float *)val)) * ECORE_CONFIG_FLOAT_PRECISION); + e->type = ECORE_CONFIG_FLT; + } + else if (type == ECORE_CONFIG_SCT) + { + e->type = ECORE_CONFIG_SCT; + } + else + { + e->type = ECORE_CONFIG_NIL; + } + + ecore_config_bound(e); + e->flags |= ECORE_CONFIG_FLAG_MODIFIED; + e->flags &= ~ECORE_CONFIG_FLAG_CMDLN; + return ECORE_CONFIG_ERR_SUCC; + } + return ECORE_CONFIG_ERR_IGNORED; +} + +static int +ecore_config_typed_add(const char *key, const void *val, int type) +{ + int error = ECORE_CONFIG_ERR_SUCC; + Ecore_Config_Prop *e = NULL; + Ecore_Config_Bundle *t; + + t = __ecore_config_bundle_local; + if (!key) + return ECORE_CONFIG_ERR_NODATA; + + if (!(e = calloc(1, sizeof(Ecore_Config_Prop)))) + { + return ECORE_CONFIG_ERR_OOM; + } + else if (!(e->key = strdup(key))) + { + error = ECORE_CONFIG_ERR_OOM; + } + else if ((error = ecore_config_typed_val(e, val, type)) == ECORE_CONFIG_ERR_SUCC) + { + if (t) + { + e->next = t->data; + t->data = e; + } + return ECORE_CONFIG_ERR_SUCC; + } + + if(e->key) + free(e->key); + if(e) + free(e); + + if (error == ECORE_CONFIG_ERR_SUCC) + error = ECORE_CONFIG_ERR_FAIL; + + return error; +} + +static int +ecore_config_add(const char *key, const char *val) +{ + int type; + + type = ecore_config_type_guess(key, val); + return ecore_config_typed_add(key, val, type); +} + +/** + * Sets the description field of the indicated property. + * @param key The property key. + * @param desc Description string. + * @note The description string is copied for the property's use. You can + * free @p desc once this function is called. + * @ingroup Ecore_Config_Property_Group + */ +EAPI int +ecore_config_describe(const char *key, const char *desc) +{ + Ecore_Config_Prop *e; + + if (!(e = ecore_config_get(key))) + return ECORE_CONFIG_ERR_NODATA; + e->description = strdup(desc); + return ECORE_CONFIG_ERR_SUCC; +} + +/** + * Set the short option character of a property. + * @param key The property key. + * @param short_opt Character used to indicate the value of a property + * given on the command line. + * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA + * is returned if the property does not exist. + * @ingroup Ecore_Config_Property_Group + */ +EAPI int +ecore_config_short_opt_set(const char *key, char short_opt) +{ + Ecore_Config_Prop *e; + + if (!(e = ecore_config_get(key))) + return ECORE_CONFIG_ERR_NODATA; + e->short_opt = short_opt; + return ECORE_CONFIG_ERR_SUCC; +} + +/** + * Set the long option string of the property. + * @param key The property key. + * @param long_opt String used to indicate the value of a property given + * on the command line. + * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA + * is returned if the property does not exist. + * @ingroup Ecore_Config_Property_Group + */ +EAPI int +ecore_config_long_opt_set(const char *key, const char *long_opt) +{ + Ecore_Config_Prop *e; + + if (!(e = ecore_config_get(key))) + return ECORE_CONFIG_ERR_NODATA; + if (e->long_opt) + free(e->long_opt); + if (long_opt) + e->long_opt = strdup(long_opt); + return ECORE_CONFIG_ERR_SUCC; +} + +static void +_ecore_config_listener_fire(Ecore_Config_Prop *prop) +{ + Ecore_Config_Listener_List *l; + for (l = prop->listeners; l; l = l->next) + l->listener(prop->key, prop->type, l->tag, l->data); + + /* fire change listeners for the generic struct container etc */ + if (prop->parent) + _ecore_config_listener_fire(prop->parent); +} + +/** + * Sets the indicated property to the given value and type. + * @param key The property key. + * @param val A pointer to the value to set the property to. + * @param type The type of the property. + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Property_Group + */ +EAPI int +ecore_config_typed_set(const char *key, const void *val, int type) +{ + Ecore_Config_Prop *e; + int ret; + + if (!key) + return ECORE_CONFIG_ERR_NODATA; +/* if (!t) { * global prop * + e=ecore_config_get(key); + if (e) + for(l=e->listeners;l;l=l->next) + l->listener(e->key,e->type,l->tag,l->data,t); + return ECORE_CONFIG_ERR_SUCC; + } +*/ + if (!(e = ecore_config_get(key))) + return ecore_config_typed_add(key, val, type); + + if ((ret = ecore_config_typed_val(e, val, type)) == ECORE_CONFIG_ERR_SUCC) + { + _ecore_config_listener_fire(e); + } + else + { + ERR("ecore_config_typed_set(\"%s\"): ecore_config_typed_val() failed: %d", + key, ret); + } + + return ret; +} + +/** + * @defgroup Ecore_Config_Set_Group Ecore Config Setters + * + * Functions that set the value of a property. + */ + +/** + * Sets the indicated property to the value indicated by @a val. + * @param key The property key. + * @param val String representation of value to set. + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Set_Group + */ +EAPI int +ecore_config_set(const char *key, const char *val) +{ + int type; + int tmpi; + float tmpf; + long tmpl; + + type = ecore_config_type_guess(key, val); + if (type == ECORE_CONFIG_INT || type == ECORE_CONFIG_BLN) + { + tmpi = atoi(val); + return ecore_config_typed_set(key, &tmpi, type); + } + else if (type == ECORE_CONFIG_FLT) + { + tmpf = atof(val); + return ecore_config_typed_set(key, &tmpf, type); + } + else if (type == ECORE_CONFIG_RGB) + { + __ecore_argbstr_to_long(val, &tmpl); + return ecore_config_typed_set(key, &tmpl, type); + } + else + return ecore_config_typed_set(key, val, type); +} + +/** + * Sets the indicated property to the value given in the string. + * @param key The property key. + * @param val String representation of the value. + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Set_Group + */ +EAPI int +ecore_config_as_string_set(const char *key, const char *val) +{ + return ecore_config_set(key, val); +} + +/** + * Sets the indicated property to the given boolean. + * @param key The property key. + * @param val Boolean integer to set the property to. + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Set_Group + */ +EAPI int +ecore_config_boolean_set(const char *key, int val) +{ + val = val ? 1 : 0; + return ecore_config_typed_set(key, &val, ECORE_CONFIG_BLN); +} + +/** + * Sets the indicated property to the given integer. + * @param key The property key. + * @param val Integer to set the property to. + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Set_Group + */ +EAPI int +ecore_config_int_set(const char *key, int val) +{ + return ecore_config_typed_set(key, &val, ECORE_CONFIG_INT); +} + +/** + * Sets the indicated property to the given string. + * @param key The property key. + * @param val String to set the property to. + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Set_Group + */ +EAPI int +ecore_config_string_set(const char *key, const char *val) +{ + return ecore_config_typed_set(key, val, ECORE_CONFIG_STR); +} + +/** + * Sets the indicated property to the given float value. + * @param key The property key. + * @param val Float to set the property to. + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Set_Group + */ +EAPI int +ecore_config_float_set(const char *key, float val) +{ + return ecore_config_typed_set(key, &val, ECORE_CONFIG_FLT); +} + +/** + * Sets the indicated property to a color value. + * @param key The property key + * @param a integer 0..255 + * @param r integer 0..255 + * @param g integer 0..255 + * @param b integer 0..255 + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Set_Group + */ +EAPI int +ecore_config_argb_set(const char *key, int a, int r, int g, int b) +{ + long v = 0; + return ecore_config_typed_set(key, __ecore_argb_to_long(a,r,g,b, &v), ECORE_CONFIG_RGB); +} + +/** + * Sets the indicated property to a color value. + * @param key The property key + * @param argb ARGB data as long + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Set_Group + */ +EAPI int +ecore_config_argbint_set(const char *key, long argb) +{ + return ecore_config_typed_set(key, &argb, ECORE_CONFIG_RGB); +} + +/** + * Sets the indicated property to a color value. + * @param key The property key + * @param val Color value in ARGB format. + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Set_Group + */ +EAPI int +ecore_config_argbstr_set(const char *key, const char *val) +{ + long v = 0; + return ecore_config_typed_set(key, __ecore_argbstr_to_long(val, &v), ECORE_CONFIG_RGB); +} + +/** + * Sets the indicated property to a theme name. + * @param key The property key. + * @param val String giving the name of the theme. + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Set_Group + */ +EAPI int +ecore_config_theme_set(const char *key, const char *val) +{ + return ecore_config_typed_set(key, val, ECORE_CONFIG_THM); +} + +/** + * Sets the theme preview group of an indicated property. + * @param key The property key. + * @param group The group name. + * @return @c ECORE_CONFIG_ERR_SUCC on success. + * @ingroup Ecore_Config_Set_Group + */ +EAPI int +ecore_config_theme_preview_group_set(const char *key, const char *group) +{ + int ret; + Ecore_Config_Prop *e; + + ret = ECORE_CONFIG_ERR_SUCC; + if (!(e = ecore_config_get(key))) + { /* prop doesn't exist yet */ + if ((ret = ecore_config_typed_add(key, "", ECORE_CONFIG_THM)) != ECORE_CONFIG_ERR_SUCC) /* try to add it */ + return ret; /* ...failed */ + if (!(e = ecore_config_get(key))) /* get handle */ + return ECORE_CONFIG_ERR_FAIL; + } + if (e->data) + free(e->data); + e->data = strdup(group); + + return ret; +} + +EAPI int +ecore_config_typed_default(const char *key, const void *val, int type) +{ + int ret; + Ecore_Config_Prop *e; + + ret = ECORE_CONFIG_ERR_SUCC; + + if (!(e = ecore_config_get(key))) + { /* prop doesn't exist yet */ + if ((ret = ecore_config_typed_add(key, val, type)) != ECORE_CONFIG_ERR_SUCC) /* try to add it */ + return ret; /* ...failed */ + if (!(e = ecore_config_get(key))) /* get handle */ + return ECORE_CONFIG_ERR_FAIL; + e->flags = e->flags & ~ECORE_CONFIG_FLAG_MODIFIED; + } + else if (!(e->flags & ECORE_CONFIG_FLAG_MODIFIED) && !(e->flags & ECORE_CONFIG_FLAG_SYSTEM)) + { + ecore_config_typed_set(key, val, type); + if (!(e = ecore_config_get(key))) /* get handle */ + return ECORE_CONFIG_ERR_FAIL; + e->flags = e->flags & ~ECORE_CONFIG_FLAG_MODIFIED; + } + return ret; +} + +/** + * @defgroup Ecore_Config_Default_Group Ecore Config Defaults + * + * Functions that are used to set the default values of properties. + */ + +/** + * Sets the indicated property if it has not already been set or loaded. + * @param key The property key. + * @param val Default value of the key. + * @param lo Lowest valid value for the key. + * @param hi Highest valid value for the key. + * @param step Used by integer and float values. + * @return @c ECORE_CONFIG_ERR_SUCC if there are no errors. + * @note The @p lo, @p hi and @p step parameters are only used when storing + * integer and float properties. + * @ingroup Ecore_Config_Default_Group + */ +EAPI int +ecore_config_default(const char *key, const char *val, float lo, float hi, float step) +{ + int ret, type; + Ecore_Config_Prop *e; + + type = ecore_config_type_guess(key, val); + ret = ecore_config_typed_default(key, val, type); + e = ecore_config_get(key); + if (e) + { + if (type == ECORE_CONFIG_INT) + { + e->step = step; + e->flags |= ECORE_CONFIG_FLAG_BOUNDS; + e->lo = lo; + e->hi = hi; + ecore_config_bound(e); + } + else if (type == ECORE_CONFIG_FLT) + { + e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION); + e->flags |= ECORE_CONFIG_FLAG_BOUNDS; + e->lo = (int)(lo * ECORE_CONFIG_FLOAT_PRECISION); + e->hi = (int)(hi * ECORE_CONFIG_FLOAT_PRECISION); + ecore_config_bound(e); + } + } + + return ret; +} + +/** + * Sets the indicated property to the given boolean if the property has not yet + * been set. + * @param key The property key. + * @param val Boolean Integer to set the value to. + * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems. + * @ingroup Ecore_Config_Default_Group + */ +EAPI int +ecore_config_boolean_default(const char *key, int val) +{ + val = val ? 1 : 0; + return ecore_config_typed_default(key, &val, ECORE_CONFIG_BLN); +} + +/** + * Sets the indicated property to the given integer if the property has not yet + * been set. + * @param key The property key. + * @param val Integer to set the value to. + * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems. + * @ingroup Ecore_Config_Default_Group + */ +EAPI int +ecore_config_int_default(const char *key, int val) +{ + return ecore_config_typed_default(key, &val, ECORE_CONFIG_INT); +} + +/** + * Sets the indicated property to the given integer if the property has not yet + * been set. + * + * The bounds and step values are set regardless. + * + * @param key The property key. + * @param val Integer to set the property to. + * @param low Lowest valid integer value for the property. + * @param high Highest valid integer value for the property. + * @param step Increment value for the property. + * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems. + * @ingroup Ecore_Config_Default_Group + */ +EAPI int +ecore_config_int_default_bound(const char *key, int val, int low, int high, + int step) +{ + Ecore_Config_Prop *e; + int ret; + + ret = ecore_config_typed_default(key, &val, ECORE_CONFIG_INT); + e = ecore_config_get(key); + if (e) + { + e->step = step; + e->flags |= ECORE_CONFIG_FLAG_BOUNDS; + e->lo = low; + e->hi = high; + ecore_config_bound(e); + } + + return ret; +} + +/** + * Sets the indicated property to the given string if the property has not yet + * been set. + * @param key The property key. + * @param val String to set the property to. + * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems. + * @ingroup Ecore_Config_Default_Group + */ +EAPI int +ecore_config_string_default(const char *key, const char *val) +{ + return ecore_config_typed_default(key, val, ECORE_CONFIG_STR); +} + +/** + * Sets the indicated property to the given float if the property has not yet + * been set. + * @param key The property key. + * @param val Float to set the property to. + * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems. + * @ingroup Ecore_Config_Default_Group + */ +EAPI int +ecore_config_float_default(const char *key, float val) +{ + return ecore_config_typed_default(key, &val, ECORE_CONFIG_FLT); +} + +/** + * Sets the indicated property to the given float if the property has not yet + * been set. + * + * The bounds and step values are set regardless. + * + * @param key The property key. + * @param val Float to set the property to. + * @param low Lowest valid integer value for the property. + * @param high Highest valid float value for the property. + * @param step Increment value for the property. + * @return @c ECORE_CONFIG_ERR_SUCC if there were no problems. + * @ingroup Ecore_Config_Default_Group + */ +EAPI int +ecore_config_float_default_bound(const char *key, float val, float low, + float high, float step) +{ + Ecore_Config_Prop *e; + int ret; + + ret = ecore_config_typed_default(key, &val, ECORE_CONFIG_FLT); + e = ecore_config_get(key); + if (e) + { + e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION); + e->flags |= ECORE_CONFIG_FLAG_BOUNDS; + e->lo = (int)(low * ECORE_CONFIG_FLOAT_PRECISION); + e->hi = (int)(high * ECORE_CONFIG_FLOAT_PRECISION); + ecore_config_bound(e); + } + + return ret; +} + +/** + * Sets the indicated property to a color value if the property has not yet + * been set. + * @param key The property key. + * @param a integer 0..255 + * @param r integer 0..255 + * @param g integer 0..255 + * @param b integer 0..255 + * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems. + * @ingroup Ecore_Config_Default_Group + */ +EAPI int +ecore_config_argb_default(const char *key, int a, int r, int g, int b) +{ + long v = 0; + return ecore_config_typed_default(key, __ecore_argb_to_long(a,r,g,b, &v), ECORE_CONFIG_RGB); +} + +/** + * Sets the indicated property to a color value if the property has not yet + * been set. + * @param key The property key. + * @param argb ARGB data as long + * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems. + * @ingroup Ecore_Config_Default_Group + */ +EAPI int +ecore_config_argbint_default(const char *key, long argb) +{ + return ecore_config_typed_default(key, &argb, ECORE_CONFIG_RGB); +} + +/** + * Sets the indicated property to a color value if the property has not yet + * been set. + * @param key The property key. + * @param val Color value in ARGB format. + * @return @c ECORE_CONFIG_ERR_SUCC if there are no problems. + * @ingroup Ecore_Config_Default_Group + */ +EAPI int +ecore_config_argbstr_default(const char *key, const char *val) +{ + long v = 0; + return ecore_config_typed_default(key, __ecore_argbstr_to_long(val, &v), ECORE_CONFIG_RGB); +} + +/** + * Sets the indicated property to a theme name if the property has not yet + * been set. + * @param key The property key. + * @param val String giving the name of the theme. + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Default_Group + */ +EAPI int +ecore_config_theme_default(const char *key, const char *val) +{ + return ecore_config_typed_default(key, val, ECORE_CONFIG_THM); +} + +/** + * @defgroup Ecore_Config_Struct_Group Ecore Config Structures + * + * Functions that are used to create structures of properties. + */ + +/** + * Sets the indicated property to a structure if the property has not yet + * been set. + * @param key The property key. + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Struct_Group + */ +EAPI int +ecore_config_struct_create(const char *key) +{ + WRN("you are using ecore_config structures. These are very young"); + WRN(" and not complete - you have been warned"); + + return ecore_config_typed_default(key, NULL, ECORE_CONFIG_SCT); +} + +static int +_ecore_config_struct_append(Ecore_Config_Prop *sct, Ecore_Config_Prop *add) +{ + Eina_List *l; + + if (!sct || !add || sct->type != ECORE_CONFIG_SCT) + return ECORE_CONFIG_ERR_IGNORED; + + l = sct->data; + sct->data = eina_list_append(l, add); + add->parent = sct; + + return ECORE_CONFIG_ERR_SUCC; +} + +static int +_ecore_config_struct_typed_add(const char *key, const char *name, const void *val, + int type) +{ + char *subkey; + int ret; + + subkey = malloc((strlen(key) + strlen(name) + 2) * sizeof(char)); + strcpy(subkey, key); + strcat(subkey, "."); + strcat(subkey, name); + + ecore_config_typed_default(subkey, val, type); + ret = _ecore_config_struct_append(ecore_config_get(key), + ecore_config_get(subkey)); + free(subkey); + return ret; +} + +/** + * Add an int property to the named structure. The property is set if it has not + * yet been set. + * @param key The key of the structure to add to. + * @param name The name of the item to add - this will be appended to the key + * @param val the int to default to + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Struct_Group + */ +EAPI int +ecore_config_struct_int_add(const char *key, const char *name, int val) +{ + return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_INT); +} + +/** + * Add a float property to the named structure. The property is set if it has + * not yet been set. + * @param key The key of the structure to add to. + * @param name The name of the item to add - this will be appended to the key + * @param val The float to default to + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Struct_Group + */ +EAPI int +ecore_config_struct_float_add(const char *key, const char *name, float val) +{ + return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_FLT); +} + +/** + * Add a string property to the named structure. The property is set if it has + * not yet been set. + * @param key The key of the structure to add to. + * @param name The name of the item to add - this will be appended to the key + * @param val The string to default to + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Struct_Group + */ +EAPI int +ecore_config_struct_string_add(const char *key, const char *name, const char* val) +{ + return _ecore_config_struct_typed_add(key, name, val, ECORE_CONFIG_STR); +} + +/** + * Add an argb property to the named structure. The property is set if it has + * not yet been set. + * @param key The key of the structure to add to. + * @param name The name of the item to add - this will be appended to the key + * @param a The alpha to default to + * @param r The red to default to + * @param g The green to default to + * @param b The blue to default to + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Struct_Group + */ +EAPI int +ecore_config_struct_argb_add(const char *key, const char *name, int a, int r, + int g, int b) +{ + long argb; + + __ecore_argb_to_long(a, r, g, b, &argb); + return _ecore_config_struct_typed_add(key, name, &argb, ECORE_CONFIG_RGB); +} + +/** + * Add a theme property to the named structure. The property is set if it has + * not yet been set. + * @param key The key of the structure to add to. + * @param name The name of the item to add - this will be appended to the key + * @param val The theme name to default to + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Struct_Group + */ +EAPI int +ecore_config_struct_theme_add(const char *key, const char *name, const char* val) +{ + return _ecore_config_struct_typed_add(key, name, val, ECORE_CONFIG_THM); +} + +/** + * Add a boolean property to the named structure. The property is set if it has + * not yet been set. + * @param key The key of the structure to add to. + * @param name The name of the item to add - this will be appended to the key + * @param val The boolean to default to + * @return @c ECORE_CONFIG_ERR_SUCC if the property is set successfully. + * @ingroup Ecore_Config_Struct_Group + */ +EAPI int +ecore_config_struct_boolean_add(const char *key, const char *name, int val) +{ + val = val ? 1 : 0; + return _ecore_config_struct_typed_add(key, name, &val, ECORE_CONFIG_BLN); +} + +/** + * Get the contents of a defined structure property and load it into the passed + * C struct + * @param key The name of the structure property to look up. + * @param data The struct to write into. + * @return @c ECORE_CONFIG_ERR_SUCC if the structure is written successfully. + * @ingroup Ecore_Config_Struct_Group + */ +EAPI int +ecore_config_struct_get(const char *key, void *data) +{ + Ecore_Config_Prop *e, *f; + Eina_List *l; + unsigned char *ptr; + long argb; + + e = ecore_config_get(key); + if (!e) + return ECORE_CONFIG_ERR_NODATA; + + l = e->data; + ptr = data; + while (l) + { + f = (Ecore_Config_Prop *) l->data; + switch (f->type) + { + case ECORE_CONFIG_INT: + *((int *) ptr) = _ecore_config_int_get(f); + ptr += sizeof(int); + break; + case ECORE_CONFIG_BLN: + *((int *) ptr) = _ecore_config_boolean_get(f); + ptr += sizeof(int); + break; + case ECORE_CONFIG_FLT: + *((float *) ptr) = _ecore_config_float_get(f); + ptr += sizeof(float); + break; + case ECORE_CONFIG_STR: + case ECORE_CONFIG_THM: + *((char **) ptr) = _ecore_config_string_get(f); + ptr += sizeof(char *); + break; + case ECORE_CONFIG_RGB: + argb = _ecore_config_argbint_get(f); + *((int *) ptr) = (argb >> 24) & 0xff; + ptr += sizeof(int); + *((int *) ptr) = (argb >> 16) & 0xff; + ptr += sizeof(int); + *((int *) ptr) = (argb >> 8) & 0xff; + ptr += sizeof(int); + *((int *) ptr) = argb & 0xff; + ptr += sizeof(int); + break; + default: + WRN("ARGH - STRUCT coding not implemented yet"); + } + l = eina_list_next(l); + } + return ECORE_CONFIG_ERR_SUCC; +} + +/** + * @defgroup Ecore_Config_Listeners_Group Ecore Config Listeners + * + * Functions that set and unset property listener callbacks. + */ + +/** + * Adds a callback function to the list of functions called when a property + * changes. + * @param name Name of the callback. + * @param key The key of the property to listen to. + * @param listener Listener callback function. + * @param tag Tag to pass to @p listener when it is called. + * @param data Data to pass to @p listener when it is called. + * @return @c ECORE_CONFIG_ERR_SUCC if successful in setting up the callback. + * @ingroup Ecore_Config_Listeners_Group + */ +EAPI int +ecore_config_listen(const char *name, const char *key, + Ecore_Config_Listener listener, int tag, void *data) +{ + Ecore_Config_Prop *e; + Ecore_Config_Listener_List *l; + + if (!key) + return ECORE_CONFIG_ERR_NODATA; + + if (!(e = ecore_config_get(key))) + { + int ret = ecore_config_add(key, ""); + + if (ret != ECORE_CONFIG_ERR_SUCC) + { + ERR("ecore_config_listen: ecore_config_add(\"%s\") failed: %d", + key, ret); + return ret; + } + if (!(e = ecore_config_get(key))) + { + ERR("ecore_config_listen: list of properties corrupted!?"); + return ECORE_CONFIG_ERR_FAIL; + } + } + + for (l = e->listeners; l; l = l->next) + if (!strcmp(l->name, name) || (l->listener == listener)) + { + ERR("ecore_config_listen: %s is already listening for changes of %s...", + name, key); + return ECORE_CONFIG_ERR_IGNORED; + } + + if (!(l = malloc(sizeof(Ecore_Config_Listener_List)))) + return ECORE_CONFIG_ERR_OOM; + + ERR("registering listener \"%s\" for \"%s\" (%d)...", name, key, e->type); + + memset(l, 0, sizeof(Ecore_Config_Listener_List)); + + l->listener = listener; + l->name = name; + l->data = data; + l->tag = tag; + l->next = e->listeners; + e->listeners = l; + + if (e->type != ECORE_CONFIG_NIL) /* call right on creation if prop exists and has val */ + listener(key, e->type, tag, data); + + return ECORE_CONFIG_ERR_SUCC; +} + +/** + * Removes a listener callback. + * @param name Name of the callback to remove. + * @param key The property key the callback is listening to. + * @param listener The callback function to remove. + * @return @c ECORE_CONFIG_ERR_SUCC if successful in removing the callback. + * If no callback matches the given parameters, then + * @c ECORE_CONFIG_ERR_NOTFOUND is returned. If @c NULL is passed + * for the key pointer, @c ECORE_CONFIG_ERR_NODATA is returned. + * @ingroup Ecore_Config_Listeners_Group + */ +EAPI int +ecore_config_deaf(const char *name, const char *key, + Ecore_Config_Listener listener) +{ + Ecore_Config_Prop *e; + Ecore_Config_Listener_List *l, *p; + int ret; + + ret = ECORE_CONFIG_ERR_NOTFOUND; + + if (!key) + return ECORE_CONFIG_ERR_NODATA; + + if (!(e = ecore_config_get(key))) + return ECORE_CONFIG_ERR_NOTFOUND; + + for (p = NULL, l = e->listeners; l; p = l) + { + Ecore_Config_Listener_List *nl; + + nl = l->next; + if ((name && !strcmp(l->name, name)) || (l->listener == listener)) + { + ret = ECORE_CONFIG_ERR_SUCC; + if (!p) + e->listeners = e->listeners->next; + else + p->next = l->next; + memset(l, 0, sizeof(Ecore_Config_Listener)); + free(l); + } + l = nl; + } + + return ret; +} + +/** + * Locates the first configuration bundle on the given server. + * @param srv The configuration server. + * @return Pointer to the first configuration bundle. + */ +EAPI Ecore_Config_Bundle * +ecore_config_bundle_1st_get(Ecore_Config_Server * srv) +{ /* anchor: global, but read-only */ + return srv->bundles; +} + +/** + * Locates the configuration bundle after the given one. + * @param ns The configuration bundle. + * @return The next configuration bundle. + */ +EAPI Ecore_Config_Bundle * +ecore_config_bundle_next_get(Ecore_Config_Bundle * ns) +{ + return ns ? ns->next : NULL; +} + +/** + * Locates a configuration bundle on a configuration server based on its serial + * number. + * @param srv The configuration server. + * @param serial Serial number. + * @return The configuration bundle with the given serial number. + */ +EAPI Ecore_Config_Bundle * +ecore_config_bundle_by_serial_get(Ecore_Config_Server * srv, long serial) +{ + Ecore_Config_Bundle *eb; + + eb = srv->bundles; + + if (serial < 0) + return NULL; + else if (serial == 0) + { + Ecore_Config_Bundle *r = eb; + + return r; + } + + while (eb) + { + if (eb->serial == serial) + return eb; + eb = eb->next; + } + return NULL; +} + +/** + * Gets the Ecore_Config_Bundle with the given identifier from the given + * server. + * @param srv The configuration server. + * @param label The bundle's identifier string. + * @return The bundle with the given identifier string, or @c NULL if it + * could not be found. + */ +EAPI Ecore_Config_Bundle * +ecore_config_bundle_by_label_get(Ecore_Config_Server * srv, const char *label) +{ + Ecore_Config_Bundle *ns; + + ns = srv->bundles; + + while (ns) + { + if (ns->identifier && !strcmp(ns->identifier, label)) + return ns; + ns = ns->next; + } + return NULL; +} + +/** + * Retrieves the bundle's serial number. + * @param ns The configuration bundle. + * @return The bundle's identifier string, or -1 if ns is @c NULL. + */ +EAPI long +ecore_config_bundle_serial_get(Ecore_Config_Bundle * ns) +{ + return ns ? ns->serial : -1; +} + +/** + * Retrieves the bundle's identifier. + * @param ns The configuration bundle. + * @return The bundle's identifer string. + */ +EAPI char * +ecore_config_bundle_label_get(Ecore_Config_Bundle * ns) +{ + return ns ? ns->identifier : NULL; +} + +/** + * Creates a new Ecore_Config_Bundle. + * @param srv Config server. + * @param identifier Identifier string for the new bundle. + * @return A pointer to a new Ecore_Config_Bundle. @c NULL is returned if the + * structure couldn't be allocated. + */ +EAPI Ecore_Config_Bundle * +ecore_config_bundle_new(Ecore_Config_Server * srv, const char *identifier) +{ + Ecore_Config_Bundle *t; + static long ss; + + ss = 0; /* bundle unique serial */ + + if ((t = malloc(sizeof(Ecore_Config_Bundle)))) + { + memset(t, 0, sizeof(Ecore_Config_Bundle)); + + t->identifier = (char *)identifier; + t->serial = ++ss; + t->owner = srv->name; + t->next = srv->bundles; + srv->bundles = t; + } + return t; +} + +static Ecore_Config_Server * +do_init(const char *name) +{ + return _ecore_config_ipc_init(name); +} + +static Ecore_Config_Server * +ecore_config_init_local(const char *name) +{ + char *p; + char *buf; + + if ((p = getenv("HOME"))) + { /* debug-only ### FIXME */ + if (!(buf = malloc(PATH_MAX * sizeof(char)))) + return NULL; + snprintf(buf, PATH_MAX, "%s/.ecore/%s/.global", p, name); + unlink(buf); + + free(buf); + } + + return do_init(name); +} + +static Ecore_Config_Server * +ecore_config_init_global(const char *name) +{ + char *p; + int global; + char *buf; + + if ((p = getenv("HOME"))) + { /* debug-only ### FIXME */ + if (!(buf = malloc(PATH_MAX * sizeof(char)))) + return NULL; + snprintf(buf, PATH_MAX, "%s/.ecore/%s/.global", p, name); + global = creat(buf, S_IRWXU); + + if (global >= 0) + close(global); + + free(buf); + } + + return do_init(name); +} + +/** + * @defgroup Ecore_Config_App_Lib_Group Ecore Config App Library Functions + * + * Functions that are used to start up and shutdown the Enlightened + * Property Library when used directly by an application. + */ + +/** + * Initializes the Enlightened Property Library. + * + * Either this function or @ref ecore_config_system_init must be run + * before any other function in the Enlightened Property Library, even + * if you have run @ref ecore_init . The name given is used to + * determine the default configuration to load. + * + * @param name Application name + * @return @c ECORE_CONFIG_ERR_SUCC if the library is successfully set up. + * @c ECORE_CONFIG_ERR_FAIL otherwise. + * @ingroup Ecore_Config_App_Lib_Group + */ +EAPI int +ecore_config_init(const char *name) +{ + char *path; + Ecore_Config_Prop *list; + _ecore_config_log_dom = eina_log_domain_register + ("ecore_config", ECORE_CONFIG_DEFAULT_LOG_COLOR); + if(_ecore_config_log_dom < 0) + { + EINA_LOG_ERR("Impossible to create a log domain for the Ecore config module."); + return -1; + } + _ecore_config_system_init_no_load(); + + __ecore_config_app_name = strdup(name); + __ecore_config_server_local = ecore_config_init_local(name); + if (!__ecore_config_server_local) + return ECORE_CONFIG_ERR_FAIL; + + list = __ecore_config_bundle_local->data; + free( __ecore_config_bundle_local ); + __ecore_config_bundle_local = + ecore_config_bundle_new(__ecore_config_server_local, "config"); + __ecore_config_bundle_local->data = list; + + path = ecore_config_theme_default_path_get(); + ecore_config_string_default("/e/themes/search_path", path); + if (path) + free(path); + + list = ecore_config_get("/e/themes/search_path"); + if (list) + { + list->flags |= ECORE_CONFIG_FLAG_SYSTEM; + list->flags &= ~ECORE_CONFIG_FLAG_MODIFIED; + } + + return _ecore_config_system_load(); +} + +/** + * Frees memory and shuts down the library for an application. + * @return @c ECORE_CONFIG_ERR_IGNORED . + * @ingroup Ecore_Config_App_Lib_Group + */ +EAPI int +ecore_config_shutdown(void) +{ + return ecore_config_system_shutdown(); +} + +/** + * @defgroup Ecore_Config_Lib_Lib_Group Ecore Config Library Functions + * + * Functions that are used to start up and shutdown the Enlightened + * Property Library when used directly by an application. + */ + +/** + * Initializes the Enlightened Property Library. + * + * This function is meant to be run from other programming libraries. + * It should not be called from applications. + * + * This function (or @ref ecore_config_init ) + * must be run before any other function in the + * Enlightened Property Library, even if you have run @ref ecore_init . + * + * @return @c ECORE_CONFIG_ERR_SUCC if the library is successfully set up. + * @c ECORE_CONFIG_ERR_FAIL otherwise. + * @ingroup Ecore_Config_Lib_Lib_Group + */ +EAPI int +ecore_config_system_init(void) +{ + _ecore_config_system_init_no_load(); + return _ecore_config_system_load(); +} + +static int +_ecore_config_system_init_no_load(void) +{ + char *p; + + __ecore_config_system_init++; + if (__ecore_config_system_init > 1) + return ECORE_CONFIG_ERR_IGNORED; + + DEBUG = -1; + if ((p = getenv("ECORE_CONFIG_DEBUG")) && p[0] != 0) + { + DEBUG = atoi(p); + } + + __ecore_config_server_global = + ecore_config_init_global(ECORE_CONFIG_GLOBAL_ID); + if (!__ecore_config_server_global) + return ECORE_CONFIG_ERR_FAIL; + + __ecore_config_bundle_local = + ecore_config_bundle_new(__ecore_config_server_global, "system"); + + /* set up a simple default path */ + ecore_config_string_default("/e/themes/search_path", PACKAGE_DATA_DIR "../ewl/themes"); + + return ECORE_CONFIG_ERR_SUCC; +} + + +static int +_ecore_config_system_load(void) +{ + char *buf, *p; + Ecore_Config_Prop *sys; + + if (__ecore_config_system_init != 1) + return ECORE_CONFIG_ERR_FAIL; + + if ((p = getenv("HOME"))) + { /* debug-only ### FIXME */ + if ((buf = malloc(PATH_MAX * sizeof(char)))) + { + snprintf(buf, PATH_MAX, "%s/.e/config.eet", p); + if (ecore_config_file_load(buf) != 0) { + /* even if this file (system.eet) doesn't exist we can + * continue without it as it isn't striclty necessary. + */ + ecore_config_file_load(PACKAGE_DATA_DIR "/system.eet"); + } + sys = __ecore_config_bundle_local->data; + while (sys) + { + /* unmark it modified - modification will mean it has been overridden */ + sys->flags &= ~ECORE_CONFIG_FLAG_MODIFIED; + /* mark as system so that examine can hide them */ + sys->flags |= ECORE_CONFIG_FLAG_SYSTEM; + sys = sys->next; + } + } + free(buf); + } + + return ECORE_CONFIG_ERR_SUCC; +} + + +/** + * Frees memory and shuts down the library for other programming libraries. + * @return @c ECORE_CONFIG_ERR_IGNORED + * @ingroup Ecore_Config_Lib_Lib_Group + */ +EAPI int +ecore_config_system_shutdown(void) +{ + int ret; + + __ecore_config_system_init--; + if (__ecore_config_system_init > 0) + return ECORE_CONFIG_ERR_IGNORED; + + ret = _ecore_config_ipc_exit(); + if (__ecore_config_app_name) + free(__ecore_config_app_name); + while(__ecore_config_bundle_local->data) + ecore_config_dst(__ecore_config_bundle_local->data); + free(__ecore_config_bundle_local); + free(__ecore_config_server_local); + free(__ecore_config_server_global); + eina_log_domain_unregister(_ecore_config_log_dom); + _ecore_config_log_dom = -1; + return ret; +} + +static inline void * +__ecore_argb_to_long(int a, int r, int g, int b, long *v) +{ + *v = ((a << 24) & 0xff000000 ) + | ((r << 16) & 0xff0000 ) + | ((g << 8) & 0xff00 ) + | ( b & 0xff ); + + return v; +} + +static inline void * +__ecore_argbstr_to_long(const char *argb, long *v) +{ + char *l = NULL; + + // convert hexadecimal string #..., #0x..., 0x..., ... to long + if(*argb == '#') + argb++; + *v = (long)strtoul( argb, &l, 16); + + if(*l) + { + ERR("ecore_config_val: value \"%s\" not a valid hexadecimal RGB value?", argb); + return NULL; + } + + return v; +} + diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_db.c b/libraries/ecore/src/lib/ecore_config/ecore_config_db.c new file mode 100644 index 0000000..6238958 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_config/ecore_config_db.c @@ -0,0 +1,296 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include "Ecore_Config.h" +#include "ecore_config_private.h" +#include "ecore_config_util.h" + +struct _Ecore_Config_DB_File +{ + Eet_File *ef; +}; + +Ecore_Config_DB_File * +_ecore_config_db_open_read(const char *file) +{ + Eet_File *ef; + Ecore_Config_DB_File *db; + + eet_init(); + db = malloc(sizeof(Ecore_Config_DB_File)); + if (!db) return NULL; + ef = eet_open((char*)file, EET_FILE_MODE_READ); + if (!ef) + { + free(db); + return NULL; + } + db->ef = ef; + return db; +} + +Ecore_Config_DB_File * +_ecore_config_db_open_write(const char *file) +{ + Eet_File *ef; + Ecore_Config_DB_File *db; + + eet_init(); + db = malloc(sizeof(Ecore_Config_DB_File)); + if (!db) return NULL; + ef = eet_open((char*)file, EET_FILE_MODE_WRITE); + if (!ef) + { + free(db); + return NULL; + } + db->ef = ef; + return db; +} + +void +_ecore_config_db_close(Ecore_Config_DB_File *db) +{ + eet_close(db->ef); + free(db); + eet_shutdown(); +} + +char ** +_ecore_config_db_keys_get(Ecore_Config_DB_File *db, int *num_ret) +{ + char **keys; + int key_count; + int i; + + keys = eet_list(db->ef, (char*)"*", &key_count); + if (!keys) + { + *num_ret = 0; + return NULL; + } + /* make keys freeable - this is safe to do */ + for (i = 0; i < key_count; i++) keys[i] = strdup(keys[i]); + *num_ret = key_count; + return keys; +} + +Ecore_Config_Type +_ecore_config_db_key_type_get(Ecore_Config_DB_File *db, const char *key) +{ + char *data; + int size; + + data = eet_read(db->ef, (char*)key, &size); + if (data) + { + if (size <= 2) + { + free(data); + return ECORE_CONFIG_NIL; + } + if (data[size - 1] != 0) + { + free(data); + return ECORE_CONFIG_NIL; + } + return (Ecore_Config_Type) data[0]; + } + return ECORE_CONFIG_NIL; +} + +int +_ecore_config_db_read(Ecore_Config_DB_File *db, const char *key) +{ + char *data, *value; + int size; + Ecore_Config_Type type; + + data = eet_read(db->ef, (char*)key, &size); + if (data) + { + int l; + char *prev_locale; + + if (size <= 2) + { + free(data); + return 0; + } + if (data[size - 1] != 0) + { + free(data); + return 0; + } + /* "type" NIL 1242 NIL */ + l = strlen(data); + if (l >= (size - 1)) + { + free(data); + return 0; + } + + type = data[0]; + value = data + l + 1; + + switch (type) + { + case ECORE_CONFIG_INT: + case ECORE_CONFIG_BLN: + { + int tmp; + prev_locale = setlocale(LC_NUMERIC, "C"); + tmp = atoi(value); + if (prev_locale) setlocale(LC_NUMERIC, prev_locale); + + ecore_config_typed_set(key, (void *)&tmp, type); + break; + } + case ECORE_CONFIG_FLT: + { + float tmp; + prev_locale = setlocale(LC_NUMERIC, "C"); + tmp = atof(value); + if (prev_locale) setlocale(LC_NUMERIC, prev_locale); + + ecore_config_typed_set(key, (void *)&tmp, type); + break; + } + case ECORE_CONFIG_RGB: + ecore_config_argbstr_set(key, value); + break; + case ECORE_CONFIG_STR: + case ECORE_CONFIG_THM: + ecore_config_typed_set(key, (void *)value, type); + break; + case ECORE_CONFIG_SCT: + INF("loading struct %s", key); + break; + default: + WRN("Type %d not handled", type); + } + free(data); + return 1; + } + return 0; +} + +/* +void * +_ecore_config_db_key_data_get(Ecore_Config_DB_File *db, const char *key, int *size_ret) +{ + char *data; + int size; + + data = eet_read(db->ef, (char*)key, &size); + if (data) + { + int l; + char *dat; + + if (size <= 2) + { + free(data); + return NULL; + } + if (data[size - 1] != 0) + { + free(data); + return NULL; + } + * "type" NIL data_goes_here NIL * + l = strlen(data); + if (l >= (size - 1)) + { + free(data); + return NULL; + } + dat = malloc(size - (l + 2)); + memcpy(dat, data + l + 1, size - (l + 2)); + free(data); + *size_ret = size - (l + 2); + return dat; + } + return NULL; +}*/ + +void +_ecore_config_db_write(Ecore_Config_DB_File *db, Ecore_Config_Prop *e) +{ + char *prev_locale= NULL; + char *val = NULL; + char *r = NULL; + int num; + + prev_locale = setlocale(LC_NUMERIC, "C"); + + switch (e->type) + { + case ECORE_CONFIG_INT: + esprintf(&val, "%i", _ecore_config_int_get(e)); + break; + case ECORE_CONFIG_BLN: + esprintf(&val, "%i", _ecore_config_boolean_get(e)); + break; + case ECORE_CONFIG_FLT: + esprintf(&val, "%16.16f", _ecore_config_float_get(e)); + break; + case ECORE_CONFIG_STR: + val = _ecore_config_string_get(e); + break; + case ECORE_CONFIG_THM: + val = _ecore_config_theme_get(e); + break; + case ECORE_CONFIG_RGB: + val = _ecore_config_argbstr_get(e); + break; + default: + WRN("Type %d not handled", e->type); + } + + if (prev_locale) + { + setlocale(LC_NUMERIC, prev_locale); + } + + if(val) + { + num = esprintf(&r, "%c%c%s%c", (char) e->type, 0, val, 0); + if(num) + eet_write(db->ef, e->key, r, num, 1); + free(r); + } + + free(val); +} +/* +void +_ecore_config_db_key_data_set(Ecore_Config_DB_File *db, const char *key, void *data, int data_size) +{ + char *buf; + int num; + + num = 1 + 1 + data_size + 1; + buf = malloc(num); + if (!buf) return; + buf[0] = (char) ECORE_CONFIG_BIN; + buf[1] = 0; + memcpy(buf + 2, data, data_size); + buf[num - 1] = 0; + eet_write(db->ef, (char*)key, buf, num, 1); + free(buf); +}*/ diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_extra.c b/libraries/ecore/src/lib/ecore_config/ecore_config_extra.c new file mode 100644 index 0000000..a134952 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_config/ecore_config_extra.c @@ -0,0 +1,803 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#include +#include + +#include "Ecore_Config.h" +#include "Ecore.h" +#include "ecore_config_private.h" +typedef struct __Ecore_Config_Arg_Callback _Ecore_Config_Arg_Callback; +struct __Ecore_Config_Arg_Callback +{ + char short_opt; + char *long_opt; + char *description; + void *data; + void (*func)(char *val, void *data); + Ecore_Config_Type type; + _Ecore_Config_Arg_Callback *next; +}; + +char *__ecore_config_app_description; +_Ecore_Config_Arg_Callback *_ecore_config_arg_callbacks; + +/* shorthand prop setup code to make client apps a little smaller ;) */ + +/** + * Creates a new property, if it does not already exist, and sets its + * attributes to those given. + * + * The type of the property is guessed from the key and the value + * given. + * + * @param key The property key. + * @param val Pointer to default value of key. + * @param short_opt Short option used to set the property from command + * line. + * @param long_opt Long option used to set the property from command line. + * @param desc String description of property. + * @return @c ECORE_CONFIG_ERR_SUCC on success. + * @ingroup Ecore_Config_Create_Group + */ +int +ecore_config_create(const char *key, void *val, char short_opt, char *long_opt, + char *desc) +{ + int type = ecore_config_type_guess(key, val); + + return ecore_config_typed_create(key, val, type, short_opt, long_opt, desc); +} + +/** + * Creates a new property, if it does not already exist, and sets its + * attributes to those given. + * @param key The property key. + * @param val Pointer to default value of key. + * @param type Type of the property. + * @param short_opt Short option used to set the property from + * command line. + * @param long_opt Long option used to set the property from command line. + * @param desc String description of property. + * @return @c ECORE_CONFIG_ERR_SUCC on success. + * @ingroup Ecore_Config_Create_Group + */ +int +ecore_config_typed_create(const char *key, void *val, int type, char short_opt, + char *long_opt, char *desc) +{ + int ret; + + if ((ret = + ecore_config_typed_default(key, val, type)) != ECORE_CONFIG_ERR_SUCC) + return ret; + if ((ret = + ecore_config_short_opt_set(key, short_opt)) != ECORE_CONFIG_ERR_SUCC) + return ret; + if ((ret = + ecore_config_long_opt_set(key, long_opt)) != ECORE_CONFIG_ERR_SUCC) + return ret; + ret = ecore_config_describe(key, desc); + return ret; +} + +/** + * Creates a new boolean property, if it does not already exist, and sets its + * attributes to those given. + * @param key The property key. + * @param val Default boolean value of key. + * @param short_opt Short option used to set the property from command + * line. + * @param long_opt Long option used to set the property from command line. + * @param desc String description of property. + * @return @c ECORE_CONFIG_ERR_SUCC on success. + * @ingroup Ecore_Config_Create_Group + */ +int +ecore_config_boolean_create(const char *key, int val, char short_opt, + char *long_opt, char *desc) +{ + return + ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_BLN, short_opt, long_opt, + desc); +} + +/** + * Creates a new integer property, if it does not already exist, and sets its + * attributes to those given. + * @param key The property key. + * @param val Default integer value of key. + * @param short_opt Short option used to set the property from command + * line. + * @param long_opt Long option used to set the property from command line. + * @param desc String description of property. + * @return @c ECORE_CONFIG_ERR_SUCC on success. + * @ingroup Ecore_Config_Create_Group + */ +int +ecore_config_int_create(const char *key, int val, char short_opt, + char *long_opt, char *desc) +{ + return + ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_INT, short_opt, long_opt, + desc); +} + +/** + * Creates a new integer property, if it does not already exist, and sets its + * attributes to those given. + * @param key The property key. + * @param val Default integer value of key. + * @param low Lowest valid integer value for the property. + * @param high Highest valid integer value for the property. + * @param step Increment value for the property. + * @param short_opt Short option used to set the property from command + * line. + * @param long_opt Long option used to set the property from command line. + * @param desc String description of property. + * @return @c ECORE_CONFIG_ERR_SUCC on success. + * @ingroup Ecore_Config_Create_Group + */ +int +ecore_config_int_create_bound(const char *key, int val, int low, int high, + int step, char short_opt, char *long_opt, + char *desc) +{ + Ecore_Config_Prop *e; + int ret; + + ret = + ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_INT, short_opt, long_opt, + desc); + if (ret != ECORE_CONFIG_ERR_SUCC) + return ret; + e = ecore_config_get(key); + if (e) + { + e->step = step; + e->flags |= ECORE_CONFIG_FLAG_BOUNDS; + e->lo = low; + e->hi = high; + ecore_config_bound(e); + } + return ret; +} + +/** + * Creates a new string property, if it does not already exist, and sets its + * attributes to those given. + * @param key The property key. + * @param val Default value of key. + * @param short_opt Short option used to set the property from command + * line. + * @param long_opt Long option used to set the property from command line. + * @param desc String description of property. + * @return @c ECORE_CONFIG_ERR_SUCC on success. + * @ingroup Ecore_Config_Create_Group + */ +int +ecore_config_string_create(const char *key, char *val, char short_opt, + char *long_opt, char *desc) +{ + return + ecore_config_typed_create(key, (void *)val, ECORE_CONFIG_STR, short_opt, long_opt, + desc); +} + +/** + * Creates a new float property, if it does not already exist, and sets its + * attributes to those given. + * @param key The property key. + * @param val Default float value of key. + * @param short_opt Short option used to set the property from command + * line. + * @param long_opt Long option used to set the property from command line. + * @param desc String description of property. + * @return @c ECORE_CONFIG_ERR_SUCC on success. + * @ingroup Ecore_Config_Create_Group + */ +int +ecore_config_float_create(const char *key, float val, char short_opt, + char *long_opt, char *desc) +{ + return + ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_FLT, short_opt, long_opt, + desc); +} + +/** + * Creates a new float property, if it does not already exist, and sets its + * attributes to those given. + * @param key The property key. + * @param val Default float value of key. + * @param low Lowest valid float value for the property. + * @param high Highest valid float value for the property. + * @param step Increment value for the property. + * @param short_opt Short option used to set the property from command + * line. + * @param long_opt Long option used to set the property from command line. + * @param desc String description of property. + * @return @c ECORE_CONFIG_ERR_SUCC on success. + * @ingroup Ecore_Config_Create_Group + */ +int +ecore_config_float_create_bound(const char *key, float val, float low, + float high, float step, char short_opt, + char *long_opt, char *desc) +{ + Ecore_Config_Prop *e; + int ret; + + ret = + ecore_config_typed_create(key, (void *)&val, ECORE_CONFIG_FLT, short_opt, long_opt, + desc); + e = ecore_config_get(key); + if (e) + { + e->step = (int)(step * ECORE_CONFIG_FLOAT_PRECISION); + e->flags |= ECORE_CONFIG_FLAG_BOUNDS; + e->lo = (int)(low * ECORE_CONFIG_FLOAT_PRECISION); + e->hi = (int)(high * ECORE_CONFIG_FLOAT_PRECISION); + ecore_config_bound(e); + } + return ret; +} + +/** + * Creates a new color property, if it does not already exist, and sets its + * attributes to those given. + * @param key The property key. + * @param val Default color value of key, as a hexadecimal string. + * @param short_opt Short option used to set the property from command + * line. + * @param long_opt Long option used to set the property from command line. + * @param desc String description of property. + * @return @c ECORE_CONFIG_ERR_SUCC on success. + * @ingroup Ecore_Config_Create_Group + */ +int +ecore_config_argb_create(const char *key, char *val, char short_opt, + char *long_opt, char *desc) +{ + return + ecore_config_typed_create(key, (void *)val, ECORE_CONFIG_RGB, short_opt, long_opt, + desc); +} + +/** + * Creates a new theme property, if it does not already exist, and sets its + * attributes to those given. + * @param key The property key. + * @param val Default theme name for the property. + * @param short_opt Short option used to set the property from command + * line. + * @param long_opt Long option used to set the property from command line. + * @param desc String description of property. + * @return @c ECORE_CONFIG_ERR_SUCC on success. + * @ingroup Ecore_Config_Create_Group + */ +int +ecore_config_theme_create(const char *key, char *val, char short_opt, + char *long_opt, char *desc) +{ + return + ecore_config_typed_create(key, (void *)val, ECORE_CONFIG_THM, short_opt, long_opt, + desc); +} + +/* this should only be built if evas is present */ + +/** + * Calls evas_font_path_append on @p evas for each of the font names stored + * in the property "/e/font/path". + * @param evas Evas object to append the font names to. + * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA + * is returned if the property has not been set. + */ +int +ecore_config_evas_font_path_apply(Evas * evas) +{ + char *font_path, *font_path_tmp, *ptr, *end; + + font_path = ecore_config_string_get("/e/font/path"); + + if (!font_path) + return ECORE_CONFIG_ERR_NODATA; + ptr = font_path; + end = font_path + strlen(font_path); + font_path_tmp = font_path; + while (ptr && ptr < end) + { + while (*ptr != '|' && ptr < end) + ptr++; + if (ptr < end) + *ptr = '\0'; + + evas_font_path_append(evas, font_path_tmp); + ptr++; + font_path_tmp = ptr; + } + + free(font_path); + + return ECORE_CONFIG_ERR_SUCC; +} + +/** + * Retrieves the default theme search path. + * + * @return The default theme search path. + */ +char * +ecore_config_theme_default_path_get(void) +{ + char *path, *home; + int len; + + home = getenv("HOME"); + len = strlen(PACKAGE_DATA_DIR "/../") + strlen(__ecore_config_app_name) + + strlen("/themes/") + 1; + if (home) + len += strlen(home) + strlen("/.e/apps/") + + strlen(__ecore_config_app_name) + + strlen("/themes/|"); /* no \0, as that is above */ + + if (!(path = malloc(len))) + return NULL; + + *path = '\0'; + if (home) + { + strcat(path, home); + strcat(path, "/.e/apps/"); + strcat(path, __ecore_config_app_name); + strcat(path, "/themes/|"); + } + strcat(path, PACKAGE_DATA_DIR "/../"); + strcat(path, __ecore_config_app_name); + strcat(path, "/themes/"); + + return path; +} + +/** + * Retrieves the search path used to find themes. + * + * The search path is stored in the property "/e/themes/search_path". If + * the property has not been set, the default path used is + * "/usr/local/share//themes|~/.e/apps//themes". + * See @ref ecore_config_theme_default_path_get for more information about + * the default path. + * + * @return The search path. @c NULL is returned if there is no memory left. + */ +char * +ecore_config_theme_search_path_get(void) +{ + char *search_path; + search_path = ecore_config_string_get("/e/themes/search_path"); + + /* this should no longer be the case, as it is defaulted in init */ + if (!search_path) + { + search_path = ecore_config_theme_default_path_get(); + if (search_path) + { + ecore_config_string_default("/e/themes/search_path", search_path); + free(search_path); + } + } + return search_path; +} + +/** + * Adds the given path to the search path used to find themes. + * + * If the search path is successfully, the new search path will be saved + * into the property "/e/themes/search_path". Therefore, this function + * should be called @b after @ref ecore_config_load to allow a user to + * override the default search path. + * + * @param path The given + * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_FAIL + * will be returned if @p path already exists in the search path. + * @c ECORE_CONFIG_ERR_FAIL is returned if @p path is @c NULL. + */ +int +ecore_config_theme_search_path_append(const char *path) +{ + char *search_path, *loc, *new_search_path; + int len, search_len; + Ecore_Config_Prop *prop; + + if (!path) + return ECORE_CONFIG_ERR_NODATA; + search_path = ecore_config_theme_search_path_get(); + + loc = strstr(search_path, path); + len = strlen(path); + search_len = strlen(search_path); + + if (!loc || (loc != search_path && *(loc - 1) != '|') || + (loc != (search_path + search_len - len) && *(loc + len - 1) != '|')) + { + new_search_path = malloc(search_len + len + 2); /* 2 = \0 + | */ + strcpy(new_search_path, search_path); + strncat(new_search_path, "|", 1); + strncat(new_search_path, path, len); + + ecore_config_string_set("/e/themes/search_path", new_search_path); + prop = ecore_config_get("/e/themes/search_path"); + if (prop) + prop->flags &= ~ECORE_CONFIG_FLAG_MODIFIED; + + free(new_search_path); + + return ECORE_CONFIG_ERR_SUCC; + } + return ECORE_CONFIG_ERR_FAIL; +} + +/** + * Retrieve a theme file's full path. + * + * The search path for theme files is given by @ref + * ecore_config_theme_search_path_get . + * + * @param name The name of the theme. + * @return A full path to the theme on success. @c NULL will be returned + * if @p name is @c NULL or no theme matching the given name could + * be found. + */ +char * +ecore_config_theme_with_path_from_name_get(char *name) +{ + char *search_path, *search_path_tmp, *ptr, *end, *file; + struct stat st; + + if (!name) + return NULL; /* no theme specified (nor a default) */ + + search_path = ecore_config_theme_search_path_get(); + ptr = search_path; + end = search_path + strlen(search_path); + search_path_tmp = search_path; + while (ptr && ptr < end) + { + while (*ptr != '|' && ptr < end) + ptr++; + if (ptr < end) + *ptr = '\0'; + + file = malloc(strlen(search_path_tmp) + strlen(name) + 6); + /* 6 = / + .edj + \0 */ + + snprintf(file, strlen(search_path_tmp) + strlen(name) + 6, + "%s/%s.edj", search_path_tmp, name); + + if (stat(file, &st) == 0) + { + free(search_path); + return file; + } + free(file); + ptr++; + search_path_tmp = ptr; + } + + free(search_path); + + return NULL; /* we could not find the theme with that name in search path */ +} + +/** + * Retrieves the full path to the theme file of the theme stored in the + * given property. + * + * The search path for themes is given by @ref + * ecore_config_theme_search_path_get . + * + * @param key The given property. + * @return A full path to the theme on success, or @c NULL on failure. + * This function will fail if no key is specified or not theme + * matching that given by the property @p key could be found. + */ +char * +ecore_config_theme_with_path_get(const char *key) +{ + return + ecore_config_theme_with_path_from_name_get(ecore_config_theme_get(key)); +} + +static const char *_ecore_config_short_types[] = + { " ", " ", " ", " ", " ", " ", "" }; + +/** + * Prints the property list of the local configuration bundle to output. + */ +void +ecore_config_args_display(void) +{ + Ecore_Config_Prop *props; + _Ecore_Config_Arg_Callback *callbacks; + + if (__ecore_config_app_description) + ERR("%s\n\n", __ecore_config_app_description); + ERR("Supported Options:"); + ERR(" -h, --help\t Print this text"); + if (!__ecore_config_bundle_local) + return; + props = __ecore_config_bundle_local->data; + while (props) + { + /* if it is a system prop, or cannot be set on command line hide it */ + if (props->flags & ECORE_CONFIG_FLAG_SYSTEM || (!props->short_opt && !props->long_opt)) + { + props = props->next; + continue; + } + INF(" %c%c%c --%s\t%s %s", props->short_opt ? '-' : ' ', + props->short_opt ? props->short_opt : ' ', + props->short_opt ? ',' : ' ', + props->long_opt ? props->long_opt : props->key, + _ecore_config_short_types[props->type], + props->description ? props->description : + "(no description available)"); + + props = props->next; + } + callbacks = _ecore_config_arg_callbacks; + while (callbacks) + { + INF(" %c%c%c --%s\t%s %s", callbacks->short_opt ? '-' : ' ', + callbacks->short_opt ? callbacks->short_opt : ' ', + callbacks->short_opt ? ',' : ' ', + callbacks->long_opt ? callbacks->long_opt : "", + _ecore_config_short_types[callbacks->type], + callbacks->description ? callbacks->description : + "(no description available)"); + + callbacks = callbacks->next; + } +} + +static int +ecore_config_parse_set(Ecore_Config_Prop * prop, char *arg, char *opt, + char opt2) +{ + if (!arg) + { + if (opt) + ERR("Missing expected argument for option --%s", opt); + else + ERR("Missing expected argument for option -%c", opt2); + return ECORE_CONFIG_PARSE_EXIT; + } + else + { + ecore_config_set(prop->key, arg); + prop->flags |= ECORE_CONFIG_FLAG_CMDLN; + } + return ECORE_CONFIG_PARSE_CONTINUE; +} + +static void +ecore_config_args_callback_add(char short_opt, char *long_opt, char *desc, + void (*func)(char *val, void *data), + void *data, Ecore_Config_Type type) { + _Ecore_Config_Arg_Callback *new_cb; + + new_cb = malloc(sizeof(_Ecore_Config_Arg_Callback)); + new_cb->short_opt = short_opt; + if (long_opt) + new_cb->long_opt = strdup(long_opt); + if (desc) + new_cb->description = strdup(desc); + new_cb->data = data; + new_cb->func = func; + new_cb->type = type; + + new_cb->next = _ecore_config_arg_callbacks; + _ecore_config_arg_callbacks = new_cb; +} + +void +ecore_config_args_callback_str_add(char short_opt, char *long_opt, char *desc, + void (*func)(char *val, void *data), + void *data) { + ecore_config_args_callback_add(short_opt, long_opt, desc, func, data, ECORE_CONFIG_STR); +} + +void +ecore_config_args_callback_noarg_add(char short_opt, char *long_opt, char *desc, + void (*func)(char *val, void *data), + void *data) { + ecore_config_args_callback_add(short_opt, long_opt, desc, func, data, ECORE_CONFIG_NIL); +} + +/** + * Parse the arguments set by @ref ecore_app_args_set and set properties + * accordingly. + * + * @return @c ECORE_CONFIG_PARSE_CONTINUE if successful. + * @c ECORE_CONFIG_PARSE_EXIT is returned if an unrecognised option + * is found. @c ECORE_CONFIG_PARSE_HELP is returned if help was + * displayed. + */ +int +ecore_config_args_parse(void) +{ + int argc; + char **argv; + int nextarg, next_short_opt, found, ret; + char *arg; + char *long_opt, short_opt; + Ecore_Config_Prop *prop; + _Ecore_Config_Arg_Callback *callback; + + ecore_app_args_get(&argc, &argv); + nextarg = 1; + while (nextarg < argc) + { + arg = argv[nextarg]; + + if (*arg != '-') + { + ERR("Unexpected attribute \"%s\"", arg); + nextarg++; + continue; + } + + next_short_opt = 1; + short_opt = *(arg + next_short_opt); + + if (short_opt == '-') + { + long_opt = arg + 2; + + if (!strcmp(long_opt, "help")) + { + ecore_config_args_display(); + return ECORE_CONFIG_PARSE_HELP; + } + + found = 0; + prop = __ecore_config_bundle_local->data; + while (prop) + { + if ((prop->long_opt && !strcmp(long_opt, prop->long_opt)) + || !strcmp(long_opt, prop->key)) + { + found = 1; + if ((ret = + ecore_config_parse_set(prop, argv[++nextarg], + long_opt, + '\0')) != + ECORE_CONFIG_PARSE_CONTINUE) + return ret; + break; + } + prop = prop->next; + } + if (!found) + { + callback = _ecore_config_arg_callbacks; + while (callback) + { + if ((callback->long_opt && + !strcmp(long_opt, callback->long_opt))) + { + found = 1; + if (callback->type == ECORE_CONFIG_NIL) + { + callback->func(NULL, callback->data); + } + else + { + if (!argv[++nextarg]) + { + ERR("Missing expected argument for option --%s", long_opt); + return ECORE_CONFIG_PARSE_EXIT; + } + callback->func(argv[nextarg], callback->data); + } + break; + } + callback = callback->next; + } + } + if (!found) + { + ERR("Unrecognised option \"%s\"", long_opt); + ERR("Try using -h or --help for more information.\n"); + return ECORE_CONFIG_PARSE_EXIT; + } + } + else + { + while (short_opt) + { + if (short_opt == 'h') + { + ecore_config_args_display(); + return ECORE_CONFIG_PARSE_HELP; + } + else + { + found = 0; + prop = __ecore_config_bundle_local->data; + while (prop) + { + if (short_opt == prop->short_opt) + { + found = 1; + if ((ret = + ecore_config_parse_set(prop, + argv[++nextarg], + NULL, + short_opt)) != + ECORE_CONFIG_PARSE_CONTINUE) + return ret; + break; + } + prop = prop->next; + } + + if (!found) + { + callback = _ecore_config_arg_callbacks; + while (callback) + { + if (short_opt == callback->short_opt) + { + found = 1; + if (callback->type == ECORE_CONFIG_NIL) + { + callback->func(NULL, callback->data); + } + else + { + if (!argv[++nextarg]) + { + ERR("Missing expected argument for option -%c", short_opt); + return ECORE_CONFIG_PARSE_EXIT; + } + callback->func(argv[nextarg], callback->data); + } + break; + } + callback = callback->next; + } + } + if (!found) + { + ERR("Unrecognised option '%c'", short_opt); + ERR("Try using -h or --help for more information.\n"); + return ECORE_CONFIG_PARSE_EXIT; + } + } + short_opt = *(arg + ++next_short_opt); + } + } + nextarg++; + } + + return ECORE_CONFIG_PARSE_CONTINUE; +} + +/** + * Sets the description string used by @ref ecore_config_args_display . + * @param description Description of application. + */ +void +ecore_config_app_describe(char *description) +{ + if (__ecore_config_app_description) + free(__ecore_config_app_description); + __ecore_config_app_description = strdup(description); +} diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc.h b/libraries/ecore/src/lib/ecore_config/ecore_config_ipc.h new file mode 100644 index 0000000..7b3dea1 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_config/ecore_config_ipc.h @@ -0,0 +1,50 @@ +#include +#include "Ecore_Config.h" + +typedef enum +{ + IPC_NONE, + IPC_PROP_LIST, + IPC_PROP_DESC, + IPC_PROP_GET, + IPC_PROP_SET, /* end of the codes shared by evidence and econf */ + + IPC_GLOBAL_PROP_LIST, + + IPC_BUNDLE_LIST, + IPC_BUNDLE_NEW, + IPC_BUNDLE_LABEL_GET, + IPC_BUNDLE_LABEL_SET, + IPC_BUNDLE_LABEL_FIND, + + IPC_LAST +} Ecore_Config_Ipc_Call; + +Ecore_Config_Server *_ecore_config_ipc_init(const char *pipe_name); +int _ecore_config_ipc_exit(void); + +Ecore_Config_Server *_ecore_config_server_convert(void *srv); + +char *_ecore_config_ipc_prop_list(Ecore_Config_Server * srv, + const long serial); +char *_ecore_config_ipc_prop_desc(Ecore_Config_Server * srv, + const long serial, + const char *key); +char *_ecore_config_ipc_prop_get(Ecore_Config_Server * srv, + const long serial, + const char *key); +int _ecore_config_ipc_prop_set(Ecore_Config_Server * srv, + const long serial, + const char *key, + const char *val); + +char *_ecore_config_ipc_bundle_list(Ecore_Config_Server * srv); +int _ecore_config_ipc_bundle_new(Ecore_Config_Server * srv, + const char *); +char *_ecore_config_ipc_bundle_label_get(Ecore_Config_Server * + srv, const long); +int _ecore_config_ipc_bundle_label_set(Ecore_Config_Server * + srv, const long, + const char *); +long _ecore_config_ipc_bundle_label_find(Ecore_Config_Server * + srv, const char *); diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_ecore.c b/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_ecore.c new file mode 100644 index 0000000..b1622f3 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_ecore.c @@ -0,0 +1,384 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +/* by Azundris, with thanks to Corey Donohoe */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include "ecore_private.h" +#include + +#include "ecore_config_ipc.h" +#include "ecore_config_util.h" +#include "ecore_config_private.h" + +#include "Ecore_Config.h" + + +/*****************************************************************************/ + +static int +_ecore_config_ipc_ecore_string_get(char **m, char **r) +{ + char *q; + int l = 0; + + if (!m || !*m) + return ECORE_CONFIG_ERR_NODATA; + if (!r) + return ECORE_CONFIG_ERR_FAIL; + q = *m; + if (*q != 's') + return ECORE_CONFIG_ERR_TYPEMISMATCH; + q++; + l = (*(q++)) << 8; + l += *(q++); + *r = q; + q += l; + *m = q; + WRN("IPC/eCore: got string-%d \"%s\"", l, *r); + return ECORE_CONFIG_ERR_SUCC; +} + +static char * +_ecore_config_ipc_global_prop_list(Ecore_Config_Server * srv __UNUSED__, long serial __UNUSED__) +{ + Ecore_Config_DB_File *db; + char **keys; + int key_count, x; + estring *s; + int f; + char buf[PATH_MAX], *p; + // char *data; UNUSED + Ecore_Config_Type type; + + db = NULL; + s = estring_new(8192); + f = 0; + if ((p = getenv("HOME"))) + { + snprintf(buf, sizeof(buf), "%s/.e/config.eet", p); + if (!(db = _ecore_config_db_open_read(buf))) + { + strcpy(buf, PACKAGE_DATA_DIR"/system.eet"); + if (!(db = _ecore_config_db_open_read(buf))) + return NULL; + } + } + if (!db) return NULL; + key_count = 0; + keys = _ecore_config_db_keys_get(db, &key_count); + if (keys) + { + for (x = 0; x < key_count; x++) + { + type = _ecore_config_db_key_type_get(db, keys[x]); + switch (type) + { + case ECORE_CONFIG_INT: + estring_appendf(s, "%s%s: integer", f ? "\n" : "", keys[x]); + break; + case ECORE_CONFIG_BLN: + estring_appendf(s, "%s%s: boolean", f ? "\n" : "", keys[x]); + break; + case ECORE_CONFIG_FLT: + estring_appendf(s, "%s%s: float", f ? "\n" : "", keys[x]); + break; + case ECORE_CONFIG_STR: + estring_appendf(s, "%s%s: string", f ? "\n" : "", keys[x]); + break; + case ECORE_CONFIG_RGB: + estring_appendf(s, "%s%s: colour", f ? "\n" : "", keys[x]); + break; + case ECORE_CONFIG_THM: + estring_appendf(s, "%s%s: theme", f ? "\n" : "", keys[x]); + break; + case ECORE_CONFIG_SCT: + estring_appendf(s, "%s%s: structure", f ? "\n" : "", keys[x]); + break; + default: + estring_appendf(s, "%s%s: unknown", f ? "\n" : "", keys[x]); + continue; + } + f = 1; + } + } + _ecore_config_db_close(db); + if (keys) + { + for (x = 0; x < key_count; x++) + { + free(keys[x]); + } + free(keys); + } + + return estring_disown(s); +} + +/*****************************************************************************/ + +static int +_ecore_config_ipc_ecore_send(Ecore_Ipc_Event_Client_Data * e, int code, + char *reply) +{ + static int our_ref = 0; + int len = reply ? strlen(reply) + 1 : 0; + + our_ref++; + WRN("IPC/eCore: replying [0,0] %d IRT %d => %d {\"%s\":%d}", our_ref, + e->ref, code, reply ? reply : "", len); + return ecore_ipc_client_send(e->client, 0, 0, our_ref, e->ref, code, reply, + len); +} + +/*****************************************************************************/ + +static int +_ecore_config_ipc_ecore_handle_request(Ecore_Ipc_Server * server, + Ecore_Ipc_Event_Client_Data * e) +{ + Ecore_Config_Server *srv; + long serial; + int ret; + char *r, *k, *v, *m; + + srv = _ecore_config_server_convert(server); + serial = e->minor; + r = NULL; + m = (char *)e->data; + INF("IPC/eCore: client sent: [%d,%d] #%d (%d) @ %p", e->major, e->minor, + e->ref, e->size, server); + + switch (e->major) + { + case IPC_PROP_LIST: + if (srv == __ecore_config_server_global) + r = _ecore_config_ipc_global_prop_list(srv, serial); + else + r = _ecore_config_ipc_prop_list(srv, serial); + break; + case IPC_PROP_DESC: + if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC) + r = _ecore_config_ipc_prop_desc(srv, serial, k); + break; + case IPC_PROP_GET: + if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC) + r = _ecore_config_ipc_prop_get(srv, serial, k); + break; + case IPC_PROP_SET: + if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC) + { + if (_ecore_config_ipc_ecore_string_get(&m, &v) == + ECORE_CONFIG_ERR_SUCC) + return _ecore_config_ipc_ecore_send(e, + _ecore_config_ipc_prop_set + (srv, serial, k, v), NULL); + } + break; + + case IPC_BUNDLE_LIST: + r = _ecore_config_ipc_bundle_list(srv); + break; + case IPC_BUNDLE_NEW: + if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC) + return _ecore_config_ipc_ecore_send(e, + k ? + _ecore_config_ipc_bundle_new(srv, + k) : + ECORE_CONFIG_ERR_FAIL, NULL); + break; + case IPC_BUNDLE_LABEL_SET: + if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC) + return _ecore_config_ipc_ecore_send(e, + k ? + _ecore_config_ipc_bundle_label_set + (srv, serial, + k) : ECORE_CONFIG_ERR_FAIL, + NULL); + break; + case IPC_BUNDLE_LABEL_FIND: + if (_ecore_config_ipc_ecore_string_get(&m, &k) == ECORE_CONFIG_ERR_SUCC) + return _ecore_config_ipc_ecore_send(e, + _ecore_config_ipc_bundle_label_find + (srv, k), NULL); + break; + case IPC_BUNDLE_LABEL_GET: + r = _ecore_config_ipc_bundle_label_get(srv, serial); + break; + } + + ret = + _ecore_config_ipc_ecore_send(e, + r ? ECORE_CONFIG_ERR_SUCC : + ECORE_CONFIG_ERR_FAIL, r); + if (r) + { + free(r); + return ret; + } + return ECORE_CONFIG_ERR_NOTFOUND; +} + +/*****************************************************************************/ + +static Eina_Bool +_ecore_config_ipc_client_add(void *data, int type __UNUSED__, void *event) +{ + Ecore_Ipc_Server **server; + Ecore_Ipc_Event_Client_Data *e; + + server = (Ecore_Ipc_Server **) data; + e = (Ecore_Ipc_Event_Client_Data *) event; + + if (*server != ecore_ipc_client_server_get(e->client)) + return EINA_TRUE; + + INF("IPC/eCore: Client connected. @ %p", server); + return EINA_TRUE; +} + +static Eina_Bool +_ecore_config_ipc_client_del(void *data, int type __UNUSED__, void *event) +{ + Ecore_Ipc_Server **server; + Ecore_Ipc_Event_Client_Data *e; + + server = (Ecore_Ipc_Server **) data; + e = (Ecore_Ipc_Event_Client_Data *) event; + + if (*server != ecore_ipc_client_server_get(e->client)) + return EINA_TRUE; + + INF("IPC/eCore: Client disconnected. @ %p", server); + return EINA_TRUE; +} + +static Eina_Bool +_ecore_config_ipc_client_sent(void *data, int type __UNUSED__, void *event) +{ + Ecore_Ipc_Server **server; + Ecore_Ipc_Event_Client_Data *e; + + server = (Ecore_Ipc_Server **) data; + e = (Ecore_Ipc_Event_Client_Data *) event; + + if (*server != ecore_ipc_client_server_get(e->client)) + return EINA_TRUE; + + _ecore_config_ipc_ecore_handle_request(*server, e); + return EINA_TRUE; +} + +/*****************************************************************************/ + +int +_ecore_config_ipc_ecore_init(const char *pipe_name, void **data) +{ + Ecore_Ipc_Server **server; + struct stat st; + char *p; + int port; + char socket[PATH_MAX]; + + server = (Ecore_Ipc_Server **) data; + port = 0; + if (!server) + return ECORE_CONFIG_ERR_FAIL; + +/* if(*server) + return ECORE_CONFIG_ERR_IGNORED; */ + + ecore_init(); + if (ecore_ipc_init() < 1) + return ECORE_CONFIG_ERR_FAIL; + + if ((p = getenv("HOME"))) + { /* debug-only ### FIXME */ + int stale; + + stale = 1; + while (stale) + { + snprintf(socket, PATH_MAX, "%s/.ecore/%s/%d", p, pipe_name, port); + + if (!stat(socket, &st)) + { + INF("IPC/eCore: pipe \"%s\" already exists!?", socket); +/* if(unlink(buf)) + E(0,"IPC/eCore: could not remove pipe \"%s\": %d\n",buf,errno); }}*/ + port++; + } + else + { + stale = 0; + } + } + } + *server = ecore_ipc_server_add(ECORE_IPC_LOCAL_USER, pipe_name, port, NULL); + ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, + _ecore_config_ipc_client_add, server); + ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, + _ecore_config_ipc_client_del, server); + ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, + _ecore_config_ipc_client_sent, server); + + if (*server) + { + INF("IPC/eCore: Server is listening on %s.", pipe_name); + } + + return ECORE_CONFIG_ERR_SUCC; +} + +int +_ecore_config_ipc_ecore_exit(void **data) +{ + int ret; + Ecore_Ipc_Server **server; + + ret = ECORE_CONFIG_ERR_SUCC; + server = (Ecore_Ipc_Server **) data; + + if (!server) + return ECORE_CONFIG_ERR_FAIL; + + if (*server) + { + ecore_ipc_server_del(*server); + *server = NULL; + } + + ecore_ipc_shutdown(); + ecore_shutdown(); + + return ret; +} + +/*****************************************************************************/ + +int +_ecore_config_ipc_ecore_poll(void **data) +{ + Ecore_Ipc_Server **server; + + server = (Ecore_Ipc_Server **) data; + + if (!server) + return ECORE_CONFIG_ERR_FAIL; + + ecore_main_loop_iterate(); + + return ECORE_CONFIG_ERR_SUCC; +} + +/*****************************************************************************/ diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c b/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c new file mode 100644 index 0000000..35bd783 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_config/ecore_config_ipc_main.c @@ -0,0 +1,275 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +/* ############## bad */ +#define HAVE_EVAS2 + +#include +#include +#include +#include +#include +#include +#include +#include /* malloc(), free() */ + +#include "Ecore.h" +#include "Ecore_Config.h" +#include "ecore_config_util.h" +#include "ecore_config_ipc.h" + +#include "ecore_config_private.h" + +static Ecore_Config_Server *__ecore_config_servers; +Ecore_Timer *ipc_timer = NULL; + +Ecore_Config_Server * +_ecore_config_server_convert(void *srv) +{ + Ecore_Config_Server *srv_tmp; + + srv_tmp = __ecore_config_servers; + while (srv_tmp) + { + if (srv_tmp->server == srv) + return srv_tmp; + srv_tmp = srv_tmp->next; + } + + return __ecore_config_server_global; +} + +/*****************************************************************************/ +/* INTERFACE FOR IPC MODULES */ +/*****************************/ + +char * +_ecore_config_ipc_prop_list(Ecore_Config_Server * srv, const long serial) +{ + Ecore_Config_Bundle *theme; + Ecore_Config_Prop *e; + estring *s; + int f; + + theme = ecore_config_bundle_by_serial_get(srv, serial); + e = theme ? theme->data : NULL; + s = estring_new(8192); + f = 0; + while (e) + { + /* ignore system properties in listings, unless they have been overridden */ + if (e->flags & ECORE_CONFIG_FLAG_SYSTEM && !(e->flags & ECORE_CONFIG_FLAG_MODIFIED)) + { + e = e->next; + continue; + } + estring_appendf(s, "%s%s: %s", f ? "\n" : "", e->key, + ecore_config_type_get(e)); + if (e->flags & ECORE_CONFIG_FLAG_BOUNDS) + { + if (e->type == ECORE_CONFIG_FLT) + estring_appendf(s, ", range %le..%le", + (float)e->lo / ECORE_CONFIG_FLOAT_PRECISION, + (float)e->hi / ECORE_CONFIG_FLOAT_PRECISION); + else + estring_appendf(s, ", range %d..%d", e->lo, e->hi); + } + if (e->type == ECORE_CONFIG_THM) + estring_appendf(s, ", group %s", e->data ? e->data : "Main"); + f = 1; + e = e->next; + } + + return estring_disown(s); +} + +char * +_ecore_config_ipc_prop_desc(Ecore_Config_Server * srv, const long serial, + const char *key) +{ +#ifdef HAVE_EVAS2 + Ecore_Config_Prop *e; + + e = ecore_config_get(key); + if (e) + { + estring *s = estring_new(512); + + estring_appendf(s, "%s: %s", e->key, ecore_config_type_get(e)); + if (e->flags & ECORE_CONFIG_FLAG_BOUNDS) + estring_appendf(s, ", range %d..%d", e->lo, e->hi); + return estring_disown(s); + } +#endif + return strdup(""); +} + +char * +_ecore_config_ipc_prop_get(Ecore_Config_Server * srv, const long serial, + const char *key) +{ +#ifdef HAVE_EVAS2 + char *ret; + + if ((ret = ecore_config_as_string_get(key))) + return ret; +#endif + return strdup(""); +} + +int +_ecore_config_ipc_prop_set(Ecore_Config_Server * srv, const long serial, + const char *key, const char *val) +{ +#ifdef HAVE_EVAS2 + int ret; + Ecore_Config_Bundle *theme; + + theme = ecore_config_bundle_by_serial_get(srv, serial); + ret = ecore_config_set(key, (char *)val); + ERR("ipc.prop.set(%s->%s,\"%s\") => %d\n", theme ? theme->identifier : "", + key, val, ret); + return ret; +#else + return ECORE_CONFIG_ERR_NOTSUPP; +#endif +} + +/*****************************************************************************/ + +char * +_ecore_config_ipc_bundle_list(Ecore_Config_Server * srv) +{ + Ecore_Config_Bundle *ns; + estring *s; + int f; + + ns = ecore_config_bundle_1st_get(srv); + s = estring_new(8192); + f = 0; + if (!ns) + return strdup(""); + + while (ns) + { + estring_appendf(s, "%s%d: %s", f ? "\n" : "", + ecore_config_bundle_serial_get(ns), + ecore_config_bundle_label_get(ns)); + f = 1; + ns = ecore_config_bundle_next_get(ns); + } + + return estring_disown(s); +} + +int +_ecore_config_ipc_bundle_new(Ecore_Config_Server * srv, const char *label) +{ + if (ecore_config_bundle_new(srv, label)) + return ECORE_CONFIG_ERR_SUCC; + return ECORE_CONFIG_ERR_FAIL; +} + +char * +_ecore_config_ipc_bundle_label_get(Ecore_Config_Server * srv, const long serial) +{ + Ecore_Config_Bundle *ns; + char *label; + + ns = ecore_config_bundle_by_serial_get(srv, serial); + label = ecore_config_bundle_label_get(ns); + return strdup(label ? label : ""); +} + +int +_ecore_config_ipc_bundle_label_set(Ecore_Config_Server * srv, const long serial, + const char *label) +{ + Ecore_Config_Bundle *ns; + + ns = ecore_config_bundle_by_serial_get(srv, serial); + if (!(ns->identifier = malloc(sizeof(label)))) + return ECORE_CONFIG_ERR_OOM; + memcpy(ns->identifier, label, sizeof(label)); + return ECORE_CONFIG_ERR_SUCC; +} + +long +_ecore_config_ipc_bundle_label_find(Ecore_Config_Server * srv, + const char *label) +{ + Ecore_Config_Bundle *ns; + + ns = ecore_config_bundle_by_label_get(srv, label); + return ns ? ecore_config_bundle_serial_get(ns) : -1; +} + +static Eina_Bool +_ecore_config_ipc_poll(void *data __UNUSED__) +{ + Ecore_Config_Server *s; + + s = __ecore_config_servers; + while (s) + { + _ecore_config_ipc_ecore_poll(&s->server); + s = s->next; + } + + return EINA_TRUE; +} + +int +_ecore_config_ipc_exit(void) +{ + Ecore_Config_Server *l; + + if (ipc_timer) + ecore_timer_del(ipc_timer); + + l = __ecore_config_servers; + while (l) + { + _ecore_config_ipc_ecore_exit(&l->server); + if (l->name) + free(l->name); + l = l->next; + } + + return ECORE_CONFIG_ERR_SUCC; +} + +Ecore_Config_Server * +_ecore_config_ipc_init(const char *pipe_name) +{ + int ret; + Ecore_Config_Server *list; + Ecore_Config_Server *ret_srv; + + list = NULL; + ret_srv = NULL; + list = NULL; + + list = calloc(1, sizeof(Ecore_Config_Server)); + if ((ret = _ecore_config_ipc_ecore_init(pipe_name, &list->server)) != ECORE_CONFIG_ERR_SUCC) + { + ERR("_ecore_config_ipc_init: failed to register %s, code %d", + pipe_name, ret); + } + + ERR("_ecore_config_ipc_init: registered \"%s\"...", pipe_name); + + list->name = strdup(pipe_name); + list->next = __ecore_config_servers; + + __ecore_config_servers = list; + if (!ret_srv) + ret_srv = list; + + if (!ipc_timer) + ipc_timer = ecore_timer_add(100, _ecore_config_ipc_poll, NULL); + + return ret_srv; +} +/*****************************************************************************/ diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_private.h b/libraries/ecore/src/lib/ecore_config/ecore_config_private.h new file mode 100644 index 0000000..b97f695 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_config/ecore_config_private.h @@ -0,0 +1,70 @@ +#ifndef _ECORE_CONFIG_PRIVATE_H +# define _ECORE_CONFIG_PRIVATE_H +#ifdef ECORE_CONFIG_DEFAULT_LOG_COLOR +# undef ECORE_CONFIG_DEFAULT_LOG_COLOR +#endif +#define ECORE_CONFIG_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + /* eina_log related things */ + +extern int _ecore_config_log_dom; +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_ecore_config_log_dom, __VA_ARGS__) + +#ifdef DBG +# undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_ecore_config_log_dom, __VA_ARGS__) + +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_ecore_config_log_dom, __VA_ARGS__) + +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_ecore_config_log_dom, __VA_ARGS__) + +#ifdef CRIT +# undef CRIT +#endif +#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_config_log_dom, __VA_ARGS__) + +/* debug */ +extern int DEBUG; + + +typedef struct _Ecore_Config_DB_File Ecore_Config_DB_File; + +int _ecore_config_mod_init(const char *pipe_name, void **data); +int _ecore_config_mod_exit(void **data); +int _ecore_config_mod_poll(void **data); + +Ecore_Config_DB_File *_ecore_config_db_open_read(const char *file); +Ecore_Config_DB_File *_ecore_config_db_open_write(const char *file); +void _ecore_config_db_close(Ecore_Config_DB_File *db); +char **_ecore_config_db_keys_get(Ecore_Config_DB_File *db, int *num_ret); +Ecore_Config_Type _ecore_config_db_key_type_get(Ecore_Config_DB_File *db, const char *key); +int _ecore_config_db_read(Ecore_Config_DB_File *db, const char *key); +void _ecore_config_db_write(Ecore_Config_DB_File *db, Ecore_Config_Prop *e); + +int _ecore_config_boolean_get(Ecore_Config_Prop *e); +char *_ecore_config_string_get(Ecore_Config_Prop *e); +long _ecore_config_int_get(Ecore_Config_Prop *e); +int _ecore_config_argb_get(Ecore_Config_Prop *e, int *a, int *r, + int *g, int *b); +char *_ecore_config_argbstr_get(Ecore_Config_Prop *e); +long _ecore_config_argbint_get(Ecore_Config_Prop *e); +float _ecore_config_float_get(Ecore_Config_Prop *e); +char *_ecore_config_theme_get(Ecore_Config_Prop *e); + +int _ecore_config_ipc_ecore_init(const char *pipe_name, void **data); +int _ecore_config_ipc_ecore_exit(void **data); +int _ecore_config_ipc_ecore_poll(void **data); + +#include "Ecore.h" +#include "ecore_private.h" + +#endif diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_storage.c b/libraries/ecore/src/lib/ecore_config/ecore_config_storage.c new file mode 100644 index 0000000..d059645 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_config/ecore_config_storage.c @@ -0,0 +1,176 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "Ecore_Config.h" +#include "ecore_config_private.h" + +/** + * Loads the default configuration. + * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA + * is returned if the file cannot be loaded. + * @ingroup Ecore_Config_File_Group + */ +EAPI int +ecore_config_load(void) +{ + char file[PATH_MAX]; + + if (!__ecore_config_app_name) + return ECORE_CONFIG_ERR_FAIL; + + snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.eet", getenv("HOME"), + __ecore_config_app_name); + return ecore_config_file_load(file); +} + +/** + * Saves the current configuration to the default file. + * @return @c ECORE_CONFIG_ERR_SUCC is returned on success. + * @c ECORE_CONFIG_ERR_FAIL is returned if the data cannot be + * saved. + * @ingroup Ecore_Config_File_Group + */ +EAPI int +ecore_config_save(void) +{ + char file[PATH_MAX]; + + if (!__ecore_config_app_name) + return ECORE_CONFIG_ERR_FAIL; + + snprintf(file, PATH_MAX, "%s/.e/apps/%s/config.eet", getenv("HOME"), + __ecore_config_app_name); + return ecore_config_file_save(file); +} + +/** + * Load the given configuration file to the local configuration. + * @param file Name of the file to load. + * @return @c ECORE_CONFIG_ERR_SUCC on success. @c ECORE_CONFIG_ERR_NODATA + * is returned if the file cannot be loaded. + * @ingroup Ecore_Config_File_Group + */ +EAPI int +ecore_config_file_load(const char *file) +{ + Ecore_Config_DB_File *db; + char **keys; + int key_count; + int x; + // double ftmp; UNUSED + // int pt; UNUSED + // int itmp; UNUSED + // Ecore_Config_Type type; UNUSED + char *data; + + db = NULL; + data = NULL; + + db = _ecore_config_db_open_read(file); + if (!db) + { + ERR("Cannot open database from file %s!", file); + return ECORE_CONFIG_ERR_NODATA; + } + key_count = 0; + keys = _ecore_config_db_keys_get(db, &key_count); + if (keys) + { + for (x = 0; x < key_count; x++) + { + _ecore_config_db_read(db, keys[x]); + } + } + _ecore_config_db_close(db); + if (keys) + { + for (x = 0; x < key_count; x++) + { + free(keys[x]); + } + free(keys); + } + return ECORE_CONFIG_ERR_SUCC; +} + +static void +_ecore_config_recurse_mkdir(const char *file) +{ + char *file_ptr; + char *file_tmp; + struct stat status; + + file_tmp = strdup(file); + file_ptr = file_tmp + strlen(file_tmp); + while (*file_ptr != '/' && file_ptr > file_tmp) + file_ptr--; + *file_ptr = '\0'; + + if ((file_tmp[0] != 0) && stat(file_tmp, &status)) + { + _ecore_config_recurse_mkdir(file_tmp); + mkdir(file_tmp, S_IRUSR | S_IWUSR | S_IXUSR); + } + free(file_tmp); +} + +/** + * Saves the local configuration to the given file. + * @param file Name of the file to save to. + * @return @c ECORE_CONFIG_ERR_SUCC is returned on success. + * @c ECORE_CONFIG_ERR_FAIL is returned if the data cannot be + * saved. + * @ingroup Ecore_Config_File_Group + */ +EAPI int +ecore_config_file_save(const char *file) +{ + Ecore_Config_Prop *next; + Ecore_Config_DB_File *db; + struct stat status; + + next = __ecore_config_bundle_local->data; + db = NULL; + + /* if file does not exist check to see if the dirs exist, creating if not */ + if (stat(file, &status)) + _ecore_config_recurse_mkdir(file); + + db = _ecore_config_db_open_write(file); + if (!db) + { + ERR("Cannot open database from file %s!", file); + return ECORE_CONFIG_ERR_FAIL; + } + + while (next) + { + /* let the config_db deal with this + * handyande: hmm, not sure that it ever does - reinstating until + * further discussions satisfy me! + */ + if (!(next->flags & ECORE_CONFIG_FLAG_MODIFIED) || next->flags & ECORE_CONFIG_FLAG_CMDLN) + { + next = next->next; + continue; + } + + _ecore_config_db_write(db, next); + + next = next->next; + } + + _ecore_config_db_close(db); + return ECORE_CONFIG_ERR_SUCC; +} diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_util.c b/libraries/ecore/src/lib/ecore_config/ecore_config_util.c new file mode 100644 index 0000000..6156936 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_config/ecore_config_util.c @@ -0,0 +1,129 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +/* azundris */ + +#include +#include /* malloc(), free() */ +#include +#include /* str...() */ + +#include /* varargs in sprintf/appendf */ + +#include "Ecore.h" +#include "ecore_private.h" + +#include "Ecore_Config.h" +#include "ecore_config_util.h" + +#include "ecore_config_private.h" + +#define CHUNKLEN 4096 + +/*****************************************************************************/ +/* STRINGS */ +/***********/ + +estring * +estring_new(int size) +{ + estring *e = malloc(sizeof(estring)); + + if (e) + { + memset(e, 0, sizeof(estring)); + if ((size > 0) && (e->str = malloc(size))) + e->alloc = size; + } + return e; +} + +char * +estring_disown(estring * e) +{ + if (e) + { + char *r = e->str; + + free(e); + return r; + } + return NULL; +} + +int +estring_appendf(estring * e, const char *fmt, ...) +{ + int need; + va_list ap; + char *p; + + if (!e) + return ECORE_CONFIG_ERR_FAIL; + + if (!e->str) + { + e->used = e->alloc = 0; + if (!(e->str = (char *)malloc(e->alloc = CHUNKLEN))) + return ECORE_CONFIG_ERR_OOM; + } + + va_start(ap, fmt); + need = vsnprintf(NULL, 0, fmt, ap); + va_end(ap); + + if (need >= (e->alloc - e->used)) + { + e->alloc = e->used + need + (CHUNKLEN - (need % CHUNKLEN)); + + if (!(p = (char *)realloc(e->str, e->alloc))) + { + free(e->str); + e->alloc = e->used = 0; + return ECORE_CONFIG_ERR_OOM; + } + e->str = p; + } + + va_start(ap, fmt); + need = vsnprintf(e->str + e->used, e->alloc - e->used, fmt, ap); + va_end(ap); + + return e->used += need; +} + +int +esprintf(char **result, const char *fmt, ...) +{ + va_list ap; + size_t need; + char *n; + + if (!result) + return ECORE_CONFIG_ERR_FAIL; + + va_start(ap, fmt); + need = vsnprintf(NULL, 0, fmt, ap) + 1; + va_end(ap); + n = malloc(need + 1); + + if (n) + { + va_start(ap, fmt); + need = vsnprintf(n, need, fmt, ap); + va_end(ap); + + n[need] = 0; + + if(*result) + free(result); + *result = n; + + return need; + } + + return ECORE_CONFIG_ERR_OOM; +} + +/*****************************************************************************/ diff --git a/libraries/ecore/src/lib/ecore_config/ecore_config_util.h b/libraries/ecore/src/lib/ecore_config/ecore_config_util.h new file mode 100644 index 0000000..5bee9d6 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_config/ecore_config_util.h @@ -0,0 +1,14 @@ +#define TIMER_STOP 0 +#define TIMER_CONT 1 + +typedef struct _estring +{ + char *str; + int alloc, used; +} estring; + +estring *estring_new(int size); +char *estring_disown(estring * e); +int estring_appendf(estring * e, const char *fmt, ...); + +int esprintf(char **result, const char *fmt, ...); diff --git a/libraries/ecore/src/lib/ecore_directfb/Ecore_DirectFB.h b/libraries/ecore/src/lib/ecore_directfb/Ecore_DirectFB.h new file mode 100644 index 0000000..1f6fc63 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_directfb/Ecore_DirectFB.h @@ -0,0 +1,181 @@ +#ifndef _ECORE_DIRECTFB_H +#define _ECORE_DIRECTFB_H + +#include + +#include + +#ifdef EAPI +# undef EAPI +#endif /* ifdef EAPI */ + +#ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else /* if __GNUC__ >= 4 */ +# define EAPI +# endif /* if __GNUC__ >= 4 */ +#else /* ifdef __GNUC__ */ +# define EAPI +#endif /* ifdef __GNUC__ */ + +#ifdef __cplusplus +extern "C" { +#endif /* ifdef __cplusplus */ + +EAPI extern int ECORE_DIRECTFB_EVENT_POSITION; +EAPI extern int ECORE_DIRECTFB_EVENT_SIZE; +EAPI extern int ECORE_DIRECTFB_EVENT_CLOSE; +EAPI extern int ECORE_DIRECTFB_EVENT_DESTROYED; +EAPI extern int ECORE_DIRECTFB_EVENT_GOT_FOCUS; +EAPI extern int ECORE_DIRECTFB_EVENT_LOST_FOCUS; +EAPI extern int ECORE_DIRECTFB_EVENT_KEY_DOWN; +EAPI extern int ECORE_DIRECTFB_EVENT_KEY_UP; +EAPI extern int ECORE_DIRECTFB_EVENT_BUTTON_DOWN; +EAPI extern int ECORE_DIRECTFB_EVENT_BUTTON_UP; +EAPI extern int ECORE_DIRECTFB_EVENT_MOTION; +EAPI extern int ECORE_DIRECTFB_EVENT_ENTER; +EAPI extern int ECORE_DIRECTFB_EVENT_LEAVE; +EAPI extern int ECORE_DIRECTFB_EVENT_WHEEL; + +#ifndef _ECORE_DIRECTFB_WINDOW_PREDEF +typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window; +#endif /* ifndef _ECORE_DIRECTFB_WINDOW_PREDEF */ +typedef struct _Ecore_DirectFB_Cursor Ecore_DirectFB_Cursor; + +typedef struct _Ecore_DirectFB_Event_Key_Down Ecore_DirectFB_Event_Key_Down; +typedef struct _Ecore_DirectFB_Event_Key_Up Ecore_DirectFB_Event_Key_Up; +typedef struct _Ecore_DirectFB_Event_Button_Down Ecore_DirectFB_Event_Button_Down; +typedef struct _Ecore_DirectFB_Event_Button_Up Ecore_DirectFB_Event_Button_Up; +typedef struct _Ecore_DirectFB_Event_Motion Ecore_DirectFB_Event_Motion; +typedef struct _Ecore_DirectFB_Event_Enter Ecore_DirectFB_Event_Enter; +typedef struct _Ecore_DirectFB_Event_Leave Ecore_DirectFB_Event_Leave; +typedef struct _Ecore_DirectFB_Event_Wheel Ecore_DirectFB_Event_Wheel; +typedef struct _Ecore_DirectFB_Event_Got_Focus Ecore_DirectFB_Event_Got_Focus; +typedef struct _Ecore_DirectFB_Event_Lost_Focus Ecore_DirectFB_Event_Lost_Focus; + +/* this struct is to keep windows data (id, window itself and surface) in memory as every call + * to DirectFB for this values (e.g window->GetSurface(window,&surface)) will increment the + * reference count, then we will have to release N times the data, so better we just ask for + them once */ +struct _Ecore_DirectFB_Window +{ + DFBWindowID id; + IDirectFBWindow *window; + IDirectFBSurface *surface; + Ecore_DirectFB_Cursor *cursor; +}; + +struct _Ecore_DirectFB_Cursor +{ + IDirectFBSurface *surface; + int hot_x; + int hot_y; +}; + +struct _Ecore_DirectFB_Event_Key_Down /** DirectFB Key Down event */ +{ + char *name; /**< The name of the key that was released */ + char *string; /**< The logical symbol of the key that was pressed */ + char *key_compose; /**< The UTF-8 string conversion if any */ + unsigned int time; + DFBWindowID win; +}; + +struct _Ecore_DirectFB_Event_Key_Up /** DirectFB Key Up event */ +{ + char *name; /**< The name of the key that was released */ + char *string; /**< The logical symbol of the key that was pressed */ + char *key_compose; /**< The UTF-8 string conversion if any */ + unsigned int time; + DFBWindowID win; +}; + +struct _Ecore_DirectFB_Event_Button_Down +{ + int button; + int modifiers; + int x, y; + unsigned int time; + int double_click : 1; + int triple_click : 1; + DFBWindowID win; +}; +struct _Ecore_DirectFB_Event_Button_Up +{ + int button; + int modifiers; + int x, y; + unsigned int time; + DFBWindowID win; + int double_click : 1; + int triple_click : 1; +}; +struct _Ecore_DirectFB_Event_Motion +{ + int modifiers; + int x, y; + unsigned int time; + DFBWindowID win; +}; + +struct _Ecore_DirectFB_Event_Enter +{ + int modifiers; + int x, y; + unsigned int time; + DFBWindowID win; +}; + +struct _Ecore_DirectFB_Event_Leave +{ + int modifiers; + int x, y; + unsigned int time; + DFBWindowID win; +}; + +struct _Ecore_DirectFB_Event_Wheel +{ + int direction; + int z; + int modifiers; + unsigned int time; + DFBWindowID win; +}; + +struct _Ecore_DirectFB_Event_Got_Focus +{ + unsigned int time; + DFBWindowID win; +}; + +struct _Ecore_DirectFB_Event_Lost_Focus +{ + unsigned int time; + DFBWindowID win; +}; + +/* main functions */ +EAPI int ecore_directfb_init(const char *name); +EAPI int ecore_directfb_shutdown(void); +EAPI IDirectFB * ecore_directfb_interface_get(void); + +/* window operations */ +EAPI Ecore_DirectFB_Window *ecore_directfb_window_new(int x, int y, int w, int h); +EAPI void ecore_directfb_window_free(Ecore_DirectFB_Window *window); +EAPI void ecore_directfb_window_move(Ecore_DirectFB_Window *window, int x, int y); +EAPI void ecore_directfb_window_resize(Ecore_DirectFB_Window *window, int w, int h); +EAPI void ecore_directfb_window_focus(Ecore_DirectFB_Window *window); +EAPI void ecore_directfb_window_show(Ecore_DirectFB_Window *window); +EAPI void ecore_directfb_window_hide(Ecore_DirectFB_Window *window); +EAPI void ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *window, Eina_Bool set); +EAPI void ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *window, Eina_Bool set); +EAPI void ecore_directfb_window_size_get(Ecore_DirectFB_Window *window, int *w, int *h); +EAPI void ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *window, Eina_Bool show); + +#ifdef __cplusplus +} +#endif /* ifdef __cplusplus */ + +#endif /* ifndef _ECORE_DIRECTFB_H */ diff --git a/libraries/ecore/src/lib/ecore_directfb/Makefile.am b/libraries/ecore/src/lib/ecore_directfb/Makefile.am new file mode 100644 index 0000000..8142d33 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_directfb/Makefile.am @@ -0,0 +1,31 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore \ +@DIRECTFB_CFLAGS@ @EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_directfb.la +includes_HEADERS = Ecore_DirectFB.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_directfb_la_SOURCES = \ +ecore_directfb.c \ +ecore_directfb_keys.h \ +ecore_directfb_private.h + +libecore_directfb_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@DIRECTFB_LIBS@ \ +@EINA_LIBS@ + +libecore_directfb_la_LDFLAGS = -version-info @version_info@ @release_info@ + +libecore_directfb_la_DEPENDENCIES = \ +$(top_builddir)/src/lib/ecore/libecore.la + +EXTRA_DIST = \ +Ecore_DirectFB.h \ +ecore_directfb.c \ +ecore_directfb_keys.h \ +ecore_directfb_private.h diff --git a/libraries/ecore/src/lib/ecore_directfb/Makefile.in b/libraries/ecore/src/lib/ecore_directfb/Makefile.in new file mode 100644 index 0000000..51d113f --- /dev/null +++ b/libraries/ecore/src/lib/ecore_directfb/Makefile.in @@ -0,0 +1,822 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_directfb +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am_libecore_directfb_la_OBJECTS = ecore_directfb.lo +libecore_directfb_la_OBJECTS = $(am_libecore_directfb_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_directfb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libecore_directfb_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_directfb_la_SOURCES) +DIST_SOURCES = $(libecore_directfb_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore \ +@DIRECTFB_CFLAGS@ @EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_directfb.la +includes_HEADERS = Ecore_DirectFB.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_directfb_la_SOURCES = \ +ecore_directfb.c \ +ecore_directfb_keys.h \ +ecore_directfb_private.h + +libecore_directfb_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@DIRECTFB_LIBS@ \ +@EINA_LIBS@ + +libecore_directfb_la_LDFLAGS = -version-info @version_info@ @release_info@ +libecore_directfb_la_DEPENDENCIES = \ +$(top_builddir)/src/lib/ecore/libecore.la + +EXTRA_DIST = \ +Ecore_DirectFB.h \ +ecore_directfb.c \ +ecore_directfb_keys.h \ +ecore_directfb_private.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_directfb/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_directfb/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_directfb.la: $(libecore_directfb_la_OBJECTS) $(libecore_directfb_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_directfb_la_LINK) -rpath $(libdir) $(libecore_directfb_la_OBJECTS) $(libecore_directfb_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_directfb.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_directfb/ecore_directfb.c b/libraries/ecore/src/lib/ecore_directfb/ecore_directfb.c new file mode 100644 index 0000000..f45b3c3 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_directfb/ecore_directfb.c @@ -0,0 +1,757 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include +#include + +#include "Ecore_DirectFB.h" +#include "ecore_directfb_private.h" +#include "ecore_directfb_keys.h" +#include "Ecore.h" +#include "ecore_private.h" + +/* ecore_directfb */ +/******************/ +/* About */ +/* with this you can create windows of directfb and handle events through ecore + * TODO: + * - handle all event types + * - + * */ +int _ecore_directfb_log_dom = -1; + +static int _ecore_directfb_init_count = 0; + +static int _window_event_fd = 0; +static int _input_event_fd = 0; + +static int _ecore_directfb_fullscreen_window_id = 0; +static int _cursor_x = 0; +static int _cursor_y = 0; + +EAPI int ECORE_DIRECTFB_EVENT_POSITION = 0; +EAPI int ECORE_DIRECTFB_EVENT_SIZE = 0; +EAPI int ECORE_DIRECTFB_EVENT_CLOSE = 0; +EAPI int ECORE_DIRECTFB_EVENT_DESTROYED = 0; +EAPI int ECORE_DIRECTFB_EVENT_GOT_FOCUS = 0; +EAPI int ECORE_DIRECTFB_EVENT_LOST_FOCUS = 0; +EAPI int ECORE_DIRECTFB_EVENT_KEY_DOWN = 0; +EAPI int ECORE_DIRECTFB_EVENT_KEY_UP = 0; +EAPI int ECORE_DIRECTFB_EVENT_BUTTON_DOWN = 0; +EAPI int ECORE_DIRECTFB_EVENT_BUTTON_UP = 0; +EAPI int ECORE_DIRECTFB_EVENT_MOTION = 0; +EAPI int ECORE_DIRECTFB_EVENT_ENTER = 0; +EAPI int ECORE_DIRECTFB_EVENT_LEAVE = 0; +EAPI int ECORE_DIRECTFB_EVENT_WHEEL = 0; + +static Ecore_Fd_Handler *_window_event_fd_handler_handle = NULL; +static Ecore_Fd_Handler *_input_event_fd_handler_handle = NULL; + +/* this hash is to store all the possible key names for fast lookup */ +static Eina_Hash *_ecore_directfb_key_symbols_hash = NULL; + +static IDirectFB *_dfb = NULL; // the main interface +static IDirectFBEventBuffer *_window_event; // the main event buffer (all windows are attached to this) +static IDirectFBEventBuffer *_input_event; // the main event buffer (all windows are attached to this) +static IDirectFBDisplayLayer *_layer; // the main layer +static DFBResult _err; // useful for DFBCHECK + +/*******************/ +/* local functions */ +/*******************/ + +/* free ecore directfb events functions */ +/****************************************/ + +static void +_ecore_directfb_event_free_key_down(void *data __UNUSED__, void *ev) +{ + Ecore_DirectFB_Event_Key_Up *e; + + e = ev; + if(e->name) + free(e->name); + + if (e->string) + free(e->string); + + if (e->key_compose) + free(e->key_compose); + + free(e); +} /* _ecore_directfb_event_free_key_down */ + +static void +_ecore_directfb_event_free_key_up(void *data __UNUSED__, void *ev) +{ + Ecore_DirectFB_Event_Key_Up *e; + + e = ev; + if(e->name) + free(e->name); + + if (e->string) + free(e->string); + + if (e->key_compose) + free(e->key_compose); + + free(e); +} /* _ecore_directfb_event_free_key_up */ + +/* directfb window input events handler */ +/****************************************/ + +static void +_ecore_directfb_event_handle_motion(DFBEvent *evt) +{ + Ecore_DirectFB_Event_Motion *e; + e = calloc(1, sizeof(Ecore_DirectFB_Event_Motion)); + + switch(evt->clazz) + { + case DFEC_INPUT: + e->modifiers = 0; + switch(evt->input.axis) + { + case DIAI_X: + e->x = _cursor_x = evt->input.axisabs; + e->y = _cursor_y; + break; + + case DIAI_Y: + e->y = _cursor_y = evt->input.axisabs; + e->x = _cursor_x; + break; + + case DIAI_Z: + //_ecore_directfb_event_handle_wheel(evt); + return; + + default: + return; + } /* switch */ + e->win = _ecore_directfb_fullscreen_window_id; + e->time = 0; + break; + + case DFEC_WINDOW: + e->modifiers = 0; + e->x = evt->window.x; + e->y = evt->window.y; + e->win = evt->window.window_id; + e->time = 0; + break; + + default: + break; + } /* switch */ + ecore_event_add(ECORE_DIRECTFB_EVENT_MOTION, e, NULL, NULL); +} /* _ecore_directfb_event_handle_motion */ + +static void +_ecore_directfb_event_handle_key_down(DFBEvent *evt) +{ + Ecore_DirectFB_Event_Key_Down *e; + unsigned int key_symbol; + struct keymap *k; + + e = calloc(1, sizeof(Ecore_DirectFB_Event_Key_Down)); + + switch(evt->clazz) + { + case DFEC_INPUT: + key_symbol = evt->input.key_symbol; + k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol); + + if(!k) + { + ERR("Symbol %0X of class DFEC_INPUT not found.", evt->input.key_symbol); + return; + } + + e->name = strdup(k->name); + e->string = strdup(k->string); + e->key_compose = NULL; + e->win = _ecore_directfb_fullscreen_window_id; + e->time = 0; + break; + + case DFEC_WINDOW: + key_symbol = evt->window.key_symbol; + k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol); + + if(!k) + { + ERR("Symbol %0X of class DFEC_WINDOW not found.", evt->window.key_symbol); + return; + } + + e->name = strdup(k->name); + e->string = strdup(k->string); + e->key_compose = NULL; + e->win = evt->window.window_id; + e->time = 0; + break; + + default: + break; + } /* switch */ + + ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_DOWN, e, _ecore_directfb_event_free_key_down, NULL); +} /* _ecore_directfb_event_handle_key_down */ + +static void +_ecore_directfb_event_handle_key_up(DFBEvent *evt) +{ + Ecore_DirectFB_Event_Key_Up *e; + unsigned int key_symbol; + struct keymap *k; + + e = calloc(1, sizeof(Ecore_DirectFB_Event_Key_Up)); + + switch(evt->clazz) + { + case DFEC_INPUT: + key_symbol = evt->input.key_symbol; + k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol); + + if(!k) + { + ERR("Symbol %0X of class DFEC_INPUT not found.", evt->input.key_symbol); + return; + } + + e->name = strdup(k->name); + e->string = strdup(k->string); + e->key_compose = NULL; + e->win = _ecore_directfb_fullscreen_window_id; + e->time = 0; + break; + + case DFEC_WINDOW: + key_symbol = evt->window.key_symbol; + k = eina_hash_find(_ecore_directfb_key_symbols_hash, &key_symbol); + + if(!k) + { + ERR("Symbol %0X of class DFEC_WINDOW not found.", evt->window.key_symbol); + return; + } + + e->name = strdup(k->name); + e->string = strdup(k->string); + e->key_compose = NULL; + e->win = evt->window.window_id; + e->time = 0; + break; + + default: + break; + } /* switch */ + ecore_event_add(ECORE_DIRECTFB_EVENT_KEY_UP, e, _ecore_directfb_event_free_key_up, NULL); +} /* _ecore_directfb_event_handle_key_up */ + +static void +_ecore_directfb_event_handle_button_down(DFBEvent *evt) +{ + Ecore_DirectFB_Event_Button_Down *e; + e = calloc(1, sizeof(Ecore_DirectFB_Event_Button_Down)); + + switch(evt->clazz) + { + case DFEC_INPUT: + e->button = evt->input.button + 1; + e->modifiers = 0; + DFBCHECK(_layer->GetCursorPosition(_layer,&e->x,&e->y)); + e->x = _cursor_x; + e->y = _cursor_y; + e->win = _ecore_directfb_fullscreen_window_id; + e->time = 0; + + break; + + case DFEC_WINDOW: + e->button = evt->window.button + 1; + e->modifiers = 0; + e->x = evt->window.x; + e->y = evt->window.y; + e->win = evt->window.window_id; + e->time = 0; + break; + + default: + break; + } /* switch */ + + ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_DOWN, e, NULL, NULL); +} /* _ecore_directfb_event_handle_button_down */ + +static void +_ecore_directfb_event_handle_button_up(DFBEvent *evt) +{ + Ecore_DirectFB_Event_Button_Up *e; + e = calloc(1, sizeof(Ecore_DirectFB_Event_Button_Up)); + + switch(evt->clazz) + { + case DFEC_INPUT: + e->button = evt->input.button + 1; + e->modifiers = 0; + e->x = _cursor_x; + e->y = _cursor_y; + e->win = _ecore_directfb_fullscreen_window_id; + e->time = 0; + + break; + + case DFEC_WINDOW: + e->button = evt->window.button + 1; + e->modifiers = 0; + e->x = evt->window.x; + e->y = evt->window.y; + e->win = evt->window.window_id; + e->time = 0; + break; + + default: + break; + } /* switch */ + ecore_event_add(ECORE_DIRECTFB_EVENT_BUTTON_UP, e, NULL, NULL); +} /* _ecore_directfb_event_handle_button_up */ + +static void +_ecore_directfb_event_handle_enter(DFBWindowEvent *evt) +{ + Ecore_DirectFB_Event_Enter *e; + e = calloc(1, sizeof(Ecore_DirectFB_Event_Enter)); + + e->modifiers = 0; + e->x = evt->x; + e->y = evt->y; + e->win = evt->window_id; + e->time = 0; + + ecore_event_add(ECORE_DIRECTFB_EVENT_ENTER, e, NULL, NULL); +} /* _ecore_directfb_event_handle_enter */ + +static void +_ecore_directfb_event_handle_leave(DFBWindowEvent *evt) +{ + Ecore_DirectFB_Event_Leave *e; + e = calloc(1, sizeof(Ecore_DirectFB_Event_Leave)); + + e->modifiers = 0; + e->x = evt->x; + e->y = evt->y; + e->win = evt->window_id; + e->time = 0; + + ecore_event_add(ECORE_DIRECTFB_EVENT_LEAVE, e, NULL, NULL); +} /* _ecore_directfb_event_handle_leave */ + +static void +_ecore_directfb_event_handle_wheel(DFBWindowEvent *evt) +{ + Ecore_DirectFB_Event_Wheel *e; + e = calloc(1, sizeof(Ecore_DirectFB_Event_Wheel)); + + // currently there's no direction (only up/down); + e->direction = 0; + e->z = evt->step; + e->modifiers = 0; + e->win = evt->window_id; + e->time = 0; + + ecore_event_add(ECORE_DIRECTFB_EVENT_WHEEL, e, NULL, NULL); +} /* _ecore_directfb_event_handle_wheel */ + +static void +_ecore_directfb_event_handle_got_focus(DFBWindowEvent *evt) +{ + Ecore_DirectFB_Event_Got_Focus *e; + e = calloc(1, sizeof(Ecore_DirectFB_Event_Got_Focus)); + + e->win = evt->window_id; + e->time = 0; + + ecore_event_add(ECORE_DIRECTFB_EVENT_GOT_FOCUS, e, NULL, NULL); +} /* _ecore_directfb_event_handle_got_focus */ + +static void +_ecore_directfb_event_handle_lost_focus(DFBWindowEvent *evt) +{ + Ecore_DirectFB_Event_Lost_Focus *e; + e = calloc(1, sizeof(Ecore_DirectFB_Event_Lost_Focus)); + + e->win = evt->window_id; + e->time = 0; + + ecore_event_add(ECORE_DIRECTFB_EVENT_LOST_FOCUS, e, NULL, NULL); +} /* _ecore_directfb_event_handle_lost_focus */ + +/* inputs and windows fds handlers */ +/***********************************/ +/* TODO fix this to handle windows and input events (fullscreen/window mode) + * in fullscreen theres no window_id so get the id from a global var (only one fullscreen + * window at a time */ + +static Eina_Bool +_ecore_directfb_input_event_fd_handler(void *data __UNUSED__,Ecore_Fd_Handler *fd_handler __UNUSED__) +{ + DFBEvent evt; + int v = 0; + + v = read(_input_event_fd, &evt, sizeof(DFBEvent)); + if (v < 0) + return EINA_TRUE; + + if (v < 1) + return EINA_TRUE; + + /* we are getting duplicate events, only parse if we are in fullscreen */ + //if(_ecore_directfb_fullscreen_window_id == 0) break; + if(evt.input.type == DIET_KEYPRESS) + _ecore_directfb_event_handle_key_down(&evt); + + if(evt.input.type == DIET_KEYRELEASE) + _ecore_directfb_event_handle_key_up(&evt); + + if(evt.input.type == DIET_BUTTONPRESS) + _ecore_directfb_event_handle_button_down(&evt); + + if(evt.input.type == DIET_BUTTONRELEASE) + _ecore_directfb_event_handle_button_up(&evt); + + if(evt.input.type == DIET_AXISMOTION) + _ecore_directfb_event_handle_motion(&evt); + + return EINA_TRUE; +} /* _ecore_directfb_input_event_fd_handler */ + +static Eina_Bool +_ecore_directfb_window_event_fd_handler(void *data __UNUSED__,Ecore_Fd_Handler *fd_handler __UNUSED__) +{ + DFBEvent evt; + int v = 0; + + v = read(_window_event_fd, &evt, sizeof(DFBEvent)); + if (v < 0) + return EINA_TRUE; + + if (v < 1) + return EINA_TRUE; + + if(evt.window.type & DWET_POSITION) + INF("position"); + + if(evt.window.type & DWET_SIZE) + INF("size"); + + if(evt.window.type & DWET_CLOSE) + INF("close"); + + if(evt.window.type & DWET_DESTROYED) + INF("destroyed"); + + if(evt.window.type & DWET_GOTFOCUS) + _ecore_directfb_event_handle_got_focus(&evt.window); + + if(evt.window.type & DWET_LOSTFOCUS) + _ecore_directfb_event_handle_lost_focus(&evt.window); + + if(evt.window.type & DWET_KEYDOWN) + _ecore_directfb_event_handle_key_down(&evt); + + if(evt.window.type & DWET_KEYUP) + _ecore_directfb_event_handle_key_up(&evt); + + if(evt.window.type & DWET_BUTTONDOWN) + _ecore_directfb_event_handle_button_down(&evt); + + if(evt.window.type & DWET_BUTTONUP) + _ecore_directfb_event_handle_button_up(&evt); + + if(evt.window.type & DWET_MOTION) + _ecore_directfb_event_handle_motion(&evt); + + if(evt.window.type & DWET_ENTER) + _ecore_directfb_event_handle_enter(&evt.window); + + if(evt.window.type & DWET_LEAVE) + _ecore_directfb_event_handle_leave(&evt.window); + + if(evt.window.type & DWET_WHEEL) + _ecore_directfb_event_handle_wheel(&evt.window); + + return EINA_TRUE; +} /* _ecore_directfb_window_event_fd_handler */ + +/* api functions */ +/*****************/ + +EAPI IDirectFB * +ecore_directfb_interface_get(void) +{ + return _dfb; +} /* ecore_directfb_interface_get */ + +EAPI Ecore_DirectFB_Window * +ecore_directfb_window_new(int x, int y, int w, int h) +{ + Ecore_DirectFB_Window *window; + IDirectFBWindow *dfb_window; + IDirectFBSurface *dfb_surface = NULL; + DFBWindowDescription desc; + DFBWindowID id; + + memset(&desc, 0, sizeof(DFBWindowDescription)); + desc.flags = (DWDESC_POSX | DWDESC_POSY | DWDESC_WIDTH | DWDESC_HEIGHT | DWDESC_CAPS); + desc.posx = x; + desc.posy = y; + desc.width = w; + desc.height = h; + desc.caps = DWCAPS_ALPHACHANNEL; + + DFBCHECK(_layer->CreateWindow(_layer, &desc, &dfb_window)); + + dfb_window->AttachEventBuffer(dfb_window, _window_event); + dfb_window->SetOptions(dfb_window,DWOP_NONE); + dfb_window->SetOpacity(dfb_window, 0xFF); + + DFBCHECK(dfb_window->GetID(dfb_window, &id)); + DFBCHECK(dfb_window->GetSurface(dfb_window,&dfb_surface)); + + window = malloc(sizeof(Ecore_DirectFB_Window)); + window->id = id; + window->window = dfb_window; + window->surface = dfb_surface; + window->cursor = NULL; + + return window; +} /* ecore_directfb_window_new */ + +EAPI void +ecore_directfb_window_free(Ecore_DirectFB_Window *ecore_window) +{ + DFBCHECK(ecore_window->surface->Release(ecore_window->surface)); + DFBCHECK(ecore_window->window->Release(ecore_window->window)); + free(ecore_window); +} /* ecore_directfb_window_free */ + +EAPI void +ecore_directfb_window_move(Ecore_DirectFB_Window *ecore_window, int x, int y) +{ + DFBCHECK(ecore_window->window->MoveTo(ecore_window->window, x, y)); +} /* ecore_directfb_window_move */ + +EAPI void +ecore_directfb_window_resize(Ecore_DirectFB_Window *ecore_window, int w, int h) +{ + DFBCHECK(ecore_window->window->Resize(ecore_window->window, w, h)); +} /* ecore_directfb_window_resize */ + +EAPI void +ecore_directfb_window_focus(Ecore_DirectFB_Window *ecore_window) +{ + DFBCHECK(ecore_window->window->RequestFocus(ecore_window->window)); +} /* ecore_directfb_window_focus */ + +EAPI void +ecore_directfb_window_hide(Ecore_DirectFB_Window *ecore_window) +{ + DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0)); +} /* ecore_directfb_window_hide */ + +EAPI void +ecore_directfb_window_show(Ecore_DirectFB_Window *ecore_window) +{ + DFBCHECK(ecore_window->window->SetOpacity(ecore_window->window, 0xFF)); +} /* ecore_directfb_window_show */ + +EAPI void +ecore_directfb_window_shaped_set(Ecore_DirectFB_Window *ecore_window, Eina_Bool set) +{ + DFBWindowOptions opts; + + DFBCHECK(ecore_window->window->GetOptions(ecore_window->window, &opts)); + if(set) + { + opts |= DWOP_SHAPED; + opts |= DWOP_ALPHACHANNEL; + DFBCHECK(ecore_window->window->SetOptions(ecore_window->window, opts)); + } + else + { + opts &= ~DWOP_SHAPED; + opts &= ~DWOP_ALPHACHANNEL; + DFBCHECK(ecore_window->window->SetOptions(ecore_window->window, opts)); + } +} /* ecore_directfb_window_shaped_set */ + +EAPI void +ecore_directfb_window_cursor_show(Ecore_DirectFB_Window *ecore_window, Eina_Bool show) +{ + if(!show) + { + /* create an empty cursor and set it */ + IDirectFBSurface *cursor; + DFBSurfaceDescription desc; + + memset(&desc, 0, sizeof(DFBSurfaceDescription)); + desc.flags = (DSDESC_HEIGHT | DSDESC_WIDTH | DSDESC_PIXELFORMAT); + desc.width = 1; + desc.height = 1; + desc.pixelformat = DSPF_A1; + + DFBCHECK(_dfb->CreateSurface(_dfb,&desc,&cursor)); + DFBCHECK(cursor->Clear(cursor,0,0,0,0)); + DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, cursor, 0, 0)); + } + else + { + /* we already have a cursor surface so set it*/ + if(ecore_window->cursor) + { + DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, ecore_window->cursor->surface, ecore_window->cursor->hot_x, ecore_window->cursor->hot_y)); + } + /* or just set the default directfb cursor */ + else + { + DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, NULL, 0, 0)); + } + } +} /* ecore_directfb_window_cursor_show */ + +EAPI void +ecore_directfb_window_cursor_set(Ecore_DirectFB_Window *ecore_window, Ecore_DirectFB_Cursor *cursor) +{ + if((!cursor) && (ecore_window->cursor)) + { + ecore_window->cursor = NULL; + DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, NULL, 0, 0)); + return; + } + + if(cursor) + { + ecore_window->cursor = cursor; + DFBCHECK(ecore_window->window->SetCursorShape(ecore_window->window, cursor->surface, cursor->hot_x, cursor->hot_y)); + } +} /* ecore_directfb_window_cursor_set */ + +EAPI void +ecore_directfb_window_fullscreen_set(Ecore_DirectFB_Window *ecore_window, Eina_Bool on) +{ + // always release the surface (we are going to get a new one in both cases) + DFBCHECK(ecore_window->surface->Release(ecore_window->surface)); + if(on) + { + DFBCHECK(_layer->SetCooperativeLevel(_layer,DLSCL_EXCLUSIVE)); + DFBCHECK(_layer->GetSurface(_layer,&ecore_window->surface)); + DFBCHECK(_dfb->CreateInputEventBuffer(_dfb, DICAPS_ALL, DFB_FALSE, &_input_event)); + DFBCHECK(_input_event->CreateFileDescriptor(_input_event,&_input_event_fd)); + /* the event of axismove sends one axis at a time, so we must store both */ + DFBCHECK(_layer->GetCursorPosition(_layer,&_cursor_x,&_cursor_y)); + + _input_event_fd_handler_handle = ecore_main_fd_handler_add(_input_event_fd,ECORE_FD_READ,_ecore_directfb_input_event_fd_handler, NULL,NULL,NULL); + _ecore_directfb_fullscreen_window_id = ecore_window->id; + } + else + { + ecore_main_fd_handler_del(_input_event_fd_handler_handle); + DFBCHECK(_input_event->Release(_input_event)); + DFBCHECK(_layer->SetCooperativeLevel(_layer,DLSCL_SHARED)); + DFBCHECK(ecore_window->window->GetSurface(ecore_window->window, &ecore_window->surface)); + _ecore_directfb_fullscreen_window_id = 0; + } +} /* ecore_directfb_window_fullscreen_set */ + +EAPI void +ecore_directfb_window_size_get(Ecore_DirectFB_Window *ecore_window, int *w, int *h) +{ + DFBCHECK(ecore_window->surface->GetSize(ecore_window->surface,w,h)); + return; +} /* ecore_directfb_window_size_get */ + +EAPI int +ecore_directfb_init(const char *name __UNUSED__) +{ + int i = 0; + + if (++_ecore_directfb_init_count != 1) + return _ecore_directfb_init_count; + + _ecore_directfb_log_dom = eina_log_domain_register + ("ecore_directfb", ECORE_DIRECTFB_DEFAULT_LOG_COLOR); + if(_ecore_directfb_log_dom < 0) + { + EINA_LOG_ERR("Impossible to create a log domain for the Ecore directFB module."); + return _ecore_directfb_init_count--; + } + + DFBCHECK(DirectFBInit(NULL,NULL)); + DFBCHECK(DirectFBCreate(&_dfb)); + + DFBCHECK(_dfb->GetDisplayLayer(_dfb, DLID_PRIMARY, &_layer)); + DFBCHECK(_layer->SetCooperativeLevel(_layer, DLSCL_SHARED)); + + /* window events and fd */ + DFBCHECK(_dfb->CreateEventBuffer(_dfb, &_window_event)); + DFBCHECK(_window_event->CreateFileDescriptor(_window_event,&_window_event_fd)); + _window_event_fd_handler_handle = ecore_main_fd_handler_add(_window_event_fd,ECORE_FD_READ,_ecore_directfb_window_event_fd_handler, NULL,NULL,NULL); + + /* register ecore directfb events */ + ECORE_DIRECTFB_EVENT_POSITION = ecore_event_type_new(); + ECORE_DIRECTFB_EVENT_SIZE = ecore_event_type_new(); + ECORE_DIRECTFB_EVENT_CLOSE = ecore_event_type_new(); + ECORE_DIRECTFB_EVENT_DESTROYED = ecore_event_type_new(); + ECORE_DIRECTFB_EVENT_GOT_FOCUS = ecore_event_type_new(); + ECORE_DIRECTFB_EVENT_LOST_FOCUS = ecore_event_type_new(); + ECORE_DIRECTFB_EVENT_KEY_DOWN = ecore_event_type_new(); + ECORE_DIRECTFB_EVENT_KEY_UP = ecore_event_type_new(); + ECORE_DIRECTFB_EVENT_BUTTON_DOWN = ecore_event_type_new(); + ECORE_DIRECTFB_EVENT_BUTTON_UP = ecore_event_type_new(); + ECORE_DIRECTFB_EVENT_MOTION = ecore_event_type_new(); + ECORE_DIRECTFB_EVENT_ENTER = ecore_event_type_new(); + ECORE_DIRECTFB_EVENT_LEAVE = ecore_event_type_new(); + ECORE_DIRECTFB_EVENT_WHEEL = ecore_event_type_new(); + + /* create the hash table for the keynames */ + _ecore_directfb_key_symbols_hash = eina_hash_int32_new(free); + for(i = 0; i < _ecore_directfb_key_symbols_count; i++) + { + struct keymap *k; + k = malloc(sizeof(struct keymap)); + k->name = _ecore_directfb_key_symbols[i].name; + k->string = _ecore_directfb_key_symbols[i].string; + eina_hash_add(_ecore_directfb_key_symbols_hash, &_ecore_directfb_key_symbols[i].id, k); + } + /* create the hash for the windows(key = windowid, val = Ecore_DirectFB_Window struct) */ + return _ecore_directfb_init_count; +} /* ecore_directfb_init */ + +EAPI int +ecore_directfb_shutdown(void) +{ + if (--_ecore_directfb_init_count != 0) + return _ecore_directfb_init_count; + + ecore_main_fd_handler_del(_window_event_fd_handler_handle); + eina_hash_free(_ecore_directfb_key_symbols_hash); + + if(_ecore_directfb_fullscreen_window_id) + { + DFBCHECK(_input_event->Release(_input_event)); + ecore_main_fd_handler_del(_input_event_fd_handler_handle); + } + + DFBCHECK(_window_event->Release(_window_event)); + DFBCHECK(_layer->Release(_layer)); + DFBCHECK(_dfb->Release(_dfb)); + eina_log_domain_unregister(_ecore_directfb_log_dom); + _ecore_directfb_log_dom = -1; + return _ecore_directfb_init_count; +} /* ecore_directfb_shutdown */ + diff --git a/libraries/ecore/src/lib/ecore_directfb/ecore_directfb_keys.h b/libraries/ecore/src/lib/ecore_directfb/ecore_directfb_keys.h new file mode 100644 index 0000000..19cca46 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_directfb/ecore_directfb_keys.h @@ -0,0 +1,184 @@ +typedef struct _Ecore_DirectFB_Key_Symbols Ecore_DirectFB_Key_Symbols; +struct _Ecore_DirectFB_Key_Symbols +{ + char *string; + char *name; + unsigned int id; +}; + +static const Ecore_DirectFB_Key_Symbols _ecore_directfb_key_symbols[] = { + {"\010", "BackSpace",DIKS_BACKSPACE}, + {"\011", "Tab", DIKS_TAB}, + {"\015", "Return", DIKS_RETURN}, + {"", "Cancel", DIKS_CANCEL}, + {"", "Escape", DIKS_ESCAPE}, + {" ", "space", DIKS_SPACE}, + {"!", "exclam", DIKS_EXCLAMATION_MARK}, + {"\"", "quotedbl", DIKS_QUOTATION}, + {"#", "numbersign", DIKS_NUMBER_SIGN}, + {"$", "dollar", DIKS_DOLLAR_SIGN}, + {"%", "percent", DIKS_PERCENT_SIGN}, + {"&", "ampersand", DIKS_AMPERSAND}, + {"'", "apostrophe", DIKS_APOSTROPHE}, + {"(", "parenleft", DIKS_PARENTHESIS_LEFT}, + {")", "parenright", DIKS_PARENTHESIS_RIGHT}, + {"*", "asterisk", DIKS_ASTERISK}, + {"+", "plus", DIKS_PLUS_SIGN}, + {",", "comma", DIKS_COMMA}, + {"-", "minus", DIKS_MINUS_SIGN}, + {".", "period", DIKS_PERIOD}, + {"/", "slash", DIKS_SLASH}, + {"0", "0", DIKS_0}, + {"1", "1", DIKS_1}, + {"2", "2", DIKS_2}, + {"3", "3", DIKS_3}, + {"4", "4", DIKS_4}, + {"5", "5", DIKS_5}, + {"6", "6", DIKS_6}, + {"7", "7", DIKS_7}, + {"8", "8", DIKS_8}, + {"9", "9", DIKS_9}, + {":", "colon", DIKS_COLON}, + {";", "semicolon", DIKS_SEMICOLON}, + {"<", "less", DIKS_LESS_THAN_SIGN}, + {"=", "equal", DIKS_EQUALS_SIGN}, + {">", "greater", DIKS_GREATER_THAN_SIGN}, + {"?", "question", DIKS_QUESTION_MARK}, + {"@", "at", DIKS_AT}, + {"A", "A", DIKS_CAPITAL_A }, + {"B", "B", DIKS_CAPITAL_B }, + {"C", "C", DIKS_CAPITAL_C }, + {"D", "D", DIKS_CAPITAL_D }, + {"E", "E", DIKS_CAPITAL_E }, + {"F", "F", DIKS_CAPITAL_F }, + {"G", "G", DIKS_CAPITAL_G }, + {"H", "H", DIKS_CAPITAL_H }, + {"I", "I", DIKS_CAPITAL_I }, + {"J", "J", DIKS_CAPITAL_J }, + {"K", "K", DIKS_CAPITAL_K }, + {"L", "L", DIKS_CAPITAL_L }, + {"M", "M", DIKS_CAPITAL_M }, + {"N", "N", DIKS_CAPITAL_N }, + {"O", "O", DIKS_CAPITAL_O }, + {"P", "P", DIKS_CAPITAL_P }, + {"Q", "Q", DIKS_CAPITAL_Q }, + {"R", "R", DIKS_CAPITAL_R }, + {"S", "S", DIKS_CAPITAL_S }, + {"T", "T", DIKS_CAPITAL_T }, + {"U", "U", DIKS_CAPITAL_U }, + {"V", "V", DIKS_CAPITAL_V }, + {"W", "W", DIKS_CAPITAL_W }, + {"X", "X", DIKS_CAPITAL_X }, + {"Y", "Y", DIKS_CAPITAL_Y }, + {"Z", "Z", DIKS_CAPITAL_Z }, + {"[", "bracketleft", DIKS_SQUARE_BRACKET_LEFT }, + {"\\", "backslash", DIKS_BACKSLASH }, + {"]", "bracketright", DIKS_SQUARE_BRACKET_RIGHT }, + {"^", "asciicircum", DIKS_CIRCUMFLEX_ACCENT }, + {"_", "underscore", DIKS_UNDERSCORE }, + {"`", "grave", DIKS_GRAVE_ACCENT}, + {"a", "a", DIKS_SMALL_A }, + {"b","b", DIKS_SMALL_B }, + {"c","c", DIKS_SMALL_C }, + {"d","d", DIKS_SMALL_D }, + {"e","e", DIKS_SMALL_E }, + {"f","f", DIKS_SMALL_F }, + {"g","g", DIKS_SMALL_G }, + {"h","h", DIKS_SMALL_H }, + {"i","i", DIKS_SMALL_I }, + {"j","j", DIKS_SMALL_J }, + {"k","k", DIKS_SMALL_K }, + {"l","l", DIKS_SMALL_L }, + {"m","m", DIKS_SMALL_M }, + {"n","n", DIKS_SMALL_N }, + {"o", "o", DIKS_SMALL_O }, + {"p", "p", DIKS_SMALL_P }, + {"q", "q", DIKS_SMALL_Q }, + {"r", "r", DIKS_SMALL_R }, + {"s", "s", DIKS_SMALL_S }, + {"t", "t", DIKS_SMALL_T }, + {"u", "u", DIKS_SMALL_U }, + {"v", "v", DIKS_SMALL_V }, + {"w", "w", DIKS_SMALL_W }, + {"x", "x", DIKS_SMALL_X }, + {"y", "y", DIKS_SMALL_Y }, + {"z", "z", DIKS_SMALL_Z }, + {"{", "braceleft",DIKS_CURLY_BRACKET_LEFT }, + {"|", "bar", DIKS_VERTICAL_BAR }, + {"}", "braceright", DIKS_CURLY_BRACKET_RIGHT }, + {"~", "asciitilde", DIKS_TILDE }, + {"\177", "Delete", DIKS_DELETE }, + {"", "Left", DIKS_CURSOR_LEFT }, + {"", "Right", DIKS_CURSOR_RIGHT}, + {"", "Up", DIKS_CURSOR_UP}, + {"", "Down", DIKS_CURSOR_DOWN}, + {"", "Insert", DIKS_INSERT}, + {"", "Home", DIKS_HOME}, + {"", "End", DIKS_END}, + {"", "Page_Up", DIKS_PAGE_UP}, + {"", "Page_Down", DIKS_PAGE_DOWN}, + {"", "Print", DIKS_PRINT}, + {"", "Pause", DIKS_PAUSE}, + /* ok */ + {"", "Select",DIKS_SELECT}, + /* goto */ + {"", "Clear", DIKS_CLEAR}, + /* power */ + /* power 2 */ + /* option */ + {"", "Menu",DIKS_MENU}, + {"", "Help",DIKS_HELP}, + /* info */ + /* time */ + /* vendor */ + /* archive */ + /* program */ + /* channel */ + /* favorites */ + /* hasta next */ + {"", "Next",DIKS_NEXT}, + {"", "Begin",DIKS_BEGIN}, + /* digits */ + /* teen */ + /* twen */ + {"", "Break", DIKS_BREAK}, + /* exit */ + /* setup */ + {"", "upleftcorner", DIKS_CURSOR_LEFT_UP }, + {"", "lowleftcorner", DIKS_CURSOR_LEFT_DOWN }, + {"", "uprightcorner", DIKS_CURSOR_UP_RIGHT }, + {"", "lowrightcorner",DIKS_CURSOR_DOWN_RIGHT }, + {"", "F1",DIKS_F1}, + {"", "F2",DIKS_F2}, + {"", "F3",DIKS_F3}, + {"", "F4",DIKS_F4}, + {"", "F5",DIKS_F5}, + {"", "F6",DIKS_F6}, + {"", "F7",DIKS_F7}, + {"", "F8",DIKS_F8}, + {"", "F9",DIKS_F9}, + {"", "F10",DIKS_F10}, + {"", "F11",DIKS_F11}, + {"", "F12",DIKS_F12}, + /* this are only mapped to one, not left right */ + {"", "Shift_L", DIKS_SHIFT}, + /*{"Shift_R",0xFFE2},*/ + {"", "Control_L", DIKS_CONTROL}, + /*{"Control_R",0xFFE4},*/ + {"", "Meta_L", DIKS_META}, + /* {"Meta_R",0xFFE8},*/ + {"", "Alt_L", DIKS_ALT}, + {"", "Alt_R", DIKS_ALTGR}, + {"", "Super_L", DIKS_SUPER}, + /*{"Super_R",0xFFEC},*/ + {"", "Hyper_L", DIKS_HYPER}, + /*{"Hyper_R",0xFFEE},*/ + + {"", "Caps_Lock", DIKS_CAPS_LOCK}, + {"", "Num_Lock", DIKS_NUM_LOCK}, + {"", "Scroll_Lock", DIKS_SCROLL_LOCK}, + /* not included the dead keys */ + /* not included the custom keys */ + {"", "VoidSymbol", DIKS_NULL} +}; +static int _ecore_directfb_key_symbols_count = sizeof(_ecore_directfb_key_symbols) / sizeof(Ecore_DirectFB_Key_Symbols); diff --git a/libraries/ecore/src/lib/ecore_directfb/ecore_directfb_private.h b/libraries/ecore/src/lib/ecore_directfb/ecore_directfb_private.h new file mode 100644 index 0000000..ed34587 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_directfb/ecore_directfb_private.h @@ -0,0 +1,52 @@ +#ifndef _ECORE_DIRECTFB_PRIVATE_H +#define _ECORE_DIRECTFB_PRIVATE_H +/* eina_log related things */ + +extern int _ecore_directfb_log_dom; + +#ifdef ECORE_DIRECTFB_DEFAULT_LOG_COLOR +#undef ECORE_DIRECTFB_DEFAULT_LOG_COLOR +#endif /* ifdef ECORE_DIRECTFB_DEFAULT_LOG_COLOR */ +#define ECORE_DIRECTFB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + +#ifdef ERR +# undef ERR +#endif /* ifdef ERR */ +#define ERR(...) EINA_LOG_DOM_ERR(_ecore_directfb_log_dom, __VA_ARGS__) + +#ifdef DBG +# undef DBG +#endif /* ifdef DBG */ +#define DBG(...) EINA_LOG_DOM_DBG(_ecore_directfb_log_dom, __VA_ARGS__) + +#ifdef INF +# undef INF +#endif /* ifdef INF */ +#define INF(...) EINA_LOG_DOM_INFO(_ecore_directfb_log_dom, __VA_ARGS__) + +#ifdef WRN +# undef WRN +#endif /* ifdef WRN */ +#define WRN(...) EINA_LOG_DOM_WARN(_ecore_directfb_log_dom, __VA_ARGS__) + +#ifdef CRIT +# undef CRIT +#endif /* ifdef CRIT */ +#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_directfb_log_dom, __VA_ARGS__) + +/* macro for a safe call to DirectFB functions */ +#define DFBCHECK(x ...)\ + {\ + _err = x;\ + if (_err != DFB_OK) {\ + CRIT("%s <%d>:\n\t", __FILE__, __LINE__ );\ + DirectFBErrorFatal( # x, _err );\ + }\ + } + +struct keymap +{ + char *name; + char *string; +}; +#endif /* ifndef _ECORE_DIRECTFB_PRIVATE_H */ diff --git a/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h b/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h new file mode 100644 index 0000000..256e57c --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/Ecore_Evas.h @@ -0,0 +1,1660 @@ +#ifndef _ECORE_EVAS_H +#define _ECORE_EVAS_H + +#include +#include +#include + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_ECORE_EVAS_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_ECORE_EVAS_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif /* ! _WIN32 */ + +/** + * @file Ecore_Evas.h + * @brief Evas wrapper functions + * + * The following is a list of example that partially exemplify Ecore_Evas's API: + * @li @ref ecore_evas_callbacks_example_c + * @li @ref ecore_evas_object_example_c + * @li @ref ecore_evas_basics_example_c + */ + +/* FIXME: + * to do soon: + * - iconfication api needs to work + * - maximization api needs to work + * - document all calls + * + * later: + * - buffer back-end that renders to an evas_image_object ??? + * - qt back-end ??? + * - dfb back-end ??? (dfb's threads make this REALLY HARD) + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup Ecore_Evas_Group Ecore_Evas wrapper/helper set of functions + * + * This is a list of examples of these functions: + * - @ref Ecore_Evas_Window_Sizes_Example_c + * - @ref Ecore_Evas_Buffer_Example_01_c + * - @ref Ecore_Evas_Buffer_Example_02_c + * @{ + */ + +/* these are dummy and just tell u what API levels ecore_evas supports - not if + * the actual support is compiled in. you need to query for that separately. + */ +#define HAVE_ECORE_EVAS_X 1 +#define HAVE_ECORE_EVAS_FB 1 +#define HAVE_ECORE_EVAS_X11_GL 1 +#define HAVE_ECORE_EVAS_X11_16 1 +#define HAVE_ECORE_EVAS_DIRECTFB 1 +#define HAVE_ECORE_EVAS_WIN32 1 +#define HAVE_ECORE_EVAS_COCOA 1 +#define HAVE_ECORE_EVAS_SDL 1 +#define HAVE_ECORE_EVAS_WINCE 1 +#define HAVE_ECORE_EVAS_EWS 1 +#define HAVE_ECORE_EVAS_PSL1GHT 1 + +typedef enum _Ecore_Evas_Engine_Type +{ + ECORE_EVAS_ENGINE_SOFTWARE_BUFFER, + ECORE_EVAS_ENGINE_SOFTWARE_XLIB, + ECORE_EVAS_ENGINE_XRENDER_X11, + ECORE_EVAS_ENGINE_OPENGL_X11, + ECORE_EVAS_ENGINE_SOFTWARE_XCB, + ECORE_EVAS_ENGINE_XRENDER_XCB, + ECORE_EVAS_ENGINE_SOFTWARE_GDI, + ECORE_EVAS_ENGINE_SOFTWARE_DDRAW, + ECORE_EVAS_ENGINE_DIRECT3D, + ECORE_EVAS_ENGINE_OPENGL_GLEW, + ECORE_EVAS_ENGINE_OPENGL_COCOA, + ECORE_EVAS_ENGINE_SOFTWARE_SDL, + ECORE_EVAS_ENGINE_DIRECTFB, + ECORE_EVAS_ENGINE_SOFTWARE_FB, + ECORE_EVAS_ENGINE_SOFTWARE_8_X11, + ECORE_EVAS_ENGINE_SOFTWARE_16_X11, + ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW, + ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE, + ECORE_EVAS_ENGINE_OPENGL_SDL, + ECORE_EVAS_ENGINE_EWS, + ECORE_EVAS_ENGINE_PSL1GHT +} Ecore_Evas_Engine_Type; + +typedef enum _Ecore_Evas_Avoid_Damage_Type +{ + ECORE_EVAS_AVOID_DAMAGE_NONE = 0, + ECORE_EVAS_AVOID_DAMAGE_EXPOSE = 1, + ECORE_EVAS_AVOID_DAMAGE_BUILT_IN = 2 +} Ecore_Evas_Avoid_Damage_Type; + +typedef enum _Ecore_Evas_Object_Associate_Flags +{ + ECORE_EVAS_OBJECT_ASSOCIATE_BASE = 0, + ECORE_EVAS_OBJECT_ASSOCIATE_STACK = 1 << 0, + ECORE_EVAS_OBJECT_ASSOCIATE_LAYER = 1 << 1, + ECORE_EVAS_OBJECT_ASSOCIATE_DEL = 1 << 2 +} Ecore_Evas_Object_Associate_Flags; + +#ifndef _ECORE_X_H +#define _ECORE_X_WINDOW_PREDEF +typedef unsigned int Ecore_X_Window; +#endif + +#ifndef _ECORE_DIRECTFB_H +#define _ECORE_DIRECTFB_WINDOW_PREDEF +typedef struct _Ecore_DirectFB_Window Ecore_DirectFB_Window; +#endif + +#ifndef __ECORE_WIN32_H__ +typedef struct _Ecore_Win32_Window Ecore_Win32_Window; +#endif + +#ifndef __ECORE_WINCE_H__ +typedef struct _Ecore_WinCE_Window Ecore_WinCE_Window; +#endif + +#ifndef __ECORE_COCOA_H__ +typedef struct _Ecore_Cocoa_Window Ecore_Cocoa_Window; +#endif + +#ifndef _ECORE_EVAS_PRIVATE_H +/* basic data types */ +typedef struct _Ecore_Evas Ecore_Evas; +#endif + +/* module setup/shutdown calls */ + +EAPI int ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine); + +/** + * @brief Init the Ecore_Evas system. + * + * @return How many times the lib has been initialized, 0 indicates failure. + * + * Set up the Evas wrapper system. Init Evas and Ecore libraries. + * + * @see ecore_evas_shutdown() + */ +EAPI int ecore_evas_init(void); +/** + * @brief Shut down the Ecore_Evas system. + * + * @return 0 if ecore evas is fully shut down, or > 0 if it still being used. + * + * This closes the Evas wrapper system down. Shut down Evas and Ecore libraries. + * + * @see ecore_evas_init() + */ +EAPI int ecore_evas_shutdown(void); + +EAPI void ecore_evas_app_comp_sync_set(Eina_Bool do_sync); +EAPI Eina_Bool ecore_evas_app_comp_sync_get(void); + +/** + * @brief Returns a list of supported engines names. + * + * @return Newly allocated list with engines names. Engines names + * strings are internal and should be considered constants, do not + * free or modify them, to free the list use ecore_evas_engines_free(). + */ +EAPI Eina_List *ecore_evas_engines_get(void); +/** + * @brief Free list returned by ecore_evas_engines_get() + */ +EAPI void ecore_evas_engines_free(Eina_List *engines); +/** + * @brief Creates a new Ecore_Evas based on engine name and common parameters. + * + * @param engine_name engine name as returned by + * ecore_evas_engines_get() or NULL to use environment variable + * ECORE_EVAS_ENGINE, that can be undefined and in this case + * this call will try to find the first working engine. + * @param x horizontal position of window (not supported in all engines) + * @param y vertical position of window (not supported in all engines) + * @param w width of window + * @param h height of window + * @param extra_options string with extra parameter, dependent on engines + * or NULL. String is usually in the form: 'key1=value1;key2=value2'. + * Pay attention that when getting that from shell commands, most + * consider ';' as the command terminator, so you need to escape + * it or use quotes. + * + * @return Ecore_Evas instance or NULL if creation failed. + */ +EAPI Ecore_Evas *ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options); +/** + * @brief Set whether an Ecore_Evas has an alpha channel or not. + * + * @param ee The Ecore_Evas to shape + * @param alpha EINA_TRUE to enable the alpha channel, EINA_FALSE to disable it + * + * This function allows you to make an Ecore_Evas translucent using an + * alpha channel. See ecore_evas_shaped_set() for details. The difference + * between a shaped window and a window with an alpha channel is that an + * alpha channel supports multiple levels of transpararency, as opposed to + * the 1 bit transparency of a shaped window (a pixel is either opaque, or + * it's transparent). + * + * @warning Support for this depends on the underlying windowing system. + */ +EAPI void ecore_evas_alpha_set(Ecore_Evas *ee, Eina_Bool alpha); +/** + * @brief Query whether an Ecore_Evas has an alpha channel. + * @param ee The Ecore_Evas to query. + * @return EINA_TRUE if ee has an alpha channel, EINA_FALSE if it does not. + * + * This function returns EINA_TRUE if @p ee has an alpha channel, and EINA_FALSE + * if it does not. + * + * @see ecore_evas_alpha_set() + */ +EAPI Eina_Bool ecore_evas_alpha_get(const Ecore_Evas *ee); +/** + * @brief Set whether an Ecore_Evas has an transparent window or not. + * + * @param ee The Ecore_Evas to shape + * @param transparent EINA_TRUE to enable the transparent window, EINA_FALSE to + * disable it + * + * This function sets some translucency options, for more complete support see + * ecore_evas_alpha_set(). + * + * @warning Support for this depends on the underlying windowing system. + * + * @see ecore_evas_alpha_set() + */ +EAPI void ecore_evas_transparent_set(Ecore_Evas *ee, Eina_Bool transparent); +/** + * @brief Query whether an Ecore_Evas is transparent. + * + * @param ee The Ecore_Evas to query. + * @return EINA_TRUE if ee is transparent, EINA_FALSE if it isn't. + * + * @see ecore_evas_transparent_set() + */ +EAPI Eina_Bool ecore_evas_transparent_get(const Ecore_Evas *ee); +/** + * @brief Get the geometry of an Ecore_Evas. + * + * @param ee The Ecore_Evas whose geometry y + * @param x A pointer to an int to place the x coordinate in + * @param y A pointer to an int to place the y coordinate in + * @param w A pointer to an int to place the w size in + * @param h A pointer to an int to place the h size in + * + * This function takes four pointers to (already allocated) ints, and places + * the geometry of @p ee in them. If any of the parameters is not desired you + * may pass NULL on them. + * + * @code + * int x, y, w, h; + * ecore_evas_geometry_get(ee, &x, &y, &w, &h); + * @endcode + * + * @see ecore_evas_new() + * @see ecore_evas_resize() + * @see ecore_evas_move() + * @see ecore_evas_move_resize() + */ +EAPI void ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h); +/** + * @brief Get the geometry which an Ecore_Evas was latest recently requested. + * + * @param ee The Ecore_Evas whose geometry y + * @param x A pointer to an int to place the x coordinate in + * @param y A pointer to an int to place the y coordinate in + * @param w A pointer to an int to place the w size in + * @param h A pointer to an int to place the h size in + * + * This function takes four pointers to (already allocated) ints, and places + * the geometry which @p ee was latest recently requested . If any of the parameters is not desired you + * may pass NULL on them. + * This function can represent recently requested geomety. + * ecore_evas_geometry_get function returns the value is updated after engine finished request. + * By comparison, ecore_evas_request_geometry_get returns recently requested value. + * + * @code + * int x, y, w, h; + * ecore_evas_request_geometry_get(ee, &x, &y, &w, &h); + * @endcode + * + * @since 1.1 + */ +EAPI void ecore_evas_request_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h); +/** + * @brief Set the focus of an Ecore_Evas' window. + * + * @param ee The Ecore_Evas + * @param on EINA_TRUE for focus, EINA_FALSE to defocus. + * + * This function focuses @p ee if @p on is EINA_TRUE, or unfocuses @p ee if @p + * on is EINA_FALSE. + * + * @warning Support for this depends on the underlying windowing system. + */ +EAPI void ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on); +/** + * @brief Query whether an Ecore_Evas' window is focused or not. + * + * @param ee The Ecore_Evas to set + * @return EINA_TRUE if @p ee if focused, EINA_FALSE if not. + * + * @see ecore_evas_focus_set() + */ +EAPI Eina_Bool ecore_evas_focus_get(const Ecore_Evas *ee); +/** + * @brief Iconify or uniconify an Ecore_Evas' window. + * + * @param ee The Ecore_Evas + * @param on EINA_TRUE to iconify, EINA_FALSE to uniconify. + * + * This function iconifies @p ee if @p on is EINA_TRUE, or uniconifies @p ee if + * @p on is EINA_FALSE. + * + * @note Iconify and minize are synonims. + * + * @warning Support for this depends on the underlying windowing system. + */ +EAPI void ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on); +/** + * @brief Query whether an Ecore_Evas' window is iconified or not. + * + * @param ee The Ecore_Evas to set + * @return EINA_TRUE if @p ee is iconified, EINA_FALSE if not. + * + * @note Iconify and minize are synonims. + * + * @see ecore_evas_iconified_set() + */ +EAPI Eina_Bool ecore_evas_iconified_get(const Ecore_Evas *ee); +/** + * @brief Set whether an Ecore_Evas' window is borderless or not. + * + * @param ee The Ecore_Evas + * @param on EINA_TRUE for borderless, EINA_FALSE for bordered. + * + * This function makes @p ee borderless if @p on is EINA_TRUE, or bordered if @p + * on is EINA_FALSE. + * + * @warning Support for this depends on the underlying windowing system. + */ +EAPI void ecore_evas_borderless_set(Ecore_Evas *ee, Eina_Bool on); +/** + * @brief Query whether an Ecore_Evas' window is borderless or not. + * + * @param ee The Ecore_Evas to set + * @return EINA_TRUE if @p ee is borderless, EINA_FALSE if not. + * + * @see ecore_evas_borderless_set() + */ +EAPI Eina_Bool ecore_evas_borderless_get(const Ecore_Evas *ee); +/** + * @brief Set whether or not an Ecore_Evas' window is fullscreen. + * + * @param ee The Ecore_Evas + * @param on EINA_TRUE fullscreen, EINA_FALSE not. + * + * This function causes @p ee to be fullscreen if @p on is EINA_TRUE, + * or not if @p on is EINA_FALSE. + * + * @warning Support for this depends on the underlying windowing system. + */ +EAPI void ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on); +/** + * @brief Query whether an Ecore_Evas' window is fullscreen or not. + * + * @param ee The Ecore_Evas to set + * @return EINA_TRUE if @p ee is fullscreen, EINA_FALSE if not. + * + * @see ecore_evas_fullscreen_set() + */ +EAPI Eina_Bool ecore_evas_fullscreen_get(const Ecore_Evas *ee); +/** + * @brief Set if this evas should ignore @b all events. + * + * @param ee The Ecore_Evas whose window's to ignore events. + * @param ignore The Ecore_Evas new ignore state. + * + * @warning Support for this depends on the underlying windowing system. + */ +EAPI void ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore); +/** + * @brief Returns the ignore state of an Ecore_Evas' window. + * + * @param ee The Ecore_Evas whose window's ignore events state is returned. + * @return The Ecore_Evas window's ignore state. + * + * @see ecore_evas_ignore_events_set() + */ +EAPI Eina_Bool ecore_evas_ignore_events_get(const Ecore_Evas *ee); +/** + * @brief Query whether an Ecore_Evas' window is visible or not. + * + * @param ee The Ecore_Evas to query. + * @return 1 if visible, 0 if not. + * + * This function queries @p ee and returns 1 if it is visible, and 0 if not. + * + * @see ecore_evas_show() + * @see ecore_evas_hide() + */ +EAPI int ecore_evas_visibility_get(const Ecore_Evas *ee); +/** + * @brief Set the layer of an Ecore_Evas' window. + * + * @param ee The Ecore_Evas + * @param layer The layer to put @p ee on. + * + * This function moves @p ee to the layer @p layer. + * + * @warning Support for this depends on the underlying windowing system. + * + * @see ecore_evas_lower() + * @see ecore_evas_raise() + */ +EAPI void ecore_evas_layer_set(Ecore_Evas *ee, int layer); +/** + * @brief Get the layer of an Ecore_Evas' window. + * + * @param ee The Ecore_Evas to set + * @return the layer @p ee's window is on. + * + * @see ecore_evas_layer_set() + * @see ecore_evas_lower() + * @see ecore_evas_raise() + */ +EAPI int ecore_evas_layer_get(const Ecore_Evas *ee); +/** + * @brief Maximize (or unmaximize) an Ecore_Evas' window. + * + * @param ee The Ecore_Evas + * @param on EINA_TRUE to maximize, EINA_FALSE to unmaximize. + * + * This function maximizes @p ee if @p on is EINA_TRUE, or unmaximizes @p ee + * if @p on is EINA_FALSE. + * + * @warning Support for this depends on the underlying windowing system. + */ +EAPI void ecore_evas_maximized_set(Ecore_Evas *ee, Eina_Bool on); +/** + * @brief Query whether an Ecore_Evas' window is maximized or not. + * + * @param ee The Ecore_Evas to set + * @return EINA_TRUE if @p ee is maximized, EINA_FALSE if not. + * + * @see ecore_evas_maximized_set() + */ +EAPI Eina_Bool ecore_evas_maximized_get(const Ecore_Evas *ee); +/** + * @brief Move an Ecore_Evas. + * + * @param ee The Ecore_Evas to move + * @param x The x coordinate to move to + * @param y The y coordinate to move to + * + * This moves @p ee to the screen coordinates (@p x, @p y) + * + * @warning Support for this depends on the underlying windowing system. + * + * @see ecore_evas_new() + * @see ecore_evas_resize() + * @see ecore_evas_move_resize() + */ +EAPI void ecore_evas_move(Ecore_Evas *ee, int x, int y); +/** + * @brief Resize an Ecore_Evas. + * + * @param ee The Ecore_Evas to move + * @param w The w coordinate to resize to + * @param h The h coordinate to resize to + * + * This resizes @p ee to @p w x @p h. + * + * @warning Support for this depends on the underlying windowing system. + * + * @see ecore_evas_new() + * @see ecore_evas_move() + * @see ecore_evas_move_resize() + */ +EAPI void ecore_evas_resize(Ecore_Evas *ee, int w, int h); +/** + * @brief Move and resize an Ecore_Evas + * + * @param ee The Ecore_Evas to move and resize + * @param x The x coordinate to move to + * @param y The y coordinate to move to + * @param w The w coordinate to resize to + * @param h The h coordinate to resize to + * + * This moves @p ee to the screen coordinates (@p x, @p y) and resizes + * it to @p w x @p h. + * + * @warning Support for this depends on the underlying windowing system. + * + * @see ecore_evas_new() + * @see ecore_evas_move() + * @see ecore_evas_resize() + */ +EAPI void ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h); +/** + * @brief Set the rotation of an Ecore_Evas' window. + * + * @param ee The Ecore_Evas + * @param rot the angle (in degrees) of rotation. + * + * The allowed values of @p rot depend on the engine being used. Most only + * allow multiples of 90. + * + * @warning Support for this depends on the underlying windowing system. + * + * @see ecore_evas_rotation_with_resize_set() + */ +EAPI void ecore_evas_rotation_set(Ecore_Evas *ee, int rot); +/** + * @brief Set the rotation of an Ecore_Evas' window + * + * @param ee The Ecore_Evas + * @param rot the angle (in degrees) of rotation. + * + * Like ecore_evas_rotation_set(), but it also resizes the window's contents so + * that they fit inside the current window geometry. + * + * @warning Support for this depends on the underlying windowing system. + * + * @see ecore_evas_rotation_set() + */ +EAPI void ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot); +/** + * @brief Get the rotation of an Ecore_Evas' window + * + * @param ee The Ecore_Evas + * @return the angle (in degrees) of rotation. + * + * @see ecore_evas_rotation_set() + * @see ecore_evas_rotation_with_resize_set() + */ +EAPI int ecore_evas_rotation_get(const Ecore_Evas *ee); +/** + * @brief Raise an Ecore_Evas' window. + * + * @param ee The Ecore_Evas to raise. + * + * This functions raises the Ecore_Evas to the front. + * + * @warning Support for this depends on the underlying windowing system. + * + * @see ecore_evas_lower() + * @see ecore_evas_layer_set() + */ +EAPI void ecore_evas_raise(Ecore_Evas *ee); +/** + * @brief Lower an Ecore_Evas' window. + * + * @param ee The Ecore_Evas to raise. + * + * This functions lowers the Ecore_Evas to the back. + * + * @warning Support for this depends on the underlying windowing system. + * + * @see ecore_evas_raise() + * @see ecore_evas_layer_set() + */ +EAPI void ecore_evas_lower(Ecore_Evas *ee); +/** + * @brief Set the title of an Ecore_Evas' window. + * + * @param ee The Ecore_Evas whose title you wish to set. + * @param t The title + * + * This function sets the title of @p ee to @p t. + * + * @warning Support for this depends on the underlying windowing system. + */ +EAPI void ecore_evas_title_set(Ecore_Evas *ee, const char *t); +/** + * @brief Get the title of an Ecore_Evas' window. + * + * @param ee The Ecore_Evas whose title you wish to get. + * @return The title of @p ee. + * + * This function returns the title of @p ee. + * + * @see ecore_evas_title_set() + */ +EAPI const char *ecore_evas_title_get(const Ecore_Evas *ee); +/** + * @brief Set the name and class of an Ecore_Evas' window. + * + * @param ee the Ecore_Evas + * @param n the name + * @param c the class + * + * This function sets the name of @p ee to @p n, and its class to @p c. The + * meaning of @p name and @p class depends on the underlying windowing system. + * + * @warning Support for this depends on the underlying windowing system. + */ +EAPI void ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c); +/** + * @brief Get the name and class of an Ecore_Evas' window + * + * @p ee The Ecore_Evas to query + * @p n A pointer to a string to place the name in. + * @p c A pointer to a string to place the class in. + * + * This function gets the name of @p ee into @p n, and its class into + * @p c. + * + * @see ecore_evas_name_class_set() + */ +EAPI void ecore_evas_name_class_get(const Ecore_Evas *ee, const char **n, const char **c); +/** + * @brief Returns a pointer to the underlying window. + * + * @param ee The Ecore_Evas whose window is desired. + * + * @warning Support for this depends on the underlying windowing system. + */ +EAPI Ecore_Window ecore_evas_window_get(const Ecore_Evas *ee); + + +/* engine/target specific init calls */ +EAPI Ecore_Evas *ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h); +EAPI Ecore_X_Window ecore_evas_software_x11_window_get(const Ecore_Evas *ee); +EAPI void ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); +EAPI Eina_Bool ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee); +EAPI void ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); + +#define ECORE_EVAS_GL_X11_OPT_NONE 0 +#define ECORE_EVAS_GL_X11_OPT_INDIRECT 1 +#define ECORE_EVAS_GL_X11_OPT_VSYNC 2 +#define ECORE_EVAS_GL_X11_OPT_LAST 3 + +EAPI Ecore_Evas *ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h); +EAPI Ecore_Evas *ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h, const int *opt); +EAPI Ecore_X_Window ecore_evas_gl_x11_window_get(const Ecore_Evas *ee); +EAPI void ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); +EAPI Eina_Bool ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee); +EAPI void ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); +EAPI void ecore_evas_gl_x11_pre_post_swap_callback_set(const Ecore_Evas *ee, void *data, void (*pre_cb) (void *data, Evas *e), void (*post_cb) (void *data, Evas *e)); + +EAPI Ecore_Evas *ecore_evas_xrender_x11_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h); +EAPI Ecore_X_Window ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee); +EAPI void ecore_evas_xrender_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); +EAPI Eina_Bool ecore_evas_xrender_x11_direct_resize_get(const Ecore_Evas *ee); +EAPI void ecore_evas_xrender_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); + +EAPI Ecore_Evas *ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h); +EAPI Ecore_X_Window ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee); +EAPI Ecore_X_Window ecore_evas_software_x11_8_subwindow_get(const Ecore_Evas *ee); +EAPI void ecore_evas_software_x11_8_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); +EAPI Eina_Bool ecore_evas_software_x11_8_direct_resize_get(const Ecore_Evas *ee); +EAPI void ecore_evas_software_x11_8_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); + +EAPI Ecore_Evas *ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent, int x, int y, int w, int h); +EAPI Ecore_X_Window ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee); +EAPI void ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee, Eina_Bool on); +EAPI Eina_Bool ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee); +EAPI void ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win); + +EAPI Ecore_Evas *ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h); + +EAPI Ecore_Evas *ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h); +EAPI Ecore_DirectFB_Window *ecore_evas_directfb_window_get(const Ecore_Evas *ee); + +/** + * @brief Create a new @c Ecore_Evas canvas bound to the Evas + * @b buffer engine + * + * @param w The width of the canvas, in pixels + * @param h The height of the canvas, in pixels + * @return A new @c Ecore_Evas instance or @c NULL, on failure + * + * This creates a new buffer canvas wrapper, with image data array + * @b bound to the ARGB format, 8 bits per pixel. + * + * This function will allocate the needed pixels array with canonical + * @c malloc(). If you wish a custom function to allocate it, consider + * using ecore_evas_buffer_allocfunc_new(), instead. + * + * @note This function actually is a wrapper on + * ecore_evas_buffer_allocfunc_new(), using the same @a w and @a h + * arguments and canonical @c malloc() and @c free() to the memory + * allocation and freeing functions. See that function's documentation + * for more details. + */ +EAPI Ecore_Evas *ecore_evas_buffer_new(int w, int h); + +/** + * @brief Create a new @c Ecore_Evas canvas bound to the Evas + * @b buffer engine, giving custom allocation and freeing functions for + * the canvas memory region + * + * @param w The width of the canvas, in canvas units + * @param h The height of the canvas, in canvas units + * @param alloc_func Function to be called to allocate the memory + * needed for the new buffer canvas. @a data will be passed the same + * value as the @p data of this function, while @a size will be passed + * @p w times @p h times @c sizeof(int). + * @param free_func Function to be called to free the memory used by + * the new buffer canvas. @a data will be passed the same value as the + * @p data of this function, while @a pix will be passed the canvas + * memory pointer. + * @param data Custom data to be passed to the allocation and freeing + * functions + * @return A new @c Ecore_Evas instance or @c NULL, on failure + * + * This creates a new buffer canvas wrapper, with image data array + * @b bound to the ARGB format, 8 bits per pixel. + * + * This function is useful when one wants an @c Ecore_Evas buffer + * canvas with a custom allocation function, like one getting memory + * chunks from a memory pool, for example. + * + * On any resizing of this @c Ecore_Evas buffer canvas, its image data + * will be @b freed, to be allocated again with the new size. + * + * @note @p w and @p h sizes have to greater or equal to 1. Otherwise, + * they'll be interpreted as 1, exactly. + * + * @see ecore_evas_buffer_new() + */ +EAPI Ecore_Evas *ecore_evas_buffer_allocfunc_new(int w, int h, void *(*alloc_func) (void *data, int size), void (*free_func) (void *data, void *pix), const void *data); + +/** + * @brief Grab a pointer to the actual pixels array of a given + * @c Ecore_Evas @b buffer canvas/window. + * + * @param ee An @c Ecore_Evas handle + * @return A pointer to the internal pixels array of @p ee + * + * Besides returning a pointer to the actual pixel array of the given + * canvas, this call will force a rendering update on @p ee, + * first. + * + * A common use case for this call is to create an image object, from + * @b another canvas, to have as data @p ee's contents, thus + * snapshoting the canvas. For that case, one can also use the + * ecore_evas_object_image_new() helper function. + */ +EAPI const void *ecore_evas_buffer_pixels_get(Ecore_Evas *ee); + +/** + * @brief Create a new @c Ecore_Evas canvas bound to the Evas + * @b ews (Ecore + Evas Single Process Windowing System) engine + * + * EWS is a simple single process windowing system. The backing store + * is also an @c Ecore_Evas that can be setup with + * ecore_evas_ews_setup() and retrieved with + * ecore_evas_ews_ecore_evas_get(). It will allow window management + * using events prefixed with @c ECORE_EVAS_EVENT_EWS_. + * + * The EWS windows (returned by this function or + * ecore_evas_new("ews"...)) will all be software buffer windows + * automatic rendered to the backing store. + * + * @param x horizontal position of window, in pixels + * @param y vertical position of window, in pixels + * @param w The width of the canvas, in pixels + * @param h The height of the canvas, in pixels + * @return A new @c Ecore_Evas instance or @c NULL, on failure + * + * @see ecore_evas_ews_setup() + * @see ecore_evas_ews_ecore_evas_get() + * + * @since 1.1 + */ +EAPI Ecore_Evas *ecore_evas_ews_new(int x, int y, int w, int h); + + +/** + * Returns the backing store image object that represents the given + * window in EWS. + * + * @note This should not be modified anyhow, but may be helpful to + * determine stacking and geometry of it for window managers + * that decorate windows. + * + * @see ecore_evas_ews_manager_set() + * @see ecore_evas_ews_evas_get() + * @since 1.1 + */ +EAPI Evas_Object *ecore_evas_ews_backing_store_get(const Ecore_Evas *ee); + +/** + * Calls the window to be deleted (freed), but can let user decide to + * forbid it by using ecore_evas_callback_delete_request_set() + * + * @since 1.1 + */ +EAPI void ecore_evas_ews_delete_request(Ecore_Evas *ee); + +/** + * @brief Create an Evas image object with image data bound to an + * own, internal @c Ecore_Evas canvas wrapper + * + * @param ee_target @c Ecore_Evas to have the canvas receiving the new + * image object + * @return A handle to the new image object + * + * This will create a @b special Evas image object. The image's pixel + * array will get bound to the same image data array of an @b internal + * @b buffer @c Ecore_Evas canvas. The user of this function is, then, + * supposed to grab that @c Ecore_Evas handle, with + * ecore_evas_object_ecore_evas_get(), and use its canvas to render + * whichever contents he/she wants, @b independently of the contents + * of the canvas owned by @p ee_target. Those contents will reflect on + * the canvas of @p ee, though, being exactly the image data of the + * object returned by this function. + * + * This is a helper function for the scenario of one wanting to grab a + * buffer canvas' contents (with ecore_evas_buffer_pixels_get()) to be + * used on another canvas, for whichever reason. The most common goal + * of this setup is to @b save an image file with a whole canvas as + * contents, which could not be achieved by using an image file within + * the target canvas. + * + * @warning Always resize the returned image and its underlying + * @c Ecore_Evas handle accordingly. They must be kept with same sizes + * for things to work as expected. Also, you @b must issue + * @c evas_object_image_size_set() on the image with that same size. If + * the image is to be shown in a canvas bound to an engine different + * than the buffer one, then you must also set this image's @b fill + * properties accordingly. + * + * @note The image returned will always be bound to the + * @c EVAS_COLORSPACE_ARGB8888 colorspace, always. + * + * @note Use ecore_evas_object_evas_get() to grab the image's internal + * own canvas directly. + * + * @note If snapshoting this image's internal canvas, remember to + * flush its internal @c Ecore_Evas firstly, with + * ecore_evas_manual_render(). + */ +EAPI Evas_Object *ecore_evas_object_image_new(Ecore_Evas *ee_target); + +/** + * @brief Retrieve the internal @c Ecore_Evas handle of an image + * object created via ecore_evas_object_image_new() + * + * @param obj A handle to an image object created via + * ecore_evas_object_image_new() + * @return The underlying @c Ecore_Evas handle in @p obj + */ +EAPI Ecore_Evas *ecore_evas_object_ecore_evas_get(Evas_Object *obj); + +/** + * @brief Retrieve the canvas bound to the internal @c Ecore_Evas + * handle of an image object created via ecore_evas_object_image_new() + * + * @param obj A handle to an image object created via + * ecore_evas_object_image_new() + * @return A handle to @p obj's underlying @c Ecore_Evas's canvas + */ +EAPI Evas *ecore_evas_object_evas_get(Evas_Object *obj); + +EAPI Ecore_Evas *ecore_evas_software_gdi_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height); + +EAPI Ecore_Evas *ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height); + +EAPI Ecore_Evas *ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height); + +EAPI Ecore_Evas *ecore_evas_direct3d_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height); + +EAPI Ecore_Evas *ecore_evas_gl_glew_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height); + +EAPI Ecore_Win32_Window *ecore_evas_win32_window_get(const Ecore_Evas *ee); + +EAPI Ecore_Evas *ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha); +EAPI Ecore_Evas *ecore_evas_sdl16_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha); +EAPI Ecore_Evas *ecore_evas_gl_sdl_new(const char* name, int w, int h, int fullscreen, int noframe); + +EAPI Ecore_Evas *ecore_evas_software_wince_new(Ecore_WinCE_Window *parent, + int x, + int y, + int width, + int height); + +EAPI Ecore_Evas *ecore_evas_software_wince_fb_new(Ecore_WinCE_Window *parent, + int x, + int y, + int width, + int height); + +EAPI Ecore_Evas *ecore_evas_software_wince_gapi_new(Ecore_WinCE_Window *parent, + int x, + int y, + int width, + int height); + +EAPI Ecore_Evas *ecore_evas_software_wince_ddraw_new(Ecore_WinCE_Window *parent, + int x, + int y, + int width, + int height); + +EAPI Ecore_Evas *ecore_evas_software_wince_gdi_new(Ecore_WinCE_Window *parent, + int x, + int y, + int width, + int height); + +EAPI Ecore_WinCE_Window *ecore_evas_software_wince_window_get(const Ecore_Evas *ee); + +EAPI Ecore_Evas *ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, + int x, + int y, + int w, + int h); + +EAPI Ecore_Evas *ecore_evas_psl1ght_new(const char* name, int w, int h); + + +/* generic manipulation calls */ +/** + * @brief Get the engine name used by this Ecore_Evas(window). + * + * @param ee Ecore_Evas whose engine's name is desired. + * @return A string that can(usually) be used in ecore_evas_new() + * + * @see ecore_evas_free() + */ +EAPI const char *ecore_evas_engine_name_get(const Ecore_Evas *ee); +/** + * @brief Return the Ecore_Evas for this Evas + * + * @param e The Evas to get the Ecore_Evas from + * @return The Ecore_Evas that holds this Evas, or NULL if not held by one. + * + * @warning Only use on Evas' created with ecore evas! + */ +EAPI Ecore_Evas *ecore_evas_ecore_evas_get(const Evas *e); +/** + * @brief Free an Ecore_Evas + * + * @param ee The Ecore_Evas to free + * + * This frees up any memory used by the Ecore_Evas. + */ +EAPI void ecore_evas_free(Ecore_Evas *ee); +/** + * @brief Retrieve user data associated with an Ecore_Evas. + * + * @param ee The Ecore_Evas to retrieve the user data from. + * @param key The key which the user data to be retrieved is associated with. + * + * This function retrieves user specific data that has been stored within an + * Ecore_Evas structure with ecore_evas_data_set(). + * + * @returns NULL on error or no data found, A pointer to the user data on + * success. + * + * @see ecore_evas_data_set() + */ +EAPI void *ecore_evas_data_get(const Ecore_Evas *ee, const char *key); +/** + * @brief Store user data in an Ecore_Evas structure. + * + * @param ee The Ecore_Evas to store the user data in. + * @param key A unique string to associate the user data against. Cannot + * be NULL. + * @param data A pointer to the user data to store. + * + * This function associates the @p data with a @p key which is stored by + * the Ecore_Evas @p ee. Be aware that a call to ecore_evas_free() will + * not free any memory for the associated user data, this is the responsibility + * of the caller. + * + * @see ecore_evas_callback_pre_free_set() + * @see ecore_evas_free() + * @see ecore_evas_data_get() + */ +EAPI void ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data); +/** + * Set a callback for Ecore_Evas resize events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee is resized. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +/** + * Set a callback for Ecore_Evas move events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee is moved. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +/** + * Set a callback for Ecore_Evas show events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee is shown. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +/** + * Set a callback for Ecore_Evas hide events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee is hidden. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +/** + * Set a callback for Ecore_Evas delete request events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee gets a delete request. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +/** + * Set a callback for Ecore_Evas destroy events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee is destroyed. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +/** + * Set a callback for Ecore_Evas focus in events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee gets focus. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +/** + * Set a callback for Ecore_Evas focus out events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee loses focus. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +/** + * Set a callback for Ecore_Evas sticky events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee becomes sticky. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +/** + * Set a callback for Ecore_Evas un-sticky events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever @p ee becomes un-sticky. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +/** + * Set a callback for Ecore_Evas mouse in events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever the mouse enters @p ee. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +/** + * Set a callback for Ecore_Evas mouse out events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called whenever the mouse leaves @p ee. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +/** + * Set a callback for Ecore_Evas pre render events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called just before the evas in @p ee is rendered. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +/** + * Set a callback for Ecore_Evas mouse post render events. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called just after the evas in @p ee is rendered. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +/** + * Set a callback for Ecore_Evas pre-free event. + * @param ee The Ecore_Evas to set callbacks on + * @param func The function to call + * + * A call to this function will set a callback on an Ecore_Evas, causing + * @p func to be called just before the instance @p ee is freed. + * + * @warning If and when this function is called depends on the underlying + * windowing system. + */ +EAPI void ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); +EAPI Evas *ecore_evas_get(const Ecore_Evas *ee); +EAPI void ecore_evas_managed_move(Ecore_Evas *ee, int x, int y); +EAPI void ecore_evas_shaped_set(Ecore_Evas *ee, Eina_Bool shaped); +EAPI Eina_Bool ecore_evas_shaped_get(const Ecore_Evas *ee); +/** + * @brief Show an Ecore_Evas' window + * + * @param ee The Ecore_Evas to show. + * + * This function makes @p ee visible. + */ +EAPI void ecore_evas_show(Ecore_Evas *ee); +/** + * @brief Hide an Ecore_Evas' window + * + * @param ee The Ecore_Evas to hide. + * + * This function makes @p ee hidden(not visible). + */ +EAPI void ecore_evas_hide(Ecore_Evas *ee); +EAPI void ecore_evas_activate(Ecore_Evas *ee); + + +/** + * Set the minimum size of a given @c Ecore_Evas window + * + * @param ee An @c Ecore_Evas window's handle + * @param w The minimum width + * @param h The minimum height + * + * This function sets the minimum size of @p ee to be @p w x @p h. + * One won't be able to resize that window to dimensions smaller than + * the ones set. + * + * @note When base sizes are set, via ecore_evas_size_base_set(), + * they'll be used to calculate a window's minimum size, instead of + * those set by this function. + * + * @see ecore_evas_size_min_get() + */ +EAPI void ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h); + +/** + * Get the minimum size set for a given @c Ecore_Evas window + * + * @param ee An @c Ecore_Evas window's handle + * @param w A pointer to an int to place the minimum width in. + * @param h A pointer to an int to place the minimum height in. + * + * @note Use @c NULL pointers on the size components you're not + * interested in: they'll be ignored by the function. + * + * @see ecore_evas_size_min_set() for more details + */ +EAPI void ecore_evas_size_min_get(const Ecore_Evas *ee, int *w, int *h); + +/** + * Set the maximum size of a given @c Ecore_Evas window + * + * @param ee An @c Ecore_Evas window's handle + * @param w The maximum width + * @param h The maximum height + * + * This function sets the maximum size of @p ee to be @p w x @p h. + * One won't be able to resize that window to dimensions bigger than + * the ones set. + * + * @see ecore_evas_size_max_get() + */ +EAPI void ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h); + +/** + * Get the maximum size set for a given @c Ecore_Evas window + * + * @param ee An @c Ecore_Evas window's handle + * @param w A pointer to an int to place the maximum width in. + * @param h A pointer to an int to place the maximum height in. + * + * @note Use @c NULL pointers on the size components you're not + * interested in: they'll be ignored by the function. + * + * @see ecore_evas_size_max_set() for more details + */ +EAPI void ecore_evas_size_max_get(const Ecore_Evas *ee, int *w, int *h); + +/** + * Set the base size for a given @c Ecore_Evas window + * + * @param ee An @c Ecore_Evas window's handle + * @param w The base width + * @param h The base height + * + * This function sets the @b base size of @p ee to be @p w x @p h. + * When base sizes are set, they'll be used to calculate a window's + * @b minimum size, instead of those set by ecore_evas_size_min_get(). + * + * @see ecore_evas_size_base_get() + */ +EAPI void ecore_evas_size_base_set(Ecore_Evas *ee, int w, int h); + +/** + * Get the base size set for a given @c Ecore_Evas window + * + * @param ee An @c Ecore_Evas window's handle + * @param w A pointer to an int to place the base width in. + * @param h A pointer to an int to place the base height in. + * + * @note Use @c NULL pointers on the size components you're not + * interested in: they'll be ignored by the function. + * + * @see ecore_evas_size_base_set() for more details + */ +EAPI void ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h); + +/** + * Set the "size step" for a given @c Ecore_Evas window + * + * @param ee An @c Ecore_Evas window's handle + * @param w The step width + * @param h The step height + * + * This function sets the size steps of @p ee to be @p w x @p h. This + * limits the size of this @cEcore_Evas window to be @b always an + * integer multiple of the step size, for each axis. + */ +EAPI void ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h); + +/** + * Get the "size step" set for a given @c Ecore_Evas window + * + * @param ee An @c Ecore_Evas window's handle + * @param w A pointer to an int to place the step width in. + * @param h A pointer to an int to place the step height in. + * + * @note Use @c NULL pointers on the size components you're not + * interested in: they'll be ignored by the function. + * + * @see ecore_evas_size_base_set() for more details + */ +EAPI void ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h); + +/** + * @brief Set the cursor of an Ecore_Evas. + * + * @param ee The Ecore_Evas + * @param file The path to an image file for the cursor. + * @param layer The layer in which the cursor will appear. + * @param hot_x The x coordinate of the cursor's hot spot. + * @param hot_y The y coordinate of the cursor's hot spot. + * + * This function makes the mouse cursor over @p ee be the image specified by + * @p file. The actual point within the image that the mouse is at is specified + * by @p hot_x and @p hot_y, which are coordinates with respect to the top left + * corner of the cursor image. + * + * @note This function creates an object from the image and uses + * ecore_evas_object_cursor_set(). + * + * @see ecore_evas_object_cursor_set() + */ +EAPI void ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y); +/** + * @brief Get information about an Ecore_Evas' cursor + * + * @param ee The Ecore_Evas to set + * @param obj A pointer to an Evas_Object to place the cursor Evas_Object. + * @param layer A pointer to an int to place the cursor's layer in. + * @param hot_x A pointer to an int to place the cursor's hot_x coordinate in. + * @param hot_y A pointer to an int to place the cursor's hot_y coordinate in. + * + * This function queries information about an Ecore_Evas' cursor. + * + * @see ecore_evas_cursor_set() + * @see ecore_evas_object_cursor_set() + */ +EAPI void ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y); +/** + * @brief Set the cursor of an Ecore_Evas + * + * @param ee The Ecore_Evas + * + * @param obj The Evas_Object which will be the cursor. + * @param layer The layer in which the cursor will appear. + * @param hot_x The x coordinate of the cursor's hot spot. + * @param hot_y The y coordinate of the cursor's hot spot. + * + * This function makes the mouse cursor over @p ee be the object specified by + * @p obj. The actual point within the object that the mouse is at is specified + * by @p hot_x and @p hot_y, which are coordinates with respect to the top left + * corner of the cursor object. + * + * @see ecore_evas_cursor_set() + */ +EAPI void ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y); +EAPI void ecore_evas_override_set(Ecore_Evas *ee, Eina_Bool on); +EAPI Eina_Bool ecore_evas_override_get(const Ecore_Evas *ee); +EAPI void ecore_evas_avoid_damage_set(Ecore_Evas *ee, Ecore_Evas_Avoid_Damage_Type on); +EAPI Ecore_Evas_Avoid_Damage_Type ecore_evas_avoid_damage_get(const Ecore_Evas *ee); +EAPI void ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool withdrawn); +EAPI Eina_Bool ecore_evas_withdrawn_get(const Ecore_Evas *ee); +EAPI void ecore_evas_sticky_set(Ecore_Evas *ee, Eina_Bool sticky); +EAPI Eina_Bool ecore_evas_sticky_get(const Ecore_Evas *ee); +EAPI void ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render); +EAPI Eina_Bool ecore_evas_manual_render_get(const Ecore_Evas *ee); + +/** + * @brief Registers an @c Ecore_Evas to receive events through ecore_input_evas. + * + * @param ee The @c Ecore_Evas handle. + * + * This function calls ecore_event_window_register() with the @p ee as its @c + * id argument, @c window argument, and uses its @c Evas too. It is useful when + * no @c window information is available on a given @c Ecore_Evas backend. + * + * @see ecore_evas_input_event_unregister() + * @since 1.1 + */ +EAPI void ecore_evas_input_event_register(Ecore_Evas *ee); +/** + * @brief Unregisters an @c Ecore_Evas receiving events through ecore_input_evas. + * + * @param ee The @c Ecore_Evas handle. + * + * @see ecore_evas_input_event_register() + * @since 1.1 + */ +EAPI void ecore_evas_input_event_unregister(Ecore_Evas *ee); + +/** + * @brief Force immediate rendering on a given @c Ecore_Evas window + * + * @param ee An @c Ecore_Evas handle + * + * Use this call to forcefully flush the @p ee's canvas rendering + * pipeline, thus bring its window to an up to date state. + */ +EAPI void ecore_evas_manual_render(Ecore_Evas *ee); +EAPI void ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync); +EAPI Eina_Bool ecore_evas_comp_sync_get(const Ecore_Evas *ee); +/** + * @brief Get geometry of screen associated with this Ecore_Evas. + * + * @param ee The Ecore_Evas whose window's to query container screen geometry. + * @param x where to return the horizontal offset value. May be NULL. + * @param y where to return the vertical offset value. May be NULL. + * @param w where to return the width value. May be NULL. + * @param h where to return the height value. May be NULL. + * + * @since 1.1 + */ +EAPI void ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h); + +/** + * @brief Associate the given object to this ecore evas. + * + * @param ee The Ecore_Evas to associate to @a obj + * @param obj The object to associate to @a ee + * @param flags The association flags. + * @return EINA_TRUE on success, EINA_FALSE otherwise. + * + * Association means that operations on one will affect the other, for + * example moving the object will move the window, resize the object will + * also affect the ecore evas window, hide and show applies as well. + * + * This is meant to simplify development, since you often need to associate + * these events with your "base" objects, background or bottom-most object. + * + * Be aware that some methods might not be what you would like, deleting + * either the window or the object will delete the other. If you want to + * change that behavior, let's say to hide window when it's closed, you + * must use ecore_evas_callback_delete_request_set() and set your own code, + * like ecore_evas_hide(). Just remember that if you override delete_request + * and still want to delete the window/object, you must do that yourself. + * + * Since we now define delete_request, deleting windows will not quit + * main loop, if you wish to do so, you should listen for EVAS_CALLBACK_FREE + * on the object, that way you get notified and you can call + * ecore_main_loop_quit(). + * + * Flags can be OR'ed of: + * @li ECORE_EVAS_OBJECT_ASSOCIATE_BASE (or 0): to listen to basic events + * like delete, resize and move, but no stacking or layer are used. + * @li ECORE_EVAS_OBJECT_ASSOCIATE_STACK: stacking operations will act + * on the Ecore_Evas, not the object. So evas_object_raise() will + * call ecore_evas_raise(). Relative operations (stack_above, stack_below) + * are still not implemented. + * @li ECORE_EVAS_OBJECT_ASSOCIATE_LAYER: stacking operations will act + * on the Ecore_Evas, not the object. So evas_object_layer_set() will + * call ecore_evas_layer_set(). + * @li ECORE_EVAS_OBJECT_ASSOCIATE_DEL: the object delete will delete the + * ecore_evas as well as delete_requests on the ecore_evas will delete + * etc. + */ +EAPI Eina_Bool ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags); +/** + * @brief Cancel the association set with ecore_evas_object_associate(). + * + * @param ee The Ecore_Evas to dissociate from @a obj + * @param obj The object to dissociate from @a ee + * @return EINA_TRUE on success, EINA_FALSE otherwise. + */ +EAPI Eina_Bool ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj); +/** + * @brief Get the object associated with @p ee + * + * @param ee The Ecore_Evas to get the object from. + * @return The associated object, or NULL if there is no associated object. + */ +EAPI Evas_Object *ecore_evas_object_associate_get(const Ecore_Evas *ee); + +/* helper function to be used with ECORE_GETOPT_CALLBACK_*() */ +EAPI unsigned char ecore_getopt_callback_ecore_evas_list_engines(const Ecore_Getopt *parser, const Ecore_Getopt_Desc *desc, const char *str, void *data, Ecore_Getopt_Value *storage); + +/** + * @brief Get a list of all the ecore_evases. + * + * @return A list of ecore_evases. + * + * The returned list of ecore evases is only valid until the canvases are + * destroyed (and should not be cached for instance). The list can be freed by + * just deleting the list. + */ +EAPI Eina_List *ecore_evas_ecore_evas_list_get(void); + +/* specific calls to an x11 environment ecore_evas */ +EAPI void ecore_evas_x11_leader_set(Ecore_Evas *ee, Ecore_X_Window win); +EAPI Ecore_X_Window ecore_evas_x11_leader_get(Ecore_Evas *ee); +EAPI void ecore_evas_x11_leader_default_set(Ecore_Evas *ee); +EAPI void ecore_evas_x11_shape_input_rectangle_set(Ecore_Evas *ee, int x, int y, int w, int h); +EAPI void ecore_evas_x11_shape_input_rectangle_add(Ecore_Evas *ee, int x, int y, int w, int h); +EAPI void ecore_evas_x11_shape_input_rectangle_subtract(Ecore_Evas *ee, int x, int y, int w, int h); +EAPI void ecore_evas_x11_shape_input_empty(Ecore_Evas *ee); +EAPI void ecore_evas_x11_shape_input_reset(Ecore_Evas *ee); +EAPI void ecore_evas_x11_shape_input_apply(Ecore_Evas *ee); + +/** + * @defgroup Ecore_Evas_Ews Ecore_Evas Single Process Windowing System. + * + * These are global scope functions to manage the EWS to be used by + * ecore_evas_ews_new(). + * + * @since 1.1 + * @{ + */ + +/** + * Sets the engine to be used by the backing store engine. + * + * @return EINA_TRUE on success, EINA_FALSE if ews is already in use. + * @since 1.1 + */ +EAPI Eina_Bool ecore_evas_ews_engine_set(const char *engine, const char *options); + +/** + * Reconfigure the backing store used. + * @since 1.1 + */ +EAPI Eina_Bool ecore_evas_ews_setup(int x, int y, int w, int h); + +/** + * Return the internal backing store in use. + * + * @note this will foced it to be created, making future calls to + * ecore_evas_ews_engine_set() void. + * + * @see ecore_evas_ews_evas_get() + * @since 1.1 + */ +EAPI Ecore_Evas *ecore_evas_ews_ecore_evas_get(void); + +/** + * Return the internal backing store in use. + * + * @note this will foced it to be created, making future calls to + * ecore_evas_ews_engine_set() void. + * + * @see ecore_evas_ews_ecore_evas_get() + * @since 1.1 + */ +EAPI Evas *ecore_evas_ews_evas_get(void); + +/** + * Get the current background. + */ +EAPI Evas_Object *ecore_evas_ews_background_get(void); + +/** + * Set the current background, must be created at evas ecore_evas_ews_evas_get() + * + * It will be kept at lowest layer (EVAS_LAYER_MIN) and below + * everything else. You can set any object, default is a black + * rectangle. + * + * @note previous object will be deleted! + */ +EAPI void ecore_evas_ews_background_set(Evas_Object *o); + +/** + * Return all Ecore_Evas* created by EWS. + * + * @note do not change the returned list or its contents. + * @since 1.1 + */ +EAPI const Eina_List *ecore_evas_ews_children_get(void); + +/** + * Set the identifier of the manager taking care of internal windows. + * + * The ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE event is issued. Consider + * handling it to know if you should stop handling events yourself + * (ie: another manager took over) + * + * @param manager any unique identifier address. + * + * @see ecore_evas_ews_manager_get() + * @since 1.1 + */ +EAPI void ecore_evas_ews_manager_set(const void *manager); + +/** + * Get the identifier of the manager taking care of internal windows. + * + * @return the value set by ecore_evas_ews_manager_set() + * @since 1.1 + */ +EAPI const void *ecore_evas_ews_manager_get(void); + +EAPI extern int ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE; /**< manager was changed */ +EAPI extern int ECORE_EVAS_EWS_EVENT_ADD; /**< window was created */ +EAPI extern int ECORE_EVAS_EWS_EVENT_DEL; /**< window was deleted, pointer is already invalid but may be used as reference for further cleanup work. */ +EAPI extern int ECORE_EVAS_EWS_EVENT_RESIZE; /**< window was resized */ +EAPI extern int ECORE_EVAS_EWS_EVENT_MOVE; /**< window was moved */ +EAPI extern int ECORE_EVAS_EWS_EVENT_SHOW; /**< window become visible */ +EAPI extern int ECORE_EVAS_EWS_EVENT_HIDE; /**< window become hidden */ +EAPI extern int ECORE_EVAS_EWS_EVENT_FOCUS; /**< window was focused */ +EAPI extern int ECORE_EVAS_EWS_EVENT_UNFOCUS; /**< window lost focus */ +EAPI extern int ECORE_EVAS_EWS_EVENT_RAISE; /**< window was raised */ +EAPI extern int ECORE_EVAS_EWS_EVENT_LOWER; /**< window was lowered */ +EAPI extern int ECORE_EVAS_EWS_EVENT_ACTIVATE; /**< window was activated */ + +EAPI extern int ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE; /**< window minimized/iconified changed */ +EAPI extern int ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE; /**< window maximized changed */ +EAPI extern int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE; /**< window layer changed */ +EAPI extern int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE; /**< window fullscreen changed */ +EAPI extern int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE; /**< some other window property changed (title, name, class, alpha, transparent, shaped...) */ + +/** + * @} + */ + + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/ecore/src/lib/ecore_evas/Makefile.am b/libraries/ecore/src/lib/ecore_evas/Makefile.am new file mode 100644 index 0000000..fbb7190 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/Makefile.am @@ -0,0 +1,131 @@ +MAINTAINERCLEANFILES = Makefile.in + +if BUILD_ECORE_X +ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ @ECORE_XCB_CFLAGS@ +ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@ @ECORE_XCB_LIBS@ +else +ECORE_X_INC = +ECORE_X_LIB = +endif + +if BUILD_ECORE_FB +ECORE_FB_INC = -I$(top_srcdir)/src/lib/ecore_fb +ECORE_FB_LIB = $(top_builddir)/src/lib/ecore_fb/libecore_fb.la +else +ECORE_FB_INC = +ECORE_FB_LIB = +endif + +if BUILD_ECORE_DIRECTFB +ECORE_DIRECTFB_INC = -I$(top_srcdir)/src/lib/ecore_directfb -I@DIRECTFB_CFLAGS@ +ECORE_DIRECTFB_LIB = $(top_builddir)/src/lib/ecore_directfb/libecore_directfb.la +else +ECORE_DIRECTFB_INC = +ECORE_DIRECTFB_LIB = +endif + +if BUILD_ECORE_WIN32 +ECORE_WIN32_INC = -I$(top_srcdir)/src/lib/ecore_win32 +ECORE_WIN32_LIB = $(top_builddir)/src/lib/ecore_win32/libecore_win32.la +else +ECORE_WIN32_INC = +ECORE_WIN32_LIB = +endif + +if BUILD_ECORE_SDL +ECORE_SDL_INC = -I$(top_srcdir)/src/lib/ecore_sdl @SDL_CFLAGS@ +ECORE_SDL_LIB = $(top_builddir)/src/lib/ecore_sdl/libecore_sdl.la +ECORE_SDL_LIBADD = @SDL_LIBS@ $(ECORE_SDL_LIB) +else +ECORE_SDL_INC = +ECORE_SDL_LIB = +ECORE_SDL_LIBADD = +endif + +if BUILD_ECORE_COCOA +ECORE_COCOA_INC = -I$(top_srcdir)/src/lib/ecore_cocoa +ECORE_COCOA_LIB = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la +else +ECORE_COCOA_INC = +ECORE_COCOA_LIB = +endif + +if BUILD_ECORE_WINCE +ECORE_WINCE_INC = -I$(top_srcdir)/src/lib/ecore_wince +ECORE_WINCE_LIB = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la +else +ECORE_WINCE_INC = +ECORE_WINCE_LIB = +endif + +if BUILD_ECORE_PSL1GHT +ECORE_PSL1GHT_INC = -I$(top_srcdir)/src/lib/ecore_psl1ght +ECORE_PSL1GHT_LIB = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la +else +ECORE_PSL1GHT_INC = +ECORE_PSL1GHT_LIB = +endif + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_evas \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_srcdir)/src/lib/ecore_input_evas \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_evas \ +-I$(top_builddir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore_input_evas \ +@EFL_ECORE_EVAS_BUILD@ \ +$(ECORE_X_INC) \ +$(ECORE_FB_INC) \ +$(ECORE_DIRECTFB_INC) \ +$(ECORE_WIN32_INC) \ +$(ECORE_SDL_INC) \ +$(ECORE_COCOA_INC) \ +$(ECORE_WINCE_INC) \ +$(ECORE_PSL1GHT_INC) \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ \ +@EVIL_CFLAGS@ + +AM_CFLAGS = @WIN32_CFLAGS@ + +lib_LTLIBRARIES = libecore_evas.la +includes_HEADERS = Ecore_Evas.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_evas_la_SOURCES = \ +ecore_evas.c \ +ecore_evas_util.c \ +ecore_evas_x.c \ +ecore_evas_fb.c \ +ecore_evas_buffer.c \ +ecore_evas_directfb.c \ +ecore_evas_win32.c \ +ecore_evas_sdl.c \ +ecore_evas_cocoa.c \ +ecore_evas_wince.c \ +ecore_evas_ews.c \ +ecore_evas_psl1ght.c + +libecore_evas_la_LIBADD = \ +$(ECORE_X_LIB) \ +$(ECORE_FB_LIB) \ +$(ECORE_DIRECTFB_LIB) \ +$(ECORE_WIN32_LIB) \ +$(ECORE_SDL_LIB) \ +$(ECORE_SDL_LIBADD) \ +$(ECORE_COCOA_LIB) \ +$(ECORE_WINCE_LIB) \ +$(ECORE_PSL1GHT_LIB) \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +$(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EVAS_LIBS@ \ +@EINA_LIBS@ \ +@EVIL_LIBS@ + +libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ + +EXTRA_DIST = \ +ecore_evas_private.h diff --git a/libraries/ecore/src/lib/ecore_evas/Makefile.in b/libraries/ecore/src/lib/ecore_evas/Makefile.in new file mode 100644 index 0000000..793e59d --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/Makefile.in @@ -0,0 +1,921 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_evas +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +@BUILD_ECORE_X_TRUE@am__DEPENDENCIES_1 = $(top_builddir)/src/lib/ecore_x/libecore_x.la +@BUILD_ECORE_FB_TRUE@am__DEPENDENCIES_2 = $(top_builddir)/src/lib/ecore_fb/libecore_fb.la +@BUILD_ECORE_DIRECTFB_TRUE@am__DEPENDENCIES_3 = $(top_builddir)/src/lib/ecore_directfb/libecore_directfb.la +@BUILD_ECORE_WIN32_TRUE@am__DEPENDENCIES_4 = $(top_builddir)/src/lib/ecore_win32/libecore_win32.la +@BUILD_ECORE_SDL_TRUE@am__DEPENDENCIES_5 = $(top_builddir)/src/lib/ecore_sdl/libecore_sdl.la +@BUILD_ECORE_SDL_TRUE@am__DEPENDENCIES_6 = $(am__DEPENDENCIES_5) +@BUILD_ECORE_COCOA_TRUE@am__DEPENDENCIES_7 = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la +@BUILD_ECORE_WINCE_TRUE@am__DEPENDENCIES_8 = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la +@BUILD_ECORE_PSL1GHT_TRUE@am__DEPENDENCIES_9 = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la +libecore_evas_la_DEPENDENCIES = $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_3) \ + $(am__DEPENDENCIES_4) $(am__DEPENDENCIES_5) \ + $(am__DEPENDENCIES_6) $(am__DEPENDENCIES_7) \ + $(am__DEPENDENCIES_8) $(am__DEPENDENCIES_9) \ + $(top_builddir)/src/lib/ecore_input/libecore_input.la \ + $(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ + $(top_builddir)/src/lib/ecore/libecore.la +am_libecore_evas_la_OBJECTS = ecore_evas.lo ecore_evas_util.lo \ + ecore_evas_x.lo ecore_evas_fb.lo ecore_evas_buffer.lo \ + ecore_evas_directfb.lo ecore_evas_win32.lo ecore_evas_sdl.lo \ + ecore_evas_cocoa.lo ecore_evas_wince.lo ecore_evas_ews.lo \ + ecore_evas_psl1ght.lo +libecore_evas_la_OBJECTS = $(am_libecore_evas_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_evas_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libecore_evas_la_LDFLAGS) $(LDFLAGS) \ + -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_evas_la_SOURCES) +DIST_SOURCES = $(libecore_evas_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +@BUILD_ECORE_X_FALSE@ECORE_X_INC = +@BUILD_ECORE_X_TRUE@ECORE_X_INC = -I$(top_srcdir)/src/lib/ecore_x @x_cflags@ @ECORE_XCB_CFLAGS@ +@BUILD_ECORE_X_FALSE@ECORE_X_LIB = +@BUILD_ECORE_X_TRUE@ECORE_X_LIB = $(top_builddir)/src/lib/ecore_x/libecore_x.la @x_libs@ @ECORE_XCB_LIBS@ +@BUILD_ECORE_FB_FALSE@ECORE_FB_INC = +@BUILD_ECORE_FB_TRUE@ECORE_FB_INC = -I$(top_srcdir)/src/lib/ecore_fb +@BUILD_ECORE_FB_FALSE@ECORE_FB_LIB = +@BUILD_ECORE_FB_TRUE@ECORE_FB_LIB = $(top_builddir)/src/lib/ecore_fb/libecore_fb.la +@BUILD_ECORE_DIRECTFB_FALSE@ECORE_DIRECTFB_INC = +@BUILD_ECORE_DIRECTFB_TRUE@ECORE_DIRECTFB_INC = -I$(top_srcdir)/src/lib/ecore_directfb -I@DIRECTFB_CFLAGS@ +@BUILD_ECORE_DIRECTFB_FALSE@ECORE_DIRECTFB_LIB = +@BUILD_ECORE_DIRECTFB_TRUE@ECORE_DIRECTFB_LIB = $(top_builddir)/src/lib/ecore_directfb/libecore_directfb.la +@BUILD_ECORE_WIN32_FALSE@ECORE_WIN32_INC = +@BUILD_ECORE_WIN32_TRUE@ECORE_WIN32_INC = -I$(top_srcdir)/src/lib/ecore_win32 +@BUILD_ECORE_WIN32_FALSE@ECORE_WIN32_LIB = +@BUILD_ECORE_WIN32_TRUE@ECORE_WIN32_LIB = $(top_builddir)/src/lib/ecore_win32/libecore_win32.la +@BUILD_ECORE_SDL_FALSE@ECORE_SDL_INC = +@BUILD_ECORE_SDL_TRUE@ECORE_SDL_INC = -I$(top_srcdir)/src/lib/ecore_sdl @SDL_CFLAGS@ +@BUILD_ECORE_SDL_FALSE@ECORE_SDL_LIB = +@BUILD_ECORE_SDL_TRUE@ECORE_SDL_LIB = $(top_builddir)/src/lib/ecore_sdl/libecore_sdl.la +@BUILD_ECORE_SDL_FALSE@ECORE_SDL_LIBADD = +@BUILD_ECORE_SDL_TRUE@ECORE_SDL_LIBADD = @SDL_LIBS@ $(ECORE_SDL_LIB) +@BUILD_ECORE_COCOA_FALSE@ECORE_COCOA_INC = +@BUILD_ECORE_COCOA_TRUE@ECORE_COCOA_INC = -I$(top_srcdir)/src/lib/ecore_cocoa +@BUILD_ECORE_COCOA_FALSE@ECORE_COCOA_LIB = +@BUILD_ECORE_COCOA_TRUE@ECORE_COCOA_LIB = $(top_builddir)/src/lib/ecore_cocoa/libecore_cocoa.la +@BUILD_ECORE_WINCE_FALSE@ECORE_WINCE_INC = +@BUILD_ECORE_WINCE_TRUE@ECORE_WINCE_INC = -I$(top_srcdir)/src/lib/ecore_wince +@BUILD_ECORE_WINCE_FALSE@ECORE_WINCE_LIB = +@BUILD_ECORE_WINCE_TRUE@ECORE_WINCE_LIB = $(top_builddir)/src/lib/ecore_wince/libecore_wince.la +@BUILD_ECORE_PSL1GHT_FALSE@ECORE_PSL1GHT_INC = +@BUILD_ECORE_PSL1GHT_TRUE@ECORE_PSL1GHT_INC = -I$(top_srcdir)/src/lib/ecore_psl1ght +@BUILD_ECORE_PSL1GHT_FALSE@ECORE_PSL1GHT_LIB = +@BUILD_ECORE_PSL1GHT_TRUE@ECORE_PSL1GHT_LIB = $(top_builddir)/src/lib/ecore_psl1ght/libecore_psl1ght.la +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_evas \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_srcdir)/src/lib/ecore_input_evas \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_evas \ +-I$(top_builddir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore_input_evas \ +@EFL_ECORE_EVAS_BUILD@ \ +$(ECORE_X_INC) \ +$(ECORE_FB_INC) \ +$(ECORE_DIRECTFB_INC) \ +$(ECORE_WIN32_INC) \ +$(ECORE_SDL_INC) \ +$(ECORE_COCOA_INC) \ +$(ECORE_WINCE_INC) \ +$(ECORE_PSL1GHT_INC) \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ \ +@EVIL_CFLAGS@ + +AM_CFLAGS = @WIN32_CFLAGS@ +lib_LTLIBRARIES = libecore_evas.la +includes_HEADERS = Ecore_Evas.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_evas_la_SOURCES = \ +ecore_evas.c \ +ecore_evas_util.c \ +ecore_evas_x.c \ +ecore_evas_fb.c \ +ecore_evas_buffer.c \ +ecore_evas_directfb.c \ +ecore_evas_win32.c \ +ecore_evas_sdl.c \ +ecore_evas_cocoa.c \ +ecore_evas_wince.c \ +ecore_evas_ews.c \ +ecore_evas_psl1ght.c + +libecore_evas_la_LIBADD = \ +$(ECORE_X_LIB) \ +$(ECORE_FB_LIB) \ +$(ECORE_DIRECTFB_LIB) \ +$(ECORE_WIN32_LIB) \ +$(ECORE_SDL_LIB) \ +$(ECORE_SDL_LIBADD) \ +$(ECORE_COCOA_LIB) \ +$(ECORE_WINCE_LIB) \ +$(ECORE_PSL1GHT_LIB) \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +$(top_builddir)/src/lib/ecore_input_evas/libecore_input_evas.la \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EVAS_LIBS@ \ +@EINA_LIBS@ \ +@EVIL_LIBS@ + +libecore_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ +EXTRA_DIST = \ +ecore_evas_private.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_evas/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_evas/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_evas.la: $(libecore_evas_la_OBJECTS) $(libecore_evas_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_evas_la_LINK) -rpath $(libdir) $(libecore_evas_la_OBJECTS) $(libecore_evas_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_buffer.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_cocoa.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_directfb.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_ews.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_fb.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_psl1ght.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_sdl.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_util.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_win32.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_wince.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_evas_x.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas.c new file mode 100644 index 0000000..dc42f92 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas.c @@ -0,0 +1,2588 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#ifndef _MSC_VER +# include +#endif + +#ifdef HAVE_EVIL +# include +#endif + +#include "Ecore.h" +#include "ecore_private.h" +#include "Ecore_Input.h" + +#include "ecore_evas_private.h" +#include "Ecore_Evas.h" + +Eina_Bool _ecore_evas_app_comp_sync = 1; +int _ecore_evas_log_dom = -1; +static int _ecore_evas_init_count = 0; +static Ecore_Fd_Handler *_ecore_evas_async_events_fd = NULL; +static Eina_Bool _ecore_evas_async_events_fd_handler(void *data, Ecore_Fd_Handler *fd_handler); + +static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; +static Ecore_Evas *ecore_evases = NULL; +static int _ecore_evas_fps_debug = 0; + +static Eina_Bool +_ecore_evas_idle_enter(void *data __UNUSED__) +{ + Ecore_Evas *ee; + double t1 = 0.0; + double t2 = 0.0; + int rend = 0; + + if (!ecore_evases) return ECORE_CALLBACK_RENEW; + if (_ecore_evas_fps_debug) + { + t1 = ecore_time_get(); + } + EINA_INLIST_FOREACH(ecore_evases, ee) + { + if (!ee->manual_render) + { + if (ee->engine.func->fn_render) + rend |= ee->engine.func->fn_render(ee); + } + } + if (_ecore_evas_fps_debug) + { + t2 = ecore_time_get(); + if (rend) + _ecore_evas_fps_debug_rendertime_add(t2 - t1); + } + return ECORE_CALLBACK_RENEW; +} + +/** + * Query if a particular renginering engine target has support + * @param engine The engine to check support for + * @return 1 if the particular engine is supported, 0 if it is not + * + * Query if engine @param engine is supported by ecore_evas. 1 is returned if + * it is, and 0 is returned if it is not supported. + */ +EAPI int +ecore_evas_engine_type_supported_get(Ecore_Evas_Engine_Type engine) +{ + switch (engine) + { + case ECORE_EVAS_ENGINE_SOFTWARE_BUFFER: +#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_SOFTWARE_XLIB: +#ifdef BUILD_ECORE_EVAS_SOFTWARE_XLIB + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_XRENDER_X11: + return EINA_FALSE; + case ECORE_EVAS_ENGINE_OPENGL_X11: +#ifdef BUILD_ECORE_EVAS_OPENGL_X11 + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_SOFTWARE_XCB: +#ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_XRENDER_XCB: + return EINA_FALSE; + case ECORE_EVAS_ENGINE_SOFTWARE_GDI: +#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_SOFTWARE_DDRAW: +#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_DIRECT3D: +#ifdef BUILD_ECORE_EVAS_DIRECT3D + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_OPENGL_GLEW: +#ifdef BUILD_ECORE_EVAS_OPENGL_GLEW + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_SOFTWARE_SDL: +#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_OPENGL_SDL: +#ifdef BUILD_ECORE_EVAS_OPENGL_SDL + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_DIRECTFB: +#ifdef BUILD_ECORE_EVAS_DIRECTFB + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_SOFTWARE_FB: +#ifdef BUILD_ECORE_EVAS_FB + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + + case ECORE_EVAS_ENGINE_SOFTWARE_8_X11: +#ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + + case ECORE_EVAS_ENGINE_SOFTWARE_16_X11: +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11 + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_SOFTWARE_16_DDRAW: +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_SOFTWARE_16_WINCE: +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_OPENGL_COCOA: +#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_EWS: +#ifdef BUILD_ECORE_EVAS_EWS + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + case ECORE_EVAS_ENGINE_PSL1GHT: +#ifdef BUILD_ECORE_EVAS_PSL1GHT + return EINA_TRUE; +#else + return EINA_FALSE; +#endif + default: + return EINA_FALSE; + }; +} + +EAPI int +ecore_evas_init(void) +{ + int fd; + + if (++_ecore_evas_init_count != 1) + return _ecore_evas_init_count; + + if (!evas_init()) + return --_ecore_evas_init_count; + + if (!ecore_init()) + goto shutdown_evas; + + _ecore_evas_log_dom = eina_log_domain_register + ("ecore_evas", ECORE_EVAS_DEFAULT_LOG_COLOR); + if(_ecore_evas_log_dom < 0) + { + EINA_LOG_ERR("Impossible to create a log domain for Ecore_Evas."); + goto shutdown_ecore; + } + + fd = evas_async_events_fd_get(); + if (fd > 0) + _ecore_evas_async_events_fd = ecore_main_fd_handler_add(fd, + ECORE_FD_READ, + _ecore_evas_async_events_fd_handler, NULL, + NULL, NULL); + + ecore_evas_idle_enterer = + ecore_idle_enterer_add(_ecore_evas_idle_enter, NULL); + if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1; + if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init(); + +#ifdef BUILD_ECORE_EVAS_EWS + _ecore_evas_ews_events_init(); +#endif + + if (getenv("ECORE_EVAS_COMP_NOSYNC")) + _ecore_evas_app_comp_sync = 0; + return _ecore_evas_init_count; + + shutdown_ecore: + ecore_shutdown(); + shutdown_evas: + evas_shutdown(); + + return --_ecore_evas_init_count; +} + +EAPI int +ecore_evas_shutdown(void) +{ + if (--_ecore_evas_init_count != 0) + return _ecore_evas_init_count; + + while (ecore_evases) _ecore_evas_free(ecore_evases); + + if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown(); + ecore_idle_enterer_del(ecore_evas_idle_enterer); + ecore_evas_idle_enterer = NULL; + +#ifdef BUILD_ECORE_EVAS_X11 + while (_ecore_evas_x_shutdown()); +#endif +#ifdef BUILD_ECORE_EVAS_WIN32 + while (_ecore_evas_win32_shutdown()); +#endif +#ifdef BUILD_ECORE_EVAS_FB + while (_ecore_evas_fb_shutdown()); +#endif +#ifdef BUILD_ECORE_EVAS_EWS + while (_ecore_evas_ews_shutdown()); +#endif +#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER + while (_ecore_evas_buffer_shutdown()); +#endif +#ifdef BUILD_ECORE_EVAS_DIRECTFB + while (_ecore_evas_directfb_shutdown()); +#endif +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE + while (_ecore_evas_wince_shutdown()); +#endif + if (_ecore_evas_async_events_fd) + ecore_main_fd_handler_del(_ecore_evas_async_events_fd); + + eina_log_domain_unregister(_ecore_evas_log_dom); + _ecore_evas_log_dom = -1; + ecore_shutdown(); + evas_shutdown(); + + return _ecore_evas_init_count; +} + +EAPI void +ecore_evas_app_comp_sync_set(Eina_Bool do_sync) +{ + _ecore_evas_app_comp_sync = do_sync; +} + +EAPI Eina_Bool +ecore_evas_app_comp_sync_get(void) +{ + return _ecore_evas_app_comp_sync; +} + +struct ecore_evas_engine { + const char *name; + Ecore_Evas *(*constructor)(int x, int y, int w, int h, const char *extra_options); +}; + +/* inline is just to avoid need to ifdef around it */ +static inline const char * +_ecore_evas_parse_extra_options_str(const char *extra_options, const char *key, char **value) +{ + int len = strlen(key); + + while (extra_options) + { + const char *p; + + if (strncmp(extra_options, key, len) != 0) + { + extra_options = strchr(extra_options, ';'); + if (extra_options) + extra_options++; + continue; + } + + extra_options += len; + p = strchr(extra_options, ';'); + if (p) + { + len = p - extra_options; + *value = malloc(len + 1); + memcpy(*value, extra_options, len); + (*value)[len] = '\0'; + extra_options = p + 1; + } + else + { + *value = strdup(extra_options); + extra_options = NULL; + } + } + return extra_options; +} + +/* inline is just to avoid need to ifdef around it */ +static inline const char * +_ecore_evas_parse_extra_options_uint(const char *extra_options, const char *key, unsigned int *value) +{ + int len = strlen(key); + + while (extra_options) + { + const char *p; + + if (strncmp(extra_options, key, len) != 0) + { + extra_options = strchr(extra_options, ';'); + if (extra_options) + extra_options++; + continue; + } + + extra_options += len; + *value = strtol(extra_options, NULL, 0); + + p = strchr(extra_options, ';'); + if (p) + extra_options = p + 1; + else + extra_options = NULL; + } + return extra_options; +} + +/* inline is just to avoid need to ifdef around it */ +static inline const char * +_ecore_evas_parse_extra_options_x(const char *extra_options, char **disp_name, unsigned int *parent) +{ + _ecore_evas_parse_extra_options_str(extra_options, "display=", disp_name); + _ecore_evas_parse_extra_options_uint(extra_options, "parent=", parent); + return extra_options; +} + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 +static Ecore_Evas * +_ecore_evas_constructor_software_x11(int x, int y, int w, int h, const char *extra_options) +{ + unsigned int parent = 0; + char *disp_name = NULL; + Ecore_Evas *ee; + + _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); + ee = ecore_evas_software_x11_new(disp_name, parent, x, y, w, h); + free(disp_name); + + return ee; +} +#endif + +#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA +static Ecore_Evas * +_ecore_evas_constructor_cocoa(int x, int y, int w, int h, const char *extra_options) +{ + char *name = NULL; + Ecore_Evas *ee; + + _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); + ee = ecore_evas_cocoa_new(NULL, x, y, w, h); + free(name); + + if (ee) ecore_evas_move(ee, x, y); + return ee; +} +#endif + +#ifdef BUILD_ECORE_EVAS_OPENGL_X11 +static Ecore_Evas * +_ecore_evas_constructor_opengl_x11(int x, int y, int w, int h, const char *extra_options) +{ + Ecore_X_Window parent = 0; + char *disp_name = NULL; + Ecore_Evas *ee; + + _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); + ee = ecore_evas_gl_x11_new(disp_name, parent, x, y, w, h); + free(disp_name); + + return ee; +} +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 +static Ecore_Evas * +_ecore_evas_constructor_software_8_x11(int x, int y, int w, int h, const char *extra_options) +{ + Ecore_X_Window parent = 0; + char *disp_name = NULL; + Ecore_Evas *ee; + + _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); + ee = ecore_evas_software_x11_8_new(disp_name, parent, x, y, w, h); + free(disp_name); + + return ee; +} +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11 +static Ecore_Evas * +_ecore_evas_constructor_software_16_x11(int x, int y, int w, int h, const char *extra_options) +{ + Ecore_X_Window parent = 0; + char *disp_name = NULL; + Ecore_Evas *ee; + + _ecore_evas_parse_extra_options_x(extra_options, &disp_name, &parent); + ee = ecore_evas_software_x11_16_new(disp_name, parent, x, y, w, h); + free(disp_name); + + return ee; +} +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL +static Ecore_Evas * +_ecore_evas_constructor_sdl(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) +{ + Ecore_Evas *ee; + unsigned int fullscreen = 0, hwsurface = 0, noframe = 0, alpha = 0; + char *name = NULL; + + _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); + _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen); + _ecore_evas_parse_extra_options_uint(extra_options, "hwsurface=", &hwsurface); + _ecore_evas_parse_extra_options_uint(extra_options, "noframe=", &noframe); + _ecore_evas_parse_extra_options_uint(extra_options, "alpha=", &alpha); + + ee = ecore_evas_sdl_new(name, w, h, fullscreen, hwsurface, noframe, alpha); + free(name); + + return ee; +} + +static Ecore_Evas * +_ecore_evas_constructor_sdl16(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) +{ + Ecore_Evas *ee; + unsigned int fullscreen = 0, hwsurface = 0, noframe = 0, alpha = 0; + char *name = NULL; + + _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); + _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen); + _ecore_evas_parse_extra_options_uint(extra_options, "hwsurface=", &hwsurface); + _ecore_evas_parse_extra_options_uint(extra_options, "alpha=", &alpha); + + ee = ecore_evas_sdl16_new(name, w, h, fullscreen, hwsurface, noframe, alpha); + free(name); + + return ee; +} +#endif + +#ifdef BUILD_ECORE_EVAS_OPENGL_SDL +static Ecore_Evas * +_ecore_evas_constructor_opengl_sdl(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) +{ + Ecore_Evas *ee; + unsigned int fullscreen = 0, noframe = 0; + char *name = NULL; + + _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); + _ecore_evas_parse_extra_options_uint(extra_options, "fullscreen=", &fullscreen); + _ecore_evas_parse_extra_options_uint(extra_options, "noframe=", &noframe); + + ee = ecore_evas_gl_sdl_new(name, w, h, fullscreen, noframe); + free(name); + + return ee; +} +#endif + +#ifdef BUILD_ECORE_EVAS_DIRECTFB +static Ecore_Evas * +_ecore_evas_constructor_directfb(int x, int y, int w, int h, const char *extra_options) +{ + Ecore_Evas *ee; + char *disp_name = NULL; + unsigned int windowed = 1; + + _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); + _ecore_evas_parse_extra_options_uint(extra_options, "windowed=", &windowed); + + ee = ecore_evas_directfb_new(disp_name, windowed, x, y, w, h); + free(disp_name); + + return ee; +} +#endif + +#ifdef BUILD_ECORE_EVAS_FB +static Ecore_Evas * +_ecore_evas_constructor_fb(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) +{ + Ecore_Evas *ee; + char *disp_name = NULL; + unsigned int rotation = 0; + + _ecore_evas_parse_extra_options_str(extra_options, "display=", &disp_name); + _ecore_evas_parse_extra_options_uint(extra_options, "rotation=", &rotation); + + ee = ecore_evas_fb_new(disp_name, rotation, w, h); + free(disp_name); + + return ee; +} +#endif + + +#ifdef BUILD_ECORE_EVAS_PSL1GHT +static Ecore_Evas * +_ecore_evas_constructor_psl1ght(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options) +{ + Ecore_Evas *ee; + char *name = NULL; + + _ecore_evas_parse_extra_options_str(extra_options, "name=", &name); + ee = ecore_evas_psl1ght_new(name, w, h); + free(name); + + if (ee) ecore_evas_move(ee, x, y); + return ee; +} +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI +static Ecore_Evas * +_ecore_evas_constructor_software_gdi(int x, int y, int w, int h, const char *extra_options) +{ + return ecore_evas_software_gdi_new(NULL, x, y, w, h); +} +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW +static Ecore_Evas * +_ecore_evas_constructor_software_ddraw(int x, int y, int w, int h, const char *extra_options) +{ + return ecore_evas_software_ddraw_new(NULL, x, y, w, h); +} +#endif + +#ifdef BUILD_ECORE_EVAS_DIRECT3D +static Ecore_Evas * +_ecore_evas_constructor_direct3d(int x, int y, int w, int h, const char *extra_options) +{ + return ecore_evas_direct3d_new(NULL, x, y, w, h); +} +#endif + +#ifdef BUILD_ECORE_EVAS_OPENGL_GLEW +static Ecore_Evas * +_ecore_evas_constructor_opengl_glew(int x, int y, int w, int h, const char *extra_options) +{ + return ecore_evas_gl_glew_new(NULL, x, y, w, h); +} +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW +static Ecore_Evas * +_ecore_evas_constructor_software_16_ddraw(int x, int y, int w, int h, const char *extra_options) +{ + return ecore_evas_software_16_ddraw_new(NULL, x, y, w, h); +} +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE +static Ecore_Evas * +_ecore_evas_constructor_software_16_wince(int x, int y, int w, int h, const char *extra_options __UNUSED__) +{ + return ecore_evas_software_wince_new(NULL, x, y, w, h); +} + +static Ecore_Evas * +_ecore_evas_constructor_software_16_wince_fb(int x, int y, int w, int h, const char *extra_options __UNUSED__) +{ + return ecore_evas_software_wince_fb_new(NULL, x, y, w, h); +} + +static Ecore_Evas * +_ecore_evas_constructor_software_16_wince_gapi(int x, int y, int w, int h, const char *extra_options __UNUSED__) +{ + return ecore_evas_software_wince_gapi_new(NULL, x, y, w, h); +} + +static Ecore_Evas * +_ecore_evas_constructor_software_16_wince_gdi(int x, int y, int w, int h, const char *extra_options __UNUSED__) +{ + return ecore_evas_software_wince_gdi_new(NULL, x, y, w, h); +} +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER +static Ecore_Evas * +_ecore_evas_constructor_buffer(int x __UNUSED__, int y __UNUSED__, int w, int h, const char *extra_options __UNUSED__) +{ + return ecore_evas_buffer_new(w, h); +} +#endif + +#ifdef BUILD_ECORE_EVAS_EWS +static Ecore_Evas * +_ecore_evas_constructor_ews(int x, int y, int w, int h, const char *extra_options __UNUSED__) +{ + return ecore_evas_ews_new(x, y, w, h); +} +#endif + +/* note: keep sorted by priority, highest first */ +static const struct ecore_evas_engine _engines[] = { + /* unix */ +#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 + {"software_x11", _ecore_evas_constructor_software_x11}, +#endif +#ifdef BUILD_ECORE_EVAS_OPENGL_X11 + {"opengl_x11", _ecore_evas_constructor_opengl_x11}, +#endif +#ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 + {"software_8_x11", _ecore_evas_constructor_software_8_x11}, +#endif +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11 + {"software_16_x11", _ecore_evas_constructor_software_16_x11}, +#endif +#ifdef BUILD_ECORE_EVAS_DIRECTFB + {"directfb", _ecore_evas_constructor_directfb}, +#endif +#ifdef BUILD_ECORE_EVAS_FB + {"fb", _ecore_evas_constructor_fb}, +#endif + + /* windows */ +#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI + {"software_gdi", _ecore_evas_constructor_software_gdi}, +#endif +#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW + {"software_ddraw", _ecore_evas_constructor_software_ddraw}, +#endif +#ifdef BUILD_ECORE_EVAS_DIRECT3D + {"direct3d", _ecore_evas_constructor_direct3d}, +#endif +#ifdef BUILD_ECORE_EVAS_OPENGL_GLEW + {"opengl_glew", _ecore_evas_constructor_opengl_glew}, +#endif +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW + {"software_16_ddraw", _ecore_evas_constructor_software_16_ddraw}, +#endif +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE + {"software_16_wince", _ecore_evas_constructor_software_16_wince}, + {"software_16_wince_fb", _ecore_evas_constructor_software_16_wince_fb}, + {"software_16_wince_gapi", _ecore_evas_constructor_software_16_wince_gapi}, + {"software_16_wince_gdi", _ecore_evas_constructor_software_16_wince_gdi}, +#endif + + /* Apple */ +#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA + {"opengl_cocoa", _ecore_evas_constructor_cocoa}, +#endif + + /* PS3 support */ +#ifdef BUILD_ECORE_EVAS_PSL1GHT + {"psl1ght", _ecore_evas_constructor_psl1ght}, +#endif + + /* Last chance to have a window */ +#ifdef BUILD_ECORE_EVAS_OPENGL_SDL + {"opengl_sdl", _ecore_evas_constructor_opengl_sdl}, +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL + {"sdl", _ecore_evas_constructor_sdl}, + {"software_16_sdl", _ecore_evas_constructor_sdl16}, +#endif + + /* independent */ +#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER + {"buffer", _ecore_evas_constructor_buffer}, +#endif + +#ifdef BUILD_ECORE_EVAS_EWS + {"ews", _ecore_evas_constructor_ews}, +#endif + {NULL, NULL} +}; + +EAPI Eina_List * +ecore_evas_engines_get(void) +{ + const struct ecore_evas_engine *itr; + Eina_List *lst = NULL; + + for (itr = _engines; itr->name; itr++) + lst = eina_list_append(lst, itr->name); + + return lst; +} + +EAPI void +ecore_evas_engines_free(Eina_List *engines) +{ + eina_list_free(engines); +} + +static Ecore_Evas * +_ecore_evas_new_auto_discover(int x, int y, int w, int h, const char *extra_options) +{ + const struct ecore_evas_engine *itr; + + DBG("auto discover engine"); + + for (itr = _engines; itr->constructor; itr++) + { + Ecore_Evas *ee = itr->constructor(x, y, w, h, extra_options); + if (ee) + { + INF("auto discovered '%s'", itr->name); + return ee; + } + } + + WRN("could not auto discover."); + return NULL; +} + +EAPI Ecore_Evas * +ecore_evas_new(const char *engine_name, int x, int y, int w, int h, const char *extra_options) +{ + const struct ecore_evas_engine *itr; + + if (!engine_name) + { + engine_name = getenv("ECORE_EVAS_ENGINE"); + if (engine_name) + DBG("no engine_name provided, using ECORE_EVAS_ENGINE='%s'", + engine_name); + } + if (!engine_name) + return _ecore_evas_new_auto_discover(x, y, w, h, extra_options); + + for (itr = _engines; itr->name; itr++) + if (strcmp(itr->name, engine_name) == 0) + { + INF("using engine '%s', extra_options=%s", + engine_name, extra_options ? extra_options : "(null)"); + return itr->constructor(x, y, w, h, extra_options); + } + + WRN("unknown engine '%s'", engine_name); + return NULL; +} + +EAPI const char * +ecore_evas_engine_name_get(const Ecore_Evas *ee) +{ + if (!ee) + return NULL; + return ee->driver; +} + +EAPI Ecore_Evas * +ecore_evas_ecore_evas_get(const Evas *e) +{ + Ecore_Evas *ee = evas_data_attach_get(e); + if (!ee) return NULL; + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, "ecore_evas_ecore_evas_get"); + return NULL; + } + return ee; +} + +EAPI void +ecore_evas_free(Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_free"); + return; + } + _ecore_evas_free(ee); + return; +} + +EAPI void * +ecore_evas_data_get(const Ecore_Evas *ee, const char *key) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_data_get"); + return NULL; + } + + if (!key) return NULL; + if (!ee->data) return NULL; + + return eina_hash_find(ee->data, key); +} + +EAPI void +ecore_evas_data_set(Ecore_Evas *ee, const char *key, const void *data) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_data_set"); + return; + } + + if (!key) return; + + if (ee->data) + eina_hash_del(ee->data, key, NULL); + if (data) + { + if (!ee->data) + ee->data = eina_hash_string_superfast_new(NULL); + eina_hash_add(ee->data, key, data); + } +} + +#define IFC(_ee, _fn) if (_ee->engine.func->_fn) {_ee->engine.func->_fn +#define IFE return;} + +EAPI void +ecore_evas_callback_resize_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_resize_set"); + return; + } + IFC(ee, fn_callback_resize_set) (ee, func); + IFE; + ee->func.fn_resize = func; +} + +EAPI void +ecore_evas_callback_move_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_move_set"); + return; + } + IFC(ee, fn_callback_move_set) (ee, func); + IFE; + ee->func.fn_move = func; +} + +EAPI void +ecore_evas_callback_show_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_show_set"); + return; + } + IFC(ee, fn_callback_show_set) (ee, func); + IFE; + ee->func.fn_show = func; +} + +EAPI void +ecore_evas_callback_hide_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_hide_set"); + return; + } + IFC(ee, fn_callback_hide_set) (ee, func); + IFE; + ee->func.fn_hide = func; +} + +EAPI void +ecore_evas_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_delete_request_set"); + return; + } + IFC(ee, fn_callback_delete_request_set) (ee, func); + IFE; + ee->func.fn_delete_request = func; +} + +EAPI void +ecore_evas_callback_destroy_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_destroy_set"); + return; + } + IFC(ee, fn_callback_destroy_set) (ee, func); + IFE; + ee->func.fn_destroy = func; +} + +EAPI void +ecore_evas_callback_focus_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_focus_in_set"); + return; + } + IFC(ee, fn_callback_focus_in_set) (ee, func); + IFE; + ee->func.fn_focus_in = func; +} + +EAPI void +ecore_evas_callback_focus_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_focus_out_set"); + return; + } + IFC(ee, fn_callback_focus_out_set) (ee, func); + IFE; + ee->func.fn_focus_out = func; +} + +EAPI void +ecore_evas_callback_sticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_sticky_set"); + return; + } + IFC(ee, fn_callback_sticky_set) (ee, func); + IFE; + ee->func.fn_sticky = func; +} + +EAPI void +ecore_evas_callback_unsticky_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_unsticky_set"); + return; + } + IFC(ee, fn_callback_unsticky_set) (ee, func); + IFE; + ee->func.fn_unsticky = func; +} + +EAPI void +ecore_evas_callback_mouse_in_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_mouse_in_set"); + return; + } + IFC(ee, fn_callback_mouse_in_set) (ee, func); + IFE; + ee->func.fn_mouse_in = func; +} + +EAPI void +ecore_evas_callback_mouse_out_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_mouse_out_set"); + return; + } + IFC(ee, fn_callback_mouse_out_set) (ee, func); + IFE; + ee->func.fn_mouse_out = func; +} + +EAPI void +ecore_evas_callback_pre_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_pre_render_set"); + return; + } + IFC(ee, fn_callback_pre_render_set) (ee, func); + IFE; + ee->func.fn_pre_render = func; +} + +EAPI void +ecore_evas_callback_post_render_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_post_render_set"); + return; + } + IFC(ee, fn_callback_post_render_set) (ee, func); + IFE; + ee->func.fn_post_render = func; +} + +EAPI void +ecore_evas_callback_pre_free_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_callback_pre_free_set"); + return; + } + ee->func.fn_pre_free = func; +} + +/** + * Get an Ecore_Evas's Evas + * @param ee The Ecore_Evas whose Evas you wish to get + * @return The Evas wrapped by @p ee + * + * This function returns the Evas contained within @p ee. + */ +EAPI Evas * +ecore_evas_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_get"); + return NULL; + } + return ee->evas; +} + +EAPI void +ecore_evas_move(Ecore_Evas *ee, int x, int y) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_move"); + return; + } + if (ee->prop.fullscreen) return; + IFC(ee, fn_move) (ee, x, y); + IFE; +} + +/** + * Provide Managed move co-ordinates for an Ecore_Evas + * @param ee The Ecore_Evas to move + * @param x The x coordinate to set as the managed location + * @param y The y coordinate to set as the managed location + * + * This sets the managed geometry position of the @p ee to (@p x, @p y) + */ +EAPI void +ecore_evas_managed_move(Ecore_Evas *ee, int x, int y) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_move"); + return; + } + IFC(ee, fn_managed_move) (ee, x, y); + IFE; +} + +EAPI void +ecore_evas_resize(Ecore_Evas *ee, int w, int h) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_resize"); + return; + } + if (ee->prop.fullscreen) return; + if (w < 1) w = 1; + if (h < 1) h = 1; + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + IFC(ee, fn_resize) (ee, h, w); + IFE; + } + else + { + IFC(ee, fn_resize) (ee, w, h); + IFE; + } +} + +EAPI void +ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_move_resize"); + return; + } + if (ee->prop.fullscreen) return; + if (w < 1) w = 1; + if (h < 1) h = 1; + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + IFC(ee, fn_move_resize) (ee, x, y, h, w); + IFE; + } + else + { + IFC(ee, fn_move_resize) (ee, x, y, w, h); + IFE; + } +} + +EAPI void +ecore_evas_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_geometry_get"); + return; + } + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + if (x) *x = ee->x; + if (y) *y = ee->y; + if (w) *w = ee->h; + if (h) *h = ee->w; + } + else + { + if (x) *x = ee->x; + if (y) *y = ee->y; + if (w) *w = ee->w; + if (h) *h = ee->h; + } +} + +EAPI void +ecore_evas_request_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_request_geometry_get"); + return; + } + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + if (x) *x = ee->req.x; + if (y) *y = ee->req.y; + if (w) *w = ee->req.h; + if (h) *h = ee->req.w; + } + else + { + if (x) *x = ee->req.x; + if (y) *y = ee->req.y; + if (w) *w = ee->req.w; + if (h) *h = ee->req.h; + } +} + +EAPI void +ecore_evas_rotation_set(Ecore_Evas *ee, int rot) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_rotation_set"); + return; + } + rot = rot % 360; + while (rot < 0) rot += 360; + while (rot >= 360) rot -= 360; + IFC(ee, fn_rotation_set) (ee, rot, 0); + /* make sure everything gets redrawn */ + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); + IFE; +} + +EAPI void +ecore_evas_rotation_with_resize_set(Ecore_Evas *ee, int rot) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_rotation_set"); + return; + } + rot = rot % 360; + while (rot < 0) rot += 360; + while (rot >= 360) rot -= 360; + IFC(ee, fn_rotation_set) (ee, rot, 1); + /* make sure everything gets redrawn */ + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); + IFE; +} + +EAPI int +ecore_evas_rotation_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_rotation_get"); + return 0; + } + return ee->rotation; +} + +/** + * Set whether an Ecore_Evas is shaped or not. + * @param ee The Ecore_Evas to shape + * @param shaped EINA_TRUE to shape, EINA_FALSE to not + * + * This function allows one to make an Ecore_Evas shaped to the contents of the + * evas. If @p shaped is EINA_TRUE, @p ee will be transparent in parts of the evas that + * contain no objects. If @p shaped is EINA_FALSE, then @p ee will be rectangular, and + * and parts with no data will show random framebuffer artifacting. For + * non-shaped Ecore_Evases, it is recommend to cover the entire evas with a + * background object. + */ +EAPI void +ecore_evas_shaped_set(Ecore_Evas *ee, Eina_Bool shaped) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_shaped_set"); + return; + } + IFC(ee, fn_shaped_set) (ee, shaped); + IFE; +} + +/** + * Query whether an Ecore_Evas is shaped or not. + * @param ee The Ecore_Evas to query. + * @return EINA_TRUE if shaped, EINA_FALSE if not. + * + * This function returns EINA_TRUE if @p ee is shaped, and EINA_FALSE if not. + */ +EAPI Eina_Bool +ecore_evas_shaped_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_shaped_get"); + return EINA_FALSE; + } + return ee->shaped ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_evas_alpha_set(Ecore_Evas *ee, Eina_Bool alpha) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_alpha_set"); + return; + } + IFC(ee, fn_alpha_set) (ee, alpha); + IFE; +} + +EAPI Eina_Bool +ecore_evas_alpha_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_alpha_get"); + return EINA_FALSE; + } + return ee->alpha ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_evas_transparent_set(Ecore_Evas *ee, Eina_Bool transparent) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_transparent_set"); + return; + } + IFC(ee, fn_transparent_set) (ee, transparent); + IFE; +} + +EAPI Eina_Bool +ecore_evas_transparent_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_transparent_get"); + return EINA_FALSE; + } + return ee->transparent ? EINA_TRUE : 0; +} + +EAPI void +ecore_evas_show(Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_show"); + return; + } + IFC(ee, fn_show) (ee); + IFE; +} + +EAPI void +ecore_evas_hide(Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_hide"); + return; + } + IFC(ee, fn_hide) (ee); + IFE; +} + + EAPI int +ecore_evas_visibility_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_visibility_get"); + return 0; + } + return ee->visible ? 1:0; +} + +EAPI void +ecore_evas_raise(Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_raise"); + return; + } + IFC(ee, fn_raise) (ee); + IFE; +} + +EAPI void +ecore_evas_lower(Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_lower"); + return; + } + IFC(ee, fn_lower) (ee); + IFE; +} + +/** + * Activate (set focus to, via the window manager) an Ecore_Evas' window. + * @param ee The Ecore_Evas to activate. + * + * This functions activates the Ecore_Evas. + */ +EAPI void +ecore_evas_activate(Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_activate"); + return; + } + IFC(ee, fn_activate) (ee); + IFE; +} + +EAPI void +ecore_evas_title_set(Ecore_Evas *ee, const char *t) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_title_set"); + return; + } + IFC(ee, fn_title_set) (ee, t); + IFE; +} + +EAPI const char * +ecore_evas_title_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_title_get"); + return NULL; + } + return ee->prop.title; +} + +EAPI void +ecore_evas_name_class_set(Ecore_Evas *ee, const char *n, const char *c) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_name_class_set"); + return; + } + IFC(ee, fn_name_class_set) (ee, n, c); + IFE; +} + +EAPI void +ecore_evas_name_class_get(const Ecore_Evas *ee, const char **n, const char **c) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_name_class_get"); + return; + } + if (n) *n = ee->prop.name; + if (c) *c = ee->prop.clas; +} + +EAPI void +ecore_evas_size_min_set(Ecore_Evas *ee, int w, int h) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_size_min_set"); + return; + } + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + IFC(ee, fn_size_min_set) (ee, h, w); + IFE; + } + else + { + IFC(ee, fn_size_min_set) (ee, w, h); + IFE; + } +} + +EAPI void +ecore_evas_size_min_get(const Ecore_Evas *ee, int *w, int *h) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_size_min_get"); + return; + } + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + if (w) *w = ee->prop.min.h; + if (h) *h = ee->prop.min.w; + } + else + { + if (w) *w = ee->prop.min.w; + if (h) *h = ee->prop.min.h; + } +} + +EAPI void +ecore_evas_size_max_set(Ecore_Evas *ee, int w, int h) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_size_max_set"); + return; + } + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + IFC(ee, fn_size_max_set) (ee, h, w); + IFE; + } + else + { + IFC(ee, fn_size_max_set) (ee, w, h); + IFE; + } +} + +EAPI void +ecore_evas_size_max_get(const Ecore_Evas *ee, int *w, int *h) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_size_max_get"); + return; + } + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + if (w) *w = ee->prop.max.h; + if (h) *h = ee->prop.max.w; + } + else + { + if (w) *w = ee->prop.max.w; + if (h) *h = ee->prop.max.h; + } +} + +EAPI void +ecore_evas_size_base_set(Ecore_Evas *ee, int w, int h) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_size_base_set"); + return; + } + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + IFC(ee, fn_size_base_set) (ee, h, w); + IFE; + } + else + { + IFC(ee, fn_size_base_set) (ee, w, h); + IFE; + } +} + +EAPI void +ecore_evas_size_base_get(const Ecore_Evas *ee, int *w, int *h) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_size_base_get"); + return; + } + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + if (w) *w = ee->prop.base.h; + if (h) *h = ee->prop.base.w; + } + else + { + if (w) *w = ee->prop.base.w; + if (h) *h = ee->prop.base.h; + } +} + +EAPI void +ecore_evas_size_step_set(Ecore_Evas *ee, int w, int h) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_size_step_set"); + return; + } + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + IFC(ee, fn_size_step_set) (ee, h, w); + IFE; + } + else + { + IFC(ee, fn_size_step_set) (ee, w, h); + IFE; + } +} + +EAPI void +ecore_evas_size_step_get(const Ecore_Evas *ee, int *w, int *h) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_size_step_get"); + return; + } + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + if (w) *w = ee->prop.step.h; + if (h) *h = ee->prop.step.w; + } + else + { + if (w) *w = ee->prop.step.w; + if (h) *h = ee->prop.step.h; + } +} + +EAPI void +ecore_evas_cursor_set(Ecore_Evas *ee, const char *file, int layer, int hot_x, int hot_y) +{ + Evas_Object *obj = NULL; + + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_cursor_set"); + return; + } + + if (file) + { + int x, y; + + obj = evas_object_image_add(ee->evas); + evas_object_image_file_set(obj, file, NULL); + evas_object_image_size_get(obj, &x, &y); + evas_object_resize(obj, x, y); + evas_object_image_fill_set(obj, 0, 0, x, y); + } + + IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y); + IFE; +} + +EAPI void +ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_cursor_set"); + return; + } + IFC(ee, fn_object_cursor_set) (ee, obj, layer, hot_x, hot_y); + IFE; +} + +EAPI void +ecore_evas_cursor_get(const Ecore_Evas *ee, Evas_Object **obj, int *layer, int *hot_x, int *hot_y) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_cursor_get"); + return; + } + if (obj) *obj = ee->prop.cursor.object; + if (layer) *layer = ee->prop.cursor.layer; + if (hot_x) *hot_x = ee->prop.cursor.hot.x; + if (hot_y) *hot_y = ee->prop.cursor.hot.y; +} + +EAPI void +ecore_evas_layer_set(Ecore_Evas *ee, int layer) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_layer_set"); + return; + } + IFC(ee, fn_layer_set) (ee, layer); + IFE; +} + +EAPI int +ecore_evas_layer_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_layer_get"); + return 0; + } + return ee->prop.layer; +} + +EAPI void +ecore_evas_focus_set(Ecore_Evas *ee, Eina_Bool on) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_focus_set"); + return; + } + IFC(ee, fn_focus_set) (ee, on); + IFE; +} + +EAPI Eina_Bool +ecore_evas_focus_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_focus_get"); + return EINA_FALSE; + } + return ee->prop.focused ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_evas_iconified_set(Ecore_Evas *ee, Eina_Bool on) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_iconified_set"); + return; + } + IFC(ee, fn_iconified_set) (ee, on); + IFE; +} + +EAPI Eina_Bool +ecore_evas_iconified_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_iconified_get"); + return EINA_FALSE; + } + return ee->prop.iconified ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_evas_borderless_set(Ecore_Evas *ee, Eina_Bool on) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_borderless_set"); + return; + } + IFC(ee, fn_borderless_set) (ee, on); + IFE; +} + +EAPI Eina_Bool +ecore_evas_borderless_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_borderless_get"); + return EINA_FALSE; + } + return ee->prop.borderless ? EINA_TRUE : EINA_FALSE; +} + +/** + * Tell the WM whether or not to ignore an Ecore_Evas' window + * @param ee The Ecore_Evas + * @param on EINA_TRUE to ignore, EINA_FALSE to not. + * + * This function causes the window manager to ignore @p ee if @p on is EINA_TRUE, + * or not ignore @p ee if @p on is EINA_FALSE. + */ +EAPI void +ecore_evas_override_set(Ecore_Evas *ee, Eina_Bool on) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_override_set"); + return; + } + IFC(ee, fn_override_set) (ee, on); + IFE; +} + +/** + * Query whether an Ecore_Evas' window is overridden or not + * @param ee The Ecore_Evas to set + * @return EINA_TRUE if @p ee is overridden, EINA_FALSE if not. + * + */ +EAPI Eina_Bool +ecore_evas_override_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_override_get"); + return EINA_FALSE; + } + return ee->prop.override ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_evas_maximized_set(Ecore_Evas *ee, Eina_Bool on) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_maximized_set"); + return; + } + IFC(ee, fn_maximized_set) (ee, on); + IFE; +} + +EAPI Eina_Bool +ecore_evas_maximized_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_maximized_get"); + return EINA_FALSE; + } + return ee->prop.maximized ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_evas_fullscreen_set(Ecore_Evas *ee, Eina_Bool on) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_fullscreen_set"); + return; + } + IFC(ee, fn_fullscreen_set) (ee, on); + IFE; +} + +EAPI Eina_Bool +ecore_evas_fullscreen_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_fullscreen_get"); + return EINA_FALSE; + } + return ee->prop.fullscreen ? EINA_TRUE : EINA_FALSE; +} + +/** + * Set whether or not an Ecore_Evas' window should avoid damage + * + * @param ee The Ecore_Evas + * @param The type of the damage management + * + * This function causes @p ee to be drawn to a pixmap to avoid recalculations. + * On expose events it will copy from the pixmap to the window. + */ +EAPI void +ecore_evas_avoid_damage_set(Ecore_Evas *ee, Ecore_Evas_Avoid_Damage_Type on) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_avoid_damage_set"); + return; + } + IFC(ee, fn_avoid_damage_set) (ee, on); + IFE; +} + +/** + * Query whether an Ecore_Evas' window avoids damage or not + * @param ee The Ecore_Evas to set + * @return The type of the damage management + * + */ +EAPI Ecore_Evas_Avoid_Damage_Type +ecore_evas_avoid_damage_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_avoid_damage_get"); + return ECORE_EVAS_AVOID_DAMAGE_NONE; + } + return ee->prop.avoid_damage; +} + +/** + * Set the withdrawn state of an Ecore_Evas' window. + * @param ee The Ecore_Evas whose window's withdrawn state is set. + * @param withdrawn The Ecore_Evas window's new withdrawn state. + * + */ +EAPI void +ecore_evas_withdrawn_set(Ecore_Evas *ee, Eina_Bool withdrawn) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_withdrawn_set"); + return; + } + + IFC(ee, fn_withdrawn_set) (ee, withdrawn); + IFE; +} + +/** + * Returns the withdrawn state of an Ecore_Evas' window. + * @param ee The Ecore_Evas whose window's withdrawn state is returned. + * @return The Ecore_Evas window's withdrawn state. + * + */ +EAPI Eina_Bool +ecore_evas_withdrawn_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_withdrawn_get"); + return EINA_FALSE; + } else + return ee->prop.withdrawn ? EINA_TRUE : EINA_FALSE; +} + +/** + * Set the sticky state of an Ecore_Evas window. + * + * @param ee The Ecore_Evas whose window's sticky state is set. + * @param sticky The Ecore_Evas window's new sticky state. + * + */ +EAPI void +ecore_evas_sticky_set(Ecore_Evas *ee, Eina_Bool sticky) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_sticky_set"); + return; + } + + IFC(ee, fn_sticky_set) (ee, sticky); + IFE; +} + +/** + * Returns the sticky state of an Ecore_Evas' window. + * + * @param ee The Ecore_Evas whose window's sticky state is returned. + * @return The Ecore_Evas window's sticky state. + * + */ +EAPI Eina_Bool +ecore_evas_sticky_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_sticky_get"); + return EINA_FALSE; + } else + return ee->prop.sticky ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_evas_ignore_events_set(Ecore_Evas *ee, Eina_Bool ignore) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_ignore_events_set"); + return; + } + + IFC(ee, fn_ignore_events_set) (ee, ignore); + IFE; +} + +EAPI Eina_Bool +ecore_evas_ignore_events_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_ignore_events_get"); + return EINA_FALSE; + } + return ee->ignore_events ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_evas_manual_render_set(Ecore_Evas *ee, Eina_Bool manual_render) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_manual_render_set"); + return; + } + ee->manual_render = manual_render; +} + +EAPI Eina_Bool +ecore_evas_manual_render_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_manual_render_get"); + return EINA_FALSE; + } + return ee->manual_render ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_evas_manual_render(Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_manual_render"); + return; + } + if (ee->engine.func->fn_render) + ee->engine.func->fn_render(ee); +} + +EAPI void +ecore_evas_comp_sync_set(Ecore_Evas *ee, Eina_Bool do_sync) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_comp_sync_set"); + return; + } + ee->no_comp_sync = !do_sync; +} + +EAPI Eina_Bool +ecore_evas_comp_sync_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_comp_sync_get"); + return EINA_FALSE; + } + return !ee->no_comp_sync; +} + +EAPI Ecore_Window +ecore_evas_window_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_window_get"); + return 0; + } + + return ee->prop.window; +} + +EAPI void +ecore_evas_screen_geometry_get(const Ecore_Evas *ee, int *x, int *y, int *w, int *h) +{ + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = 0; + if (h) *h = 0; + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_screen_geometry_get"); + return; + } + + IFC(ee, fn_screen_geometry_get) (ee, x, y, w, h); + IFE; +} + +/* fps debug calls - for debugging how much time your app actually spends */ +/* rendering graphics... :) */ + +static int _ecore_evas_fps_debug_init_count = 0; +static int _ecore_evas_fps_debug_fd = -1; +unsigned int *_ecore_evas_fps_rendertime_mmap = NULL; + +void +_ecore_evas_fps_debug_init(void) +{ + char buf[4096]; + const char *tmp; + + _ecore_evas_fps_debug_init_count++; + if (_ecore_evas_fps_debug_init_count > 1) return; + +#ifndef HAVE_EVIL + tmp = "/tmp"; +#else + tmp = evil_tmpdir_get (); +#endif /* HAVE_EVIL */ + snprintf(buf, sizeof(buf), "%s/.ecore_evas_fps_debug-%i", tmp, (int)getpid()); + _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644); + if (_ecore_evas_fps_debug_fd < 0) + { + unlink(buf); + _ecore_evas_fps_debug_fd = open(buf, O_CREAT | O_TRUNC | O_RDWR, 0644); + } + if (_ecore_evas_fps_debug_fd >= 0) + { + unsigned int zero = 0; + char *buf2 = (char *)&zero; + ssize_t todo = sizeof(unsigned int); + + while (todo > 0) + { + ssize_t r = write(_ecore_evas_fps_debug_fd, buf2, todo); + if (r > 0) + { + todo -= r; + buf2 += r; + } + else if ((r < 0) && (errno == EINTR)) + continue; + else + { + ERR("could not write to file '%s' fd %d: %s", + buf, _ecore_evas_fps_debug_fd, strerror(errno)); + close(_ecore_evas_fps_debug_fd); + _ecore_evas_fps_debug_fd = -1; + return; + } + } + _ecore_evas_fps_rendertime_mmap = mmap(NULL, sizeof(unsigned int), + PROT_READ | PROT_WRITE, + MAP_SHARED, + _ecore_evas_fps_debug_fd, 0); + if (_ecore_evas_fps_rendertime_mmap == MAP_FAILED) + _ecore_evas_fps_rendertime_mmap = NULL; + } +} + +void +_ecore_evas_fps_debug_shutdown(void) +{ + _ecore_evas_fps_debug_init_count--; + if (_ecore_evas_fps_debug_init_count > 0) return; + if (_ecore_evas_fps_debug_fd >= 0) + { + char buf[4096]; + + snprintf(buf, sizeof(buf), "/tmp/.ecore_evas_fps_debug-%i", (int)getpid()); + unlink(buf); + if (_ecore_evas_fps_rendertime_mmap) + { + munmap(_ecore_evas_fps_rendertime_mmap, sizeof(int)); + _ecore_evas_fps_rendertime_mmap = NULL; + } + close(_ecore_evas_fps_debug_fd); + _ecore_evas_fps_debug_fd = -1; + } +} + +void +_ecore_evas_fps_debug_rendertime_add(double t) +{ + static double rtime = 0.0; + static double rlapse = 0.0; + static int frames = 0; + static int flapse = 0; + double tim; + + tim = ecore_time_get(); + rtime += t; + frames++; + if (rlapse == 0.0) + { + rlapse = tim; + flapse = frames; + } + else if ((tim - rlapse) >= 0.5) + { + printf("FRAME: %i, FPS: %3.1f, RTIME %3.0f%%\n", + frames, + (frames - flapse) / (tim - rlapse), + (100.0 * rtime) / (tim - rlapse) + ); + rlapse = tim; + flapse = frames; + rtime = 0.0; + } +} + +void +_ecore_evas_register(Ecore_Evas *ee) +{ + ee->registered = 1; + ecore_evases = (Ecore_Evas *)eina_inlist_prepend + (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); +} + +void +_ecore_evas_ref(Ecore_Evas *ee) +{ + ee->refcount++; +} + +void +_ecore_evas_unref(Ecore_Evas *ee) +{ + ee->refcount--; + if (ee->refcount == 0) + { + if (ee->deleted) _ecore_evas_free(ee); + } + else if (ee->refcount < -1) + ERR("Ecore_Evas %p->refcount=%d < 0", ee, ee->refcount); +} + +void +_ecore_evas_free(Ecore_Evas *ee) +{ + ee->deleted = EINA_TRUE; + if (ee->refcount > 0) return; + + if (ee->func.fn_pre_free) ee->func.fn_pre_free(ee); + while (ee->sub_ecore_evas) + { + _ecore_evas_free(ee->sub_ecore_evas->data); + } + if (ee->data) eina_hash_free(ee->data); + ee->data = NULL; + if (ee->name) free(ee->name); + ee->name = NULL; + if (ee->prop.title) free(ee->prop.title); + ee->prop.title = NULL; + if (ee->prop.name) free(ee->prop.name); + ee->prop.name = NULL; + if (ee->prop.clas) free(ee->prop.clas); + ee->prop.clas = NULL; + if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); + ee->prop.cursor.object = NULL; + if (ee->evas) evas_free(ee->evas); + ee->evas = NULL; + ECORE_MAGIC_SET(ee, ECORE_MAGIC_NONE); + ee->driver = NULL; + if (ee->engine.idle_flush_timer) + ecore_timer_del(ee->engine.idle_flush_timer); + if (ee->engine.func->fn_free) ee->engine.func->fn_free(ee); + if (ee->registered) + { + ecore_evases = (Ecore_Evas *)eina_inlist_remove + (EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); + } + free(ee); +} + +static Eina_Bool +_ecore_evas_cb_idle_flush(void *data) +{ + Ecore_Evas *ee; + + ee = (Ecore_Evas *)data; + evas_render_idle_flush(ee->evas); + ee->engine.idle_flush_timer = NULL; + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_ecore_evas_async_events_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__) +{ + evas_async_events_process(); + + return ECORE_CALLBACK_RENEW; +} + +void +_ecore_evas_idle_timeout_update(Ecore_Evas *ee) +{ + if (ee->engine.idle_flush_timer) + ecore_timer_del(ee->engine.idle_flush_timer); + ee->engine.idle_flush_timer = ecore_timer_add(IDLE_FLUSH_TIME, + _ecore_evas_cb_idle_flush, + ee); +} + +void +_ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp) +{ + ee->mouse.x = x; + ee->mouse.y = y; + if (ee->prop.cursor.object) + { + evas_object_show(ee->prop.cursor.object); + if (ee->rotation == 0) + evas_object_move(ee->prop.cursor.object, + x - ee->prop.cursor.hot.x, + y - ee->prop.cursor.hot.y); + else if (ee->rotation == 90) + evas_object_move(ee->prop.cursor.object, + ee->h - y - 1 - ee->prop.cursor.hot.x, + x - ee->prop.cursor.hot.y); + else if (ee->rotation == 180) + evas_object_move(ee->prop.cursor.object, + ee->w - x - 1 - ee->prop.cursor.hot.x, + ee->h - y - 1 - ee->prop.cursor.hot.y); + else if (ee->rotation == 270) + evas_object_move(ee->prop.cursor.object, + y - ee->prop.cursor.hot.x, + ee->w - x - 1 - ee->prop.cursor.hot.y); + } + if (ee->rotation == 0) + evas_event_feed_mouse_move(ee->evas, x, y, timestamp, NULL); + else if (ee->rotation == 90) + evas_event_feed_mouse_move(ee->evas, ee->h - y - 1, x, timestamp, NULL); + else if (ee->rotation == 180) + evas_event_feed_mouse_move(ee->evas, ee->w - x - 1, ee->h - y - 1, timestamp, NULL); + else if (ee->rotation == 270) + evas_event_feed_mouse_move(ee->evas, y, ee->w - x - 1, timestamp, NULL); +} + +void +_ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device, + int x, int y, + double radius, + double radius_x, double radius_y, + double pressure, + double angle, + double mx, double my, + unsigned int timestamp) +{ + if (ee->rotation == 0) + evas_event_feed_multi_move(ee->evas, device, + x, y, + radius, + radius_x, radius_y, + pressure, + angle - ee->rotation, + mx, my, + timestamp, NULL); + else if (ee->rotation == 90) + evas_event_feed_multi_move(ee->evas, device, + ee->h - y - 1, x, + radius, + radius_y, radius_x, + pressure, + angle - ee->rotation, + ee->h - my - 1, mx, + timestamp, NULL); + else if (ee->rotation == 180) + evas_event_feed_multi_move(ee->evas, device, + ee->w - x - 1, ee->h - y - 1, + radius, + radius_x, radius_y, + pressure, + angle - ee->rotation, + ee->w - mx - 1, ee->h - my - 1, + timestamp, NULL); + else if (ee->rotation == 270) + evas_event_feed_multi_move(ee->evas, device, + y, ee->w - x - 1, + radius, + radius_y, radius_x, + pressure, + angle - ee->rotation, + my, ee->w - mx - 1, + timestamp, NULL); +} + +void +_ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device, + int x, int y, + double radius, + double radius_x, double radius_y, + double pressure, + double angle, + double mx, double my, + Evas_Button_Flags flags, + unsigned int timestamp) +{ + if (ee->rotation == 0) + evas_event_feed_multi_down(ee->evas, device, + x, y, + radius, + radius_x, radius_y, + pressure, + angle - ee->rotation, + mx, my, + flags, timestamp, NULL); + else if (ee->rotation == 90) + evas_event_feed_multi_down(ee->evas, device, + ee->h - y - 1, x, + radius, + radius_y, radius_x, + pressure, + angle - ee->rotation, + ee->h - my - 1, mx, + flags, timestamp, NULL); + else if (ee->rotation == 180) + evas_event_feed_multi_down(ee->evas, device, + ee->w - x - 1, ee->h - y - 1, + radius, + radius_x, radius_y, + pressure, + angle - ee->rotation, + ee->w - mx - 1, ee->h - my - 1, + flags, timestamp, NULL); + else if (ee->rotation == 270) + evas_event_feed_multi_down(ee->evas, device, + y, ee->w - x - 1, + radius, + radius_y, radius_x, + pressure, + angle - ee->rotation, + my, ee->w - mx - 1, + flags, timestamp, NULL); +} + +void +_ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device, + int x, int y, + double radius, + double radius_x, double radius_y, + double pressure, + double angle, + double mx, double my, + Evas_Button_Flags flags, + unsigned int timestamp) +{ + if (ee->rotation == 0) + evas_event_feed_multi_up(ee->evas, device, + x, y, + radius, + radius_x, radius_y, + pressure, + angle - ee->rotation, + mx, my, + flags, timestamp, NULL); + else if (ee->rotation == 90) + evas_event_feed_multi_up(ee->evas, device, + ee->h - y - 1, x, + radius, + radius_y, radius_x, + pressure, + angle - ee->rotation, + ee->h - my - 1, mx, + flags, timestamp, NULL); + else if (ee->rotation == 180) + evas_event_feed_multi_up(ee->evas, device, + ee->w - x - 1, ee->h - y - 1, + radius, + radius_x, radius_y, + pressure, + angle - ee->rotation, + ee->w - mx - 1, ee->h - my - 1, + flags, timestamp, NULL); + else if (ee->rotation == 270) + evas_event_feed_multi_up(ee->evas, device, + y, ee->w - x - 1, + radius, + radius_y, radius_x, + pressure, + angle - ee->rotation, + my, ee->w - mx - 1, + flags, timestamp, NULL); +} + +EAPI Eina_List * +ecore_evas_ecore_evas_list_get(void) +{ + Ecore_Evas *ee; + Eina_List *l = NULL; + + EINA_INLIST_FOREACH(ecore_evases, ee) + { + l = eina_list_append(l, ee); + } + + return l; +} + +EAPI void +ecore_evas_input_event_register(Ecore_Evas *ee) +{ + ecore_event_window_register((Ecore_Window)ee, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); +} + +EAPI void +ecore_evas_input_event_unregister(Ecore_Evas *ee) +{ + ecore_event_window_unregister((Ecore_Window)ee); +} diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c new file mode 100644 index 0000000..a3e49d6 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_buffer.c @@ -0,0 +1,827 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar! + +#include +#include "ecore_private.h" +#include + +#include "ecore_evas_private.h" +#include "Ecore_Evas.h" + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER +static int _ecore_evas_init_count = 0; + +static int +_ecore_evas_buffer_init(void) +{ + _ecore_evas_init_count++; + return _ecore_evas_init_count; +} + +static void +_ecore_evas_buffer_free(Ecore_Evas *ee) +{ + if (ee->engine.buffer.image) + { + Ecore_Evas *ee2; + + ee2 = evas_object_data_get(ee->engine.buffer.image, "Ecore_Evas_Parent"); + evas_object_del(ee->engine.buffer.image); + ee2->sub_ecore_evas = eina_list_remove(ee2->sub_ecore_evas, ee); + } + else + { + ee->engine.buffer.free_func(ee->engine.buffer.data, + ee->engine.buffer.pixels); + } + _ecore_evas_buffer_shutdown(); +} + +static void +_ecore_evas_resize(Ecore_Evas *ee, int w, int h) +{ + Evas_Engine_Info_Buffer *einfo; + int stride = 0; + + if (w < 1) w = 1; + if (h < 1) h = 1; + ee->req.w = w; + ee->req.h = h; + if ((w == ee->w) && (h == ee->h)) return; + ee->w = w; + ee->h = h; + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + + if (ee->engine.buffer.image) + { + ee->engine.buffer.pixels = evas_object_image_data_get(ee->engine.buffer.image, 1); + stride = evas_object_image_stride_get(ee->engine.buffer.image); + } + else + { + if (ee->engine.buffer.pixels) + ee->engine.buffer.free_func(ee->engine.buffer.data, + ee->engine.buffer.pixels); + ee->engine.buffer.pixels = + ee->engine.buffer.alloc_func(ee->engine.buffer.data, + ee->w * ee->h * sizeof(int)); + stride = ee->w * sizeof(int); + } + + einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); + if (einfo) + { + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; + einfo->info.dest_buffer = ee->engine.buffer.pixels; + einfo->info.dest_buffer_row_bytes = stride; + einfo->info.use_color_key = 0; + einfo->info.alpha_threshold = 0; + einfo->info.func.new_update_region = NULL; + einfo->info.func.free_update_region = NULL; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + } + if (ee->engine.buffer.image) + evas_object_image_data_set(ee->engine.buffer.image, ee->engine.buffer.pixels); + if (ee->func.fn_resize) ee->func.fn_resize(ee); +} + +int +_ecore_evas_buffer_shutdown(void) +{ + _ecore_evas_init_count--; + if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; + return _ecore_evas_init_count; +} + +static void +_ecore_evas_show(Ecore_Evas *ee) +{ + if (ee->engine.buffer.image) return; + if (ee->prop.focused) return; + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); +} + +int +_ecore_evas_buffer_render(Ecore_Evas *ee) +{ + Eina_List *updates = NULL, *l, *ll; + Ecore_Evas *ee2; + int rend = 0; + + EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) + { + if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); + if (ee2->engine.func->fn_render) + rend |= ee2->engine.func->fn_render(ee2); + if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); + } + if (ee->engine.buffer.image) + { + int w, h; + + evas_object_image_size_get(ee->engine.buffer.image, &w, &h); + if ((w != ee->w) || (h != ee->h)) + _ecore_evas_resize(ee, w, h); + ee->engine.buffer.pixels = evas_object_image_data_get(ee->engine.buffer.image, 1); + } + if (ee->engine.buffer.pixels) + { + updates = evas_render_updates(ee->evas); + } + if (ee->engine.buffer.image) + { + Eina_Rectangle *r; + + evas_object_image_data_set(ee->engine.buffer.image, ee->engine.buffer.pixels); + EINA_LIST_FOREACH(updates, l, r) + evas_object_image_data_update_add(ee->engine.buffer.image, + r->x, r->y, r->w, r->h); + } + if (updates) + { + evas_render_updates_free(updates); + _ecore_evas_idle_timeout_update(ee); + } + + return updates ? 1 : rend; +} + +// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar! +static void +_ecore_evas_buffer_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) +{ + Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh; + + evas_object_geometry_get(ee->engine.buffer.image, &xx, &yy, &ww, &hh); + evas_object_image_fill_get(ee->engine.buffer.image, &fx, &fy, &fw, &fh); + + if (fw < 1) fw = 1; + if (fh < 1) fh = 1; + + if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh)) + { + *x = (ee->w * (*x - xx)) / fw; + *y = (ee->h * (*y - yy)) / fh; + } + else + { + xx = (*x - xx) - fx; + while (xx < 0) xx += fw; + while (xx > fw) xx -= fw; + *x = (ee->w * xx) / fw; + + yy = (*y - yy) - fy; + while (yy < 0) yy += fh; + while (yy > fh) yy -= fh; + *y = (ee->h * yy) / fh; + } +} + +static void +_ecore_evas_buffer_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + Evas_Event_Mouse_In *ev; + + ee = data; + ev = event_info; + evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL); +} + +static void +_ecore_evas_buffer_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + Evas_Event_Mouse_Out *ev; + + ee = data; + ev = event_info; + evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); +} + +static void +_ecore_evas_buffer_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee; + Evas_Event_Mouse_Down *ev; + + ee = data; + ev = event_info; + evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); +} + +static void +_ecore_evas_buffer_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee; + Evas_Event_Mouse_Up *ev; + + ee = data; + ev = event_info; + evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); +} + +static void +_ecore_evas_buffer_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee; + Evas_Event_Mouse_Move *ev; + Evas_Coord x, y; + + ee = data; + ev = event_info; + x = ev->cur.canvas.x; + y = ev->cur.canvas.y; + _ecore_evas_buffer_coord_translate(ee, &x, &y); + _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); +} + +static void +_ecore_evas_buffer_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee; + Evas_Event_Mouse_Wheel *ev; + + ee = data; + ev = event_info; + evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL); +} + +static void +_ecore_evas_buffer_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee; + Evas_Event_Multi_Down *ev; + Evas_Coord x, y, xx, yy; + double xf, yf; + + ee = data; + ev = event_info; + x = ev->canvas.x; + y = ev->canvas.y; + xx = x; + yy = y; + _ecore_evas_buffer_coord_translate(ee, &x, &y); + xf = (ev->canvas.xsub - (double)xx) + (double)x; + yf = (ev->canvas.ysub - (double)yy) + (double)y; + evas_event_feed_multi_down(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL); +} + +static void +_ecore_evas_buffer_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee; + Evas_Event_Multi_Up *ev; + Evas_Coord x, y, xx, yy; + double xf, yf; + + ee = data; + ev = event_info; + x = ev->canvas.x; + y = ev->canvas.y; + xx = x; + yy = y; + _ecore_evas_buffer_coord_translate(ee, &x, &y); + xf = (ev->canvas.xsub - (double)xx) + (double)x; + yf = (ev->canvas.ysub - (double)yy) + (double)y; + evas_event_feed_multi_up(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL); +} + +static void +_ecore_evas_buffer_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee; + Evas_Event_Multi_Move *ev; + Evas_Coord x, y, xx, yy; + double xf, yf; + + ee = data; + ev = event_info; + x = ev->cur.canvas.x; + y = ev->cur.canvas.y; + xx = x; + yy = y; + _ecore_evas_buffer_coord_translate(ee, &x, &y); + xf = (ev->cur.canvas.xsub - (double)xx) + (double)x; + yf = (ev->cur.canvas.ysub - (double)yy) + (double)y; + evas_event_feed_multi_move(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->timestamp, NULL); +} + +static void +_ecore_evas_buffer_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + + ee = data; + if (ee->driver) _ecore_evas_free(ee); +} + +static void +_ecore_evas_buffer_cb_key_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee; + Evas_Event_Key_Down *ev; + + ee = data; + ev = event_info; + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) + evas_key_modifier_on(ee->evas, "Shift"); + else + evas_key_modifier_off(ee->evas, "Shift"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) + evas_key_modifier_on(ee->evas, "Control"); + else + evas_key_modifier_off(ee->evas, "Control"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) + evas_key_modifier_on(ee->evas, "Alt"); + else + evas_key_modifier_off(ee->evas, "Alt"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) + evas_key_modifier_on(ee->evas, "Meta"); + else + evas_key_modifier_off(ee->evas, "Meta"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) + evas_key_modifier_on(ee->evas, "Hyper"); + else + evas_key_modifier_off(ee->evas, "Hyper"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) + evas_key_modifier_on(ee->evas, "Super"); + else + evas_key_modifier_off(ee->evas, "Super"); + if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) + evas_key_lock_on(ee->evas, "Scroll_Lock"); + else + evas_key_lock_off(ee->evas, "Scroll_Lock"); + if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) + evas_key_lock_on(ee->evas, "Num_Lock"); + else + evas_key_lock_off(ee->evas, "Num_Lock"); + if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) + evas_key_lock_on(ee->evas, "Caps_Lock"); + else + evas_key_lock_off(ee->evas, "Caps_Lock"); + evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); +} + +static void +_ecore_evas_buffer_cb_key_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee; + Evas_Event_Key_Up *ev; + + ee = data; + ev = event_info; + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) + evas_key_modifier_on(ee->evas, "Shift"); + else + evas_key_modifier_off(ee->evas, "Shift"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) + evas_key_modifier_on(ee->evas, "Control"); + else + evas_key_modifier_off(ee->evas, "Control"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) + evas_key_modifier_on(ee->evas, "Alt"); + else + evas_key_modifier_off(ee->evas, "Alt"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) + evas_key_modifier_on(ee->evas, "Meta"); + else + evas_key_modifier_off(ee->evas, "Meta"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) + evas_key_modifier_on(ee->evas, "Hyper"); + else + evas_key_modifier_off(ee->evas, "Hyper"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) + evas_key_modifier_on(ee->evas, "Super"); + else + evas_key_modifier_off(ee->evas, "Super"); + if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) + evas_key_lock_on(ee->evas, "Scroll_Lock"); + else + evas_key_lock_off(ee->evas, "Scroll_Lock"); + if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) + evas_key_lock_on(ee->evas, "Num_Lock"); + else + evas_key_lock_off(ee->evas, "Num_Lock"); + if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) + evas_key_lock_on(ee->evas, "Caps_Lock"); + else + evas_key_lock_off(ee->evas, "Caps_Lock"); + evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); +} + +static void +_ecore_evas_buffer_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + + ee = data; + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); +} + +static void +_ecore_evas_buffer_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + + ee = data; + ee->prop.focused = 0; + evas_focus_out(ee->evas); + if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); +} + +static void +_ecore_evas_buffer_cb_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + + ee = data; + ee->visible = 1; + if (ee->func.fn_show) ee->func.fn_show(ee); +} + +static void +_ecore_evas_buffer_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + + ee = data; + ee->visible = 0; + if (ee->func.fn_hide) ee->func.fn_hide(ee); +} + +static void +_ecore_evas_buffer_alpha_set(Ecore_Evas *ee, int alpha) +{ + if (((ee->alpha) && (alpha)) || ((!ee->alpha) && (!alpha))) return; + ee->alpha = alpha; + if (ee->engine.buffer.image) + evas_object_image_alpha_set(ee->engine.buffer.image, ee->alpha); +} + +static Ecore_Evas_Engine_Func _ecore_buffer_engine_func = +{ + _ecore_evas_buffer_free, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_resize, + NULL, + NULL, + NULL, + _ecore_evas_show, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_buffer_alpha_set, + NULL, //transparent + + NULL, // render + NULL // screen_geometry_get +}; +#endif + +static void * +_ecore_evas_buffer_pix_alloc(void *data __UNUSED__, int size) +{ + return malloc(size); +} + +static void +_ecore_evas_buffer_pix_free(void *data __UNUSED__, void *pix) +{ + free(pix); +} + +EAPI Ecore_Evas * +ecore_evas_buffer_new(int w, int h) +{ + return ecore_evas_buffer_allocfunc_new + (w, h, _ecore_evas_buffer_pix_alloc, _ecore_evas_buffer_pix_free, NULL); +} + +EAPI Ecore_Evas * +ecore_evas_buffer_allocfunc_new(int w, int h, void *(*alloc_func) (void *data, int size), void (*free_func) (void *data, void *pix), const void *data) +{ +// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar! +#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER + Evas_Engine_Info_Buffer *einfo; + Ecore_Evas *ee; + int rmethod; + + if ((!alloc_func) || (!free_func)) return NULL; + rmethod = evas_render_method_lookup("buffer"); + if (!rmethod) return NULL; + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) return NULL; + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + _ecore_evas_buffer_init(); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_buffer_engine_func; + ee->engine.buffer.alloc_func = alloc_func; + ee->engine.buffer.free_func = free_func; + ee->engine.buffer.data = (void *)data; + + ee->driver = "buffer"; + + if (w < 1) w = 1; + if (h < 1) h = 1; + ee->rotation = 0; + ee->visible = 1; + ee->w = w; + ee->h = h; + ee->req.w = ee->w; + ee->req.h = ee->h; + + ee->prop.max.w = 0; + ee->prop.max.h = 0; + ee->prop.layer = 0; + ee->prop.focused = 1; + ee->prop.borderless = 1; + ee->prop.override = 1; + ee->prop.maximized = 1; + ee->prop.fullscreen = 0; + ee->prop.withdrawn = 0; + ee->prop.sticky = 0; + + /* init evas here */ + ee->evas = evas_new(); + evas_data_attach_set(ee->evas, ee); + evas_output_method_set(ee->evas, rmethod); + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + + ee->engine.buffer.pixels = + ee->engine.buffer.alloc_func + (ee->engine.buffer.data, w * h * sizeof(int)); + + einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); + if (einfo) + { + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; + einfo->info.dest_buffer = ee->engine.buffer.pixels; + einfo->info.dest_buffer_row_bytes = ee->w * sizeof(int); + einfo->info.use_color_key = 0; + einfo->info.alpha_threshold = 0; + einfo->info.func.new_update_region = NULL; + einfo->info.func.free_update_region = NULL; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + evas_key_modifier_add(ee->evas, "Shift"); + evas_key_modifier_add(ee->evas, "Control"); + evas_key_modifier_add(ee->evas, "Alt"); + evas_key_modifier_add(ee->evas, "Meta"); + evas_key_modifier_add(ee->evas, "Hyper"); + evas_key_modifier_add(ee->evas, "Super"); + evas_key_lock_add(ee->evas, "Caps_Lock"); + evas_key_lock_add(ee->evas, "Num_Lock"); + evas_key_lock_add(ee->evas, "Scroll_Lock"); + + evas_event_feed_mouse_in(ee->evas, 0, NULL); + + ee->engine.func->fn_render = _ecore_evas_buffer_render; + _ecore_evas_register(ee); + + evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); + + return ee; +#else + return NULL; +#endif +} + +EAPI const void * +ecore_evas_buffer_pixels_get(Ecore_Evas *ee) +{ +#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER + _ecore_evas_buffer_render(ee); + return ee->engine.buffer.pixels; +#else + return NULL; +#endif +} + +EAPI Evas * +ecore_evas_object_evas_get(Evas_Object *obj) +{ + Ecore_Evas *ee; + + ee = evas_object_data_get(obj, "Ecore_Evas"); + if (!ee) return NULL; + + return ecore_evas_get(ee); +} + +EAPI Ecore_Evas * +ecore_evas_object_ecore_evas_get(Evas_Object *obj) +{ + return evas_object_data_get(obj, "Ecore_Evas"); +} + +EAPI Evas_Object * +ecore_evas_object_image_new(Ecore_Evas *ee_target) +{ +// NOTE: if you fix this, consider fixing ecore_evas_ews.c as it is similar! +#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER + Evas_Object *o; + Evas_Engine_Info_Buffer *einfo; + Ecore_Evas *ee; + int rmethod; + int w = 1, h = 1; + + rmethod = evas_render_method_lookup("buffer"); + if (!rmethod) return NULL; + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) return NULL; + + o = evas_object_image_add(ee_target->evas); + evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); + evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888); + evas_object_image_alpha_set(o, 0); + evas_object_image_size_set(o, w, h); + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + _ecore_evas_buffer_init(); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_buffer_engine_func; + + ee->driver = "buffer"; + + ee->rotation = 0; + ee->visible = 0; + ee->w = w; + ee->h = h; + ee->req.w = ee->w; + ee->req.h = ee->h; + + ee->prop.max.w = 0; + ee->prop.max.h = 0; + ee->prop.layer = 0; + ee->prop.focused = 0; + ee->prop.borderless = 1; + ee->prop.override = 1; + ee->prop.maximized = 0; + ee->prop.fullscreen = 0; + ee->prop.withdrawn = 0; + ee->prop.sticky = 0; + + /* init evas here */ + ee->evas = evas_new(); + evas_data_attach_set(ee->evas, ee); + evas_output_method_set(ee->evas, rmethod); + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + + ee->engine.buffer.image = o; + evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas", ee); + evas_object_data_set(ee->engine.buffer.image, "Ecore_Evas_Parent", ee_target); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MOUSE_IN, + _ecore_evas_buffer_cb_mouse_in, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MOUSE_OUT, + _ecore_evas_buffer_cb_mouse_out, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MOUSE_DOWN, + _ecore_evas_buffer_cb_mouse_down, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MOUSE_UP, + _ecore_evas_buffer_cb_mouse_up, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MOUSE_MOVE, + _ecore_evas_buffer_cb_mouse_move, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MOUSE_WHEEL, + _ecore_evas_buffer_cb_mouse_wheel, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MULTI_DOWN, + _ecore_evas_buffer_cb_multi_down, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MULTI_UP, + _ecore_evas_buffer_cb_multi_up, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_MULTI_MOVE, + _ecore_evas_buffer_cb_multi_move, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_FREE, + _ecore_evas_buffer_cb_free, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_KEY_DOWN, + _ecore_evas_buffer_cb_key_down, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_KEY_UP, + _ecore_evas_buffer_cb_key_up, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_FOCUS_IN, + _ecore_evas_buffer_cb_focus_in, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_FOCUS_OUT, + _ecore_evas_buffer_cb_focus_out, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_SHOW, + _ecore_evas_buffer_cb_show, ee); + evas_object_event_callback_add(ee->engine.buffer.image, + EVAS_CALLBACK_HIDE, + _ecore_evas_buffer_cb_hide, ee); + einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); + if (einfo) + { + ee->engine.buffer.pixels = evas_object_image_data_get(o, 1); + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; + einfo->info.dest_buffer = ee->engine.buffer.pixels; + einfo->info.dest_buffer_row_bytes = evas_object_image_stride_get(o); + einfo->info.use_color_key = 0; + einfo->info.alpha_threshold = 0; + einfo->info.func.new_update_region = NULL; + einfo->info.func.free_update_region = NULL; + evas_object_image_data_set(o, ee->engine.buffer.pixels); + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + } + else + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + evas_key_modifier_add(ee->evas, "Shift"); + evas_key_modifier_add(ee->evas, "Control"); + evas_key_modifier_add(ee->evas, "Alt"); + evas_key_modifier_add(ee->evas, "Meta"); + evas_key_modifier_add(ee->evas, "Hyper"); + evas_key_modifier_add(ee->evas, "Super"); + evas_key_lock_add(ee->evas, "Caps_Lock"); + evas_key_lock_add(ee->evas, "Num_Lock"); + evas_key_lock_add(ee->evas, "Scroll_Lock"); + + ee_target->sub_ecore_evas = eina_list_append(ee_target->sub_ecore_evas, ee); + + ee->engine.func->fn_render = _ecore_evas_buffer_render; + + return o; +#else + return NULL; +#endif +} diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c new file mode 100644 index 0000000..1f946d5 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_cocoa.c @@ -0,0 +1,574 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "Ecore.h" +#include "ecore_private.h" +#include "Ecore_Input.h" +#include "Ecore_Input_Evas.h" + +#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA +#include +#include +#endif + +#include "ecore_evas_private.h" +#include "Ecore_Evas.h" + + +#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA + +// FIXME: this engine has lots of problems. only 1 window at a time, drawRect looks wrong, doesnt handle resizes and more + +static int _ecore_evas_init_count = 0; +static Ecore_Evas *ecore_evases = NULL; +static Ecore_Event_Handler *ecore_evas_event_handlers[4] = { + NULL, NULL, NULL, NULL +}; +static Ecore_Idle_Enterer *ecore_evas_idle_enterer = NULL; +static Ecore_Poller *ecore_evas_event = NULL; + +static const char *ecore_evas_cocoa_default = "EFL Cocoa"; + + +static int +_ecore_evas_cocoa_render(Ecore_Evas *ee) +{ + int rend = 0; + Eina_List *updates = NULL; + Eina_List *ll; + Ecore_Evas *ee2; + + DBG("Render"); + + EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) + { + if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); + if (ee2->engine.func->fn_render) + rend |= ee2->engine.func->fn_render(ee2); + if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); + } + + if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); + updates = evas_render_updates(ee->evas); + if (ee->prop.avoid_damage) + { + updates = evas_render_updates(ee->evas); + if (updates) evas_render_updates_free(updates); + } + else if ((ee->visible) || + ((ee->should_be_visible) && (ee->prop.fullscreen)) || + ((ee->should_be_visible) && (ee->prop.override))) + { + if (ee->shaped) + { + updates = evas_render_updates(ee->evas); + if (updates) evas_render_updates_free(updates); + } + else + { + updates = evas_render_updates(ee->evas); + if (updates) evas_render_updates_free(updates); + } + } + else + evas_norender(ee->evas); + if (updates) rend = 1; + if (ee->func.fn_post_render) ee->func.fn_post_render(ee); + + if (rend) + { + static int frames = 0; + static double t0 = 0.0; + double t, td; + + t = ecore_time_get(); + frames++; + if ((t - t0) > 1.0) + { + td = t - t0; + printf("FPS: %3.3f\n", (double)frames / td); + frames = 0; + t0 = t; + } + } + + return rend; +} + + +static Ecore_Evas * +_ecore_evas_cocoa_match(void) +{ + DBG("Match"); + return ecore_evases; +} + +static int +_ecore_evas_cocoa_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + + DBG("Got Focus"); + + ee = _ecore_evas_cocoa_match(); + + if (!ee) return ECORE_CALLBACK_PASS_ON; + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); + + return ECORE_CALLBACK_PASS_ON; +} + +static int +_ecore_evas_cocoa_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + + DBG("Lost Focus"); + + ee = _ecore_evas_cocoa_match(); + + if (!ee) return ECORE_CALLBACK_PASS_ON; + evas_focus_out(ee->evas); + ee->prop.focused = 0; + if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); + + return ECORE_CALLBACK_PASS_ON; +} + +static int +_ecore_evas_cocoa_event_video_resize(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + /*Ecore_Cocoa_Event_Video_Resize *e; + Ecore_Evas *ee; + + e = event; + ee = _ecore_evas_cocoa_match(); + + if (!ee) return 1; // pass on event + evas_output_size_set(ee->evas, e->w, e->h); + + return 0;*/ + + DBG("Video Resize"); + return ECORE_CALLBACK_PASS_ON; +} + +static int +_ecore_evas_cocoa_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) +{ + Ecore_Evas *ee; + int w; + int h; + + DBG("Video Expose"); + + ee = _ecore_evas_cocoa_match(); + + if (!ee) return ECORE_CALLBACK_PASS_ON; + evas_output_size_get(ee->evas, &w, &h); + evas_damage_rectangle_add(ee->evas, 0, 0, w, h); + + return ECORE_CALLBACK_PASS_ON; +} + +static int +_ecore_evas_idle_enter(void *data __UNUSED__) +{ + Ecore_Evas *ee; + double t1 = 0.; + double t2 = 0.; + + DBG("Idle enter"); + + EINA_INLIST_FOREACH(ecore_evases, ee) + { + if (ee->visible) + evas_render(ee->evas); + else + evas_norender(ee->evas); + } + + return EINA_TRUE; +} + +static int +_ecore_evas_cocoa_event(void *data) +{ + // ecore_cocoa_feed_events(); + + DBG("Cocoa Event"); + + return 1; +} + +static int +_ecore_evas_cocoa_init(void) +{ + DBG("Cocoa Init"); + _ecore_evas_init_count++; + if (_ecore_evas_init_count > 1) + return _ecore_evas_init_count; + + ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_COCOA_EVENT_GOT_FOCUS, _ecore_evas_cocoa_event_got_focus, NULL); + ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_COCOA_EVENT_LOST_FOCUS, _ecore_evas_cocoa_event_lost_focus, NULL); + ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_COCOA_EVENT_RESIZE, _ecore_evas_cocoa_event_video_resize, NULL); + ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_COCOA_EVENT_EXPOSE, _ecore_evas_cocoa_event_video_expose, NULL); + + ecore_event_evas_init(); + return _ecore_evas_init_count; +} + +static int +_ecore_evas_cocoa_shutdown(void) +{ + DBG("Cocoa SHutodwn"); + _ecore_evas_init_count--; + if (_ecore_evas_init_count == 0) + { + int i; + + while (ecore_evases) _ecore_evas_free(ecore_evases); + + for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++) + ecore_event_handler_del(ecore_evas_event_handlers[i]); + ecore_event_evas_shutdown(); + ecore_idle_enterer_del(ecore_evas_idle_enterer); + ecore_evas_idle_enterer = NULL; + ecore_poller_del(ecore_evas_event); + ecore_evas_event = NULL; + + ecore_event_evas_shutdown(); + } + if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; + return _ecore_evas_init_count; +} + +static void +_ecore_evas_cocoa_free(Ecore_Evas *ee) +{ + DBG("Cocoa Free"); + ecore_evases = (Ecore_Evas *) eina_inlist_remove(EINA_INLIST_GET(ecore_evases), EINA_INLIST_GET(ee)); + ecore_event_window_unregister(0); + _ecore_evas_cocoa_shutdown(); + ecore_cocoa_shutdown(); +} + +static void +_ecore_evas_resize(Ecore_Evas *ee, int w, int h) +{ + DBG("Resize"); + if ((w == ee->w) && (h == ee->h)) return; + ee->w = w; + ee->h = h; + + printf("Ecore_Evas Resize %d %d\n", w, h); + + ecore_cocoa_window_resize(ee->prop.window, w, h); + + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + + if (ee->func.fn_resize) ee->func.fn_resize(ee); +} + +static void +_ecore_evas_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) +{ + DBG("Move Resize"); + if ((w == ee->w) && (h == ee->h)) return; + ee->w = w; + ee->h = h; + + ecore_cocoa_window_move_resize(ee->prop.window, x, y, w, h); + + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + + if (ee->func.fn_resize) ee->func.fn_resize(ee); +} + + +static void +_ecore_evas_show(Ecore_Evas *ee, int x, int y, int w, int h) +{ + DBG("Show"); + ee->should_be_visible = 1; + if (ee->prop.avoid_damage) + _ecore_evas_cocoa_render(ee); + + ecore_cocoa_window_show(ee->prop.window); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); +} + + +static void +_ecore_evas_hide(Ecore_Evas *ee, int x, int y, int w, int h) +{ + DBG("Hide"); + + ecore_cocoa_window_hide(ee->prop.window); + ee->should_be_visible = 0; +} + +static void +_ecore_evas_title_set(Ecore_Evas *ee, const char *title) +{ + INF("ecore evas title set"); + + if (ee->prop.title) free(ee->prop.title); + ee->prop.title = NULL; + if (title) ee->prop.title = strdup(title); + ecore_cocoa_window_title_set(ee->prop.window, + ee->prop.title); +} + +static void +_ecore_evas_object_cursor_del(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Ecore_Evas *ee; + + DBG("Cursor DEL"); + + ee = data; + if (ee) + ee->prop.cursor.object = NULL; +} + +static void +_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +{ + int x, y; + DBG("Cursor Set"); + if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); + + if (obj == NULL) + { + ee->prop.cursor.object = NULL; + ee->prop.cursor.layer = 0; + ee->prop.cursor.hot.x = 0; + ee->prop.cursor.hot.y = 0; + return; + } + + ee->prop.cursor.object = obj; + ee->prop.cursor.layer = layer; + ee->prop.cursor.hot.x = hot_x; + ee->prop.cursor.hot.y = hot_y; + + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_move(ee->prop.cursor.object, + x - ee->prop.cursor.hot.x, + y - ee->prop.cursor.hot.y); + + evas_object_pass_events_set(ee->prop.cursor.object, 1); + + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); +} + +static int +_ecore_evas_engine_cocoa_init(Ecore_Evas *ee) +{ + Evas_Engine_Info_GL_Cocoa *einfo; + const char *driver; + int rmethod; + + DBG("Cocoa Init"); + + driver = "gl_cocoa"; + + rmethod = evas_render_method_lookup(driver); + if (!rmethod) + return 0; + + ee->driver = driver; + evas_output_method_set(ee->evas, rmethod); + + einfo = (Evas_Engine_Info_GL_Cocoa *)evas_engine_info_get(ee->evas); + if (einfo) + { + /* FIXME: REDRAW_DEBUG missing for now */ + einfo->window = ee->prop.window; + //einfo->info.depth = ecore_win32_screen_depth_get(); + //einfo->info.rotation = 0; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + return 0; + } + ecore_cocoa_window_view_set(einfo->window, einfo->view); + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + return 0; + } + + return 1; +} + +static Ecore_Evas_Engine_Func _ecore_cocoa_engine_func = + { + _ecore_evas_cocoa_free, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, //move + NULL, + _ecore_evas_resize, + _ecore_evas_move_resize, + NULL, //rotation + NULL, //shaped + _ecore_evas_show, + _ecore_evas_hide, + NULL, //raise + NULL, //lower + NULL, //activate + _ecore_evas_title_set, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_object_cursor_set, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, //transparent + NULL, // render + NULL + }; +#endif + +EAPI Ecore_Evas * +ecore_evas_cocoa_new(Ecore_Cocoa_Window *parent, int x, int y, int w, int h) +{ +#ifdef BUILD_ECORE_EVAS_OPENGL_COCOA + Evas_Engine_Info_GL_Cocoa *einfo; + Ecore_Evas *ee; + int rmethod; + + DBG("Cocoa new"); + + if (!ecore_cocoa_init()) + return NULL; + + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) + goto shutdown_ecore_cocoa; + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + _ecore_evas_cocoa_init(); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_cocoa_engine_func; + + if (w < 1) w = 1; + if (h < 1) h = 1; + ee->visible = 1; + ee->x = x; + ee->y = y; + ee->w = w; + ee->h = h; + ee->req.x = ee->x; + ee->req.y = ee->y; + ee->req.w = ee->w; + ee->req.h = ee->h; + + ee->semi_sync = 1; + + + ee->prop.max.w = 32767; + ee->prop.max.h = 32767; + ee->prop.layer = 4; + ee->prop.request_pos = 0; + ee->prop.sticky = 0; + ee->prop.window = 0; + + printf("Create New Evas\n"); + + ee->evas = evas_new(); + + if (!ee->evas) + goto free_name; + + evas_data_attach_set(ee->evas, ee); + evas_output_method_set(ee->evas, rmethod); + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + + printf("Create New Cocoa Window\n"); + ee->prop.window = (Ecore_Cocoa_Window*)ecore_cocoa_window_new(x, y, w, h); + printf("Window Created %p\n", ee->prop.window); + if (!ee->prop.window) + { + _ecore_evas_cocoa_shutdown(); + free(ee); + return NULL; + } + + printf("Init Evas engine cocoa\n"); + if (!_ecore_evas_engine_cocoa_init(ee)) + { + _ecore_evas_cocoa_shutdown(); + free(ee); + return NULL; + } + + + ee->engine.func->fn_render = _ecore_evas_cocoa_render; + _ecore_evas_register(ee); + ecore_event_window_register(0, ee, ee->evas, NULL, NULL, NULL, NULL); + + evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); + printf("Ecore Evas returned : %p\n", ee); + return ee; + + free_window: + /* FIXME: free window here */ + free_evas: + free(ee->evas); + free_name: + free(ee->name); + free_ee: + _ecore_evas_cocoa_shutdown(); + free(ee); + shutdown_ecore_cocoa: + ecore_cocoa_shutdown(); + + return NULL; +#else + ERR("Cocoa support in ecore-evas not enabled"); + return NULL; + parent = NULL; + x = y = w = h = 0; +#endif +} diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c new file mode 100644 index 0000000..457f9e9 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_directfb.c @@ -0,0 +1,596 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include +#include "ecore_private.h" +#ifdef BUILD_ECORE_EVAS_DIRECTFB +#include +#endif + +#include "ecore_evas_private.h" +#include "Ecore_Evas.h" + +#ifdef BUILD_ECORE_EVAS_DIRECTFB +static int _ecore_evas_init_count = 0; +static Ecore_Event_Handler *ecore_evas_event_handlers[13]; + +static Eina_Hash *ecore_evases_hash = NULL; + +static int +_ecore_evas_directfb_render(Ecore_Evas *ee) +{ + Eina_List *updates, *ll; + Ecore_Evas *ee2; + int rend = 0; + + EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) + { + if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); + if (ee2->engine.func->fn_render) + rend |= ee2->engine.func->fn_render(ee2); + if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); + } + + if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); + updates = evas_render_updates(ee->evas); + if (updates) + { + evas_render_updates_free(updates); + _ecore_evas_idle_timeout_update(ee); + } + if (ee->func.fn_post_render) ee->func.fn_post_render(ee); + + return updates ? 1 : rend; +} + +static char * +_ecore_evas_directfb_winid_str_get(Ecore_X_Window win) +{ + const char *vals = "qWeRtYuIoP5$&<~"; + static char id[9]; + unsigned int val; + val = (unsigned int)win; + id[0] = vals[(val >> 28) & 0xf]; + id[1] = vals[(val >> 24) & 0xf]; + id[2] = vals[(val >> 20) & 0xf]; + id[3] = vals[(val >> 16) & 0xf]; + id[4] = vals[(val >> 12) & 0xf]; + id[5] = vals[(val >> 8) & 0xf]; + id[6] = vals[(val >> 4) & 0xf]; + id[7] = vals[(val ) & 0xf]; + id[8] = 0; + return id; +} + +static Ecore_Evas * +_ecore_evas_directfb_match(DFBWindowID win) +{ + Ecore_Evas *ee; + + ee = eina_hash_find(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(win)); + return ee; +} + +static Eina_Bool +_ecore_evas_directfb_event_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_DirectFB_Event_Key_Down *e; + + e = event; + ee = _ecore_evas_directfb_match(e->win); + + if (!ee) return EINA_TRUE; /* pass on event */ + evas_event_feed_key_down(ee->evas, e->name, e->name, e->string, + e->key_compose, e->time, NULL); + return EINA_TRUE; +} + +static Eina_Bool +_ecore_evas_directfb_event_key_up(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_DirectFB_Event_Key_Up *e; + + e = event; + ee = _ecore_evas_directfb_match(e->win); + + if (!ee) return EINA_TRUE; /* pass on event */ + evas_event_feed_key_up(ee->evas, e->name, e->name, e->string, + e->key_compose, e->time, NULL); + return EINA_TRUE; +} + +static Eina_Bool +_ecore_evas_directfb_event_motion(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_DirectFB_Event_Motion *e; + + e = event; + ee = _ecore_evas_directfb_match(e->win); + + if (!ee) return EINA_TRUE; /* pass on event */ + _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + return EINA_TRUE; +} + +static Eina_Bool +_ecore_evas_directfb_event_button_down(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_DirectFB_Event_Button_Down *e; + + e = event; + ee = _ecore_evas_directfb_match(e->win); + + if (!ee) return EINA_TRUE; /* pass on event */ + // _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + evas_event_feed_mouse_down(ee->evas, e->button, EVAS_BUTTON_NONE, e->time, NULL); + return EINA_TRUE; +} + +static Eina_Bool +_ecore_evas_directfb_event_button_up(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_DirectFB_Event_Button_Up *e; + Evas_Button_Flags flags = EVAS_BUTTON_NONE; + + e = event; + ee = _ecore_evas_directfb_match(e->win); + + if (!ee) return EINA_TRUE; /* pass on event */ + //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + evas_event_feed_mouse_up(ee->evas, e->button, flags, e->time, NULL); + return EINA_TRUE; +} + +static Eina_Bool +_ecore_evas_directfb_event_enter(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_DirectFB_Event_Enter *e; + + e = event; + ee = _ecore_evas_directfb_match(e->win); + + if (!ee) return EINA_TRUE; /* pass on event */ + evas_event_feed_mouse_in(ee->evas, e->time, NULL); + //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + return EINA_TRUE; +} + +static Eina_Bool +_ecore_evas_directfb_event_leave(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_DirectFB_Event_Leave *e; + + e = event; + ee = _ecore_evas_directfb_match(e->win); + + if (!ee) return EINA_TRUE; /* pass on event */ + evas_event_feed_mouse_out(ee->evas, e->time, NULL); + //_ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); + if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); + return EINA_TRUE; +} + +static Eina_Bool +_ecore_evas_directfb_event_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_DirectFB_Event_Wheel *e; + + e = event; + ee = _ecore_evas_directfb_match(e->win); + + if (!ee) return EINA_TRUE; /* pass on event */ + evas_event_feed_mouse_wheel(ee->evas, e->direction, e->z, e->time, NULL); + return EINA_TRUE; +} + +static Eina_Bool +_ecore_evas_directfb_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_DirectFB_Event_Got_Focus *e; + + e = event; + ee = _ecore_evas_directfb_match(e->win); + + if (!ee) return EINA_TRUE; /* pass on event */ + ee->prop.focused = 1; + return EINA_TRUE; +} + +static Eina_Bool +_ecore_evas_directfb_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_DirectFB_Event_Lost_Focus *e; + + e = event; + ee = _ecore_evas_directfb_match(e->win); + + if (!ee) return EINA_TRUE; /* pass on event */ + ee->prop.focused = 0; + return EINA_TRUE; +} + +int +_ecore_evas_directfb_shutdown(void) +{ + _ecore_evas_init_count--; + if (_ecore_evas_init_count == 0) + { + int i; + + for (i = 0; i < 8; i++) + ecore_event_handler_del(ecore_evas_event_handlers[i]); + } + if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; + return _ecore_evas_init_count; +} + + + + + +int +_ecore_evas_directfb_init(void) +{ + _ecore_evas_init_count++; + if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; + + ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_KEY_DOWN, _ecore_evas_directfb_event_key_down, NULL); + ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_KEY_UP, _ecore_evas_directfb_event_key_up, NULL); + ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_BUTTON_DOWN, _ecore_evas_directfb_event_button_down, NULL); + ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_BUTTON_UP, _ecore_evas_directfb_event_button_up, NULL); + ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_MOTION, _ecore_evas_directfb_event_motion, NULL); + ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_ENTER, _ecore_evas_directfb_event_enter, NULL); + ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_LEAVE, _ecore_evas_directfb_event_leave, NULL); + ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_WHEEL, _ecore_evas_directfb_event_wheel, NULL); + ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_GOT_FOCUS, _ecore_evas_directfb_event_got_focus, NULL); + ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_DIRECTFB_EVENT_LOST_FOCUS, _ecore_evas_directfb_event_lost_focus, NULL); + ecore_evas_event_handlers[10] = NULL; + ecore_evas_event_handlers[11] = NULL; + ecore_evas_event_handlers[12] = NULL; + + return _ecore_evas_init_count; +} + +/* engine functions */ +/********************/ + +static void +_ecore_evas_directfb_free(Ecore_Evas *ee) +{ + eina_hash_del(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(ee->engine.directfb.window->id), ee); + ecore_directfb_window_free(ee->engine.directfb.window); + _ecore_evas_directfb_shutdown(); + ecore_directfb_shutdown(); +} + +static void +_ecore_evas_directfb_move(Ecore_Evas *ee, int x, int y) +{ + ecore_directfb_window_move(ee->engine.directfb.window, x, y); +} + +static void +_ecore_evas_directfb_resize(Ecore_Evas *ee, int w, int h) +{ + ee->req.w = w; + ee->req.h = h; + if ((w == ee->w) && (h == ee->h)) return; + ecore_directfb_window_resize(ee->engine.directfb.window, w, h); + ee->w = w; + ee->h = h; + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + } + else + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } +} + +static void +_ecore_evas_directfb_focus_set(Ecore_Evas *ee, int on __UNUSED__) +{ + ecore_directfb_window_focus(ee->engine.directfb.window); +} + +static void +_ecore_evas_directfb_hide(Ecore_Evas *ee) +{ + ecore_directfb_window_hide(ee->engine.directfb.window); + ee->should_be_visible = 0; +} + +static void +_ecore_evas_directfb_show(Ecore_Evas *ee) +{ + ecore_directfb_window_show(ee->engine.directfb.window); + ee->should_be_visible = 1; +} + +static void +_ecore_evas_directfb_shaped_set(Ecore_Evas *ee, int shaped) +{ + if (((ee->shaped) && (shaped)) || ((!ee->shaped) && (!shaped))) + return; + ee->shaped = shaped; + if(ee->shaped) + ecore_directfb_window_shaped_set(ee->engine.directfb.window, 1); + else + ecore_directfb_window_shaped_set(ee->engine.directfb.window, 0); + +} + +static void +_ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + + ee = data; + if (ee) + ee->prop.cursor.object = NULL; +} + +static void +_ecore_evas_directfb_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +{ + int x, y; + + if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); + + if (!obj) + { + ee->prop.cursor.object = NULL; + ee->prop.cursor.layer = 0; + ee->prop.cursor.hot.x = 0; + ee->prop.cursor.hot.y = 0; + ecore_directfb_window_cursor_show(ee->engine.directfb.window, 1); + return; + + } + + ee->prop.cursor.object = obj; + ee->prop.cursor.layer = layer; + ee->prop.cursor.hot.x = hot_x; + ee->prop.cursor.hot.y = hot_y; + + ecore_directfb_window_cursor_show(ee->engine.directfb.window, 0); + + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_move(ee->prop.cursor.object,x - ee->prop.cursor.hot.x,y - ee->prop.cursor.hot.y); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); +} + +static void +_ecore_evas_directfb_fullscreen_set(Ecore_Evas *ee, int on) +{ + Evas_Engine_Info_DirectFB *einfo; + int w; + int h; + int resized = 0; + + if (((ee->prop.fullscreen) && (on)) || ((!ee->prop.fullscreen) && (!on))) + return; + + if (on) + ecore_directfb_window_fullscreen_set(ee->engine.directfb.window, 1); + else + ecore_directfb_window_fullscreen_set(ee->engine.directfb.window, 0); + /* set the new size of the evas */ + ecore_directfb_window_size_get(ee->engine.directfb.window, &w, &h); + if( (ee->w != w) || (ee->h != h)) + { + resized = 1; + ee->w = w; + ee->h = h; + ee->req.w = ee->w; + ee->req.h = ee->h; + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + } + else + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } + } + einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(ee->evas); + if (einfo) + { + einfo->info.surface = ee->engine.directfb.window->surface; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + } + ee->prop.fullscreen = on; + if (resized) + { + if(ee->func.fn_resize) ee->func.fn_resize(ee); + } +} + +static void * +_ecore_evas_directfb_window_get(const Ecore_Evas *ee) +{ + return ee->engine.directfb.window; +} +#endif + +#ifdef BUILD_ECORE_EVAS_DIRECTFB +static Ecore_Evas_Engine_Func _ecore_directfb_engine_func = +{ + _ecore_evas_directfb_free, /* free an ecore_evas */ + NULL, /* cb resize */ + NULL, /* cb move */ + NULL, /* cb show */ + NULL, /* cb hide */ + NULL, /* cb delete request */ + NULL, /* cb destroy */ + NULL, /* cb focus in */ + NULL, /* cb focus out */ + NULL, /* cb sticky */ + NULL, /* cb unsticky */ + NULL, /* cb mouse in */ + NULL, /* cb mouse out */ + NULL, /* cb pre render */ + NULL, /* cb post render */ + _ecore_evas_directfb_move, /* move */ + NULL, /* managed move */ + _ecore_evas_directfb_resize, /* resize */ + NULL, /* move resize */ + NULL,//_ecore_evas_directfb_rotation_set,/* rotation */ + _ecore_evas_directfb_shaped_set, /* shaped */ + _ecore_evas_directfb_show, /* show */ + _ecore_evas_directfb_hide, /* hide */ + NULL, /* raise */ + NULL, /* lower */ + NULL, /* activate */ + NULL, /* title set */ + NULL, /* name class set */ + NULL, /* size min */ + NULL, /* size max */ + NULL, /* size base */ + NULL, /* size step */ + _ecore_evas_directfb_object_cursor_set, /* set cursor to an evas object */ + NULL, /* layer set */ + _ecore_evas_directfb_focus_set, /* focus */ + NULL, /* iconified */ + NULL, /* borderless */ + NULL, /* override */ + NULL, /* maximized */ + _ecore_evas_directfb_fullscreen_set,/* fullscreen */ + NULL, /* avoid damage */ + NULL, /* withdrawn */ + NULL, /* sticky */ + NULL, /* ignore events */ + NULL, /* alpha */ + NULL, //transparent + + NULL, // render + NULL // screen_geometry_get +}; +#endif + +/* api */ +/*******/ + +#ifdef BUILD_ECORE_EVAS_DIRECTFB +EAPI Ecore_Evas * +ecore_evas_directfb_new(const char *disp_name, int windowed, int x, int y, int w, int h) +{ + Evas_Engine_Info_DirectFB *einfo; + Ecore_Evas *ee; + Ecore_DirectFB_Window *window; + int rmethod; + + rmethod = evas_render_method_lookup("directfb"); + if (!rmethod) return NULL; + if (!ecore_directfb_init(disp_name)) return NULL; + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) return NULL; + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + _ecore_evas_directfb_init(); + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_directfb_engine_func; + + ee->driver = "directfb"; + if (disp_name) ee->name = strdup(disp_name); + + if (w < 1) w = 1; + if (h < 1) h = 1; + + ee->rotation = 0; + ee->visible = 1; + ee->x = x; + ee->y = y; + ee->w = w; + ee->h = h; + ee->req.x = ee->x; + ee->req.y = ee->y; + ee->req.w = ee->w; + ee->req.h = ee->h; + ee->prop.layer = 1; + ee->prop.fullscreen = 0; + + /* init evas here */ + ee->evas = evas_new(); + evas_data_attach_set(ee->evas, ee); + evas_output_method_set(ee->evas, rmethod); + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + einfo = (Evas_Engine_Info_DirectFB *)evas_engine_info_get(ee->evas); + + window = ecore_directfb_window_new(x,y,w,h); + ee->engine.directfb.window = window; + if (einfo) + { + einfo->info.dfb = ecore_directfb_interface_get(); + einfo->info.surface = window->surface; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + + ee->engine.func->fn_render = _ecore_evas_directfb_render; + _ecore_evas_register(ee); + + if (!ecore_evases_hash) + ecore_evases_hash = eina_hash_string_superfast_new(NULL); + eina_hash_add(ecore_evases_hash, _ecore_evas_directfb_winid_str_get(ee->engine.directfb.window->id), ee); + + return ee; +} +#else +EAPI Ecore_Evas * +ecore_evas_directfb_new(const char *disp_name __UNUSED__, int windowed __UNUSED__, int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) +{ + return NULL; +} +#endif + +#ifdef BUILD_ECORE_EVAS_DIRECTFB +EAPI Ecore_DirectFB_Window * +ecore_evas_directfb_window_get(const Ecore_Evas *ee) +{ + return (Ecore_DirectFB_Window *) _ecore_evas_directfb_window_get(ee); +} +#else +EAPI Ecore_DirectFB_Window * +ecore_evas_directfb_window_get(const Ecore_Evas *ee __UNUSED__) +{ + return NULL; +} +#endif diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c new file mode 100644 index 0000000..e19fb05 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_ews.c @@ -0,0 +1,1454 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include "ecore_private.h" +#include + +#include "ecore_evas_private.h" +#include "Ecore_Evas.h" + +EAPI int ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE = 0; +EAPI int ECORE_EVAS_EWS_EVENT_ADD = 0; +EAPI int ECORE_EVAS_EWS_EVENT_DEL = 0; +EAPI int ECORE_EVAS_EWS_EVENT_RESIZE = 0; +EAPI int ECORE_EVAS_EWS_EVENT_MOVE = 0; +EAPI int ECORE_EVAS_EWS_EVENT_SHOW = 0; +EAPI int ECORE_EVAS_EWS_EVENT_HIDE = 0; +EAPI int ECORE_EVAS_EWS_EVENT_FOCUS = 0; +EAPI int ECORE_EVAS_EWS_EVENT_UNFOCUS = 0; +EAPI int ECORE_EVAS_EWS_EVENT_RAISE = 0; +EAPI int ECORE_EVAS_EWS_EVENT_LOWER = 0; +EAPI int ECORE_EVAS_EWS_EVENT_ACTIVATE = 0; + +EAPI int ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE = 0; +EAPI int ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE = 0; +EAPI int ECORE_EVAS_EWS_EVENT_LAYER_CHANGE = 0; +EAPI int ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE = 0; +EAPI int ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE = 0; + +#ifdef BUILD_ECORE_EVAS_EWS +static int _ecore_evas_init_count = 0; + +static Ecore_Evas *_ews_ee = NULL; +static Evas_Object *_ews_bg = NULL; +static Eina_List *_ews_children = NULL; +static const void *_ews_manager = NULL; +static char *_ews_engine = NULL; +static char *_ews_options = NULL; +static int _ews_x = 0; +static int _ews_y = 0; +static int _ews_w = 1024; +static int _ews_h = 768; +static Eina_Bool _ews_defaults_engine = EINA_TRUE; +static Eina_Bool _ews_defaults_geo = EINA_TRUE; + +static const char EWS_ENGINE_NAME[] = "ews"; + +static void +_ecore_evas_ews_pre_free(Ecore_Evas *ee __UNUSED__) +{ + DBG("EWS backing store free'd"); + _ews_children = eina_list_free(_ews_children); + _ews_ee = NULL; + _ews_bg = NULL; +} + +static void +_ecore_evas_ews_del_request(Ecore_Evas *ee __UNUSED__) +{ + INF("EWS backing store deletion is forbidden!"); +} + +static Ecore_Evas * +_ecore_evas_ews_ee_new(void) +{ + Ecore_Evas *ee = ecore_evas_new(_ews_engine, _ews_x, _ews_y, _ews_w, _ews_h, + _ews_options); + if (!ee) + ERR("Failed: ecore_evas_new(%s, %d, %d, %d, %d, %s)", + _ews_engine, _ews_x, _ews_y, _ews_w, _ews_h, _ews_options); + else + { + ecore_evas_size_min_set(ee, _ews_w, _ews_h); + ecore_evas_size_max_set(ee, _ews_w, _ews_h); + ecore_evas_callback_pre_free_set(ee, _ecore_evas_ews_pre_free); + ecore_evas_callback_delete_request_set(ee, _ecore_evas_ews_del_request); + ecore_evas_name_class_set(ee, "ecore_evas_ews", "ews"); + ecore_evas_title_set + (ee, "EWS: Ecore + Evas Single Process Windowing System"); + ecore_evas_show(ee); + } + + return ee; +} + +static void +_ecore_evas_ews_env_setup(void) +{ + const char *env = getenv("ECORE_EVAS_EWS"); + char *p, *n, *tmp; + + if (_ews_defaults_engine) + { + free(_ews_engine); + _ews_engine = NULL; + free(_ews_options); + _ews_options = NULL; + } + if (_ews_defaults_geo) + { + _ews_x = 0; + _ews_y = 0; + _ews_w = 1024; + _ews_h = 768; + } + + if ((!env) || (!*env)) return; + + p = tmp = strdup(env); + if (!tmp) return; + + n = strchr(p, ':'); + if (n) *n = '\0'; + if (_ews_defaults_engine) _ews_engine = strdup(p); + if (!n) goto end; + + p = n + 1; + n = strchr(p, ':'); + if (!n) goto end; + *n = '\0'; + if (_ews_defaults_geo) _ews_x = atoi(p); + + p = n + 1; + n = strchr(p, ':'); + if (!n) goto end; + *n = '\0'; + if (_ews_defaults_geo) _ews_y = atoi(p); + + p = n + 1; + n = strchr(p, ':'); + if (!n) goto end; + *n = '\0'; + if (_ews_defaults_geo) _ews_w = atoi(p); + + p = n + 1; + n = strchr(p, ':'); + if (n) *n = '\0'; + if (_ews_defaults_geo) _ews_h = atoi(p); + if (!n) goto end; + + p = n + 1; + if (_ews_defaults_engine) _ews_options = strdup(p); + + end: + free(tmp); +} + +static void +_ecore_evas_ews_event_free(void *data __UNUSED__, void *ev) +{ + Ecore_Evas *ee = ev; + _ecore_evas_unref(ee); +} + +static void +_ecore_evas_ews_event(Ecore_Evas *ee, int event) +{ + _ecore_evas_ref(ee); + ecore_event_add(event, ee, _ecore_evas_ews_event_free, NULL); +} + +static void +_ecore_evas_ews_event_free_del(void *data __UNUSED__, void *ev __UNUSED__) +{ + _ecore_evas_ews_shutdown(); +} + +static void +_ecore_evas_ews_free(Ecore_Evas *ee) +{ + evas_object_del(ee->engine.ews.image); + _ews_ee->sub_ecore_evas = eina_list_remove(_ews_ee->sub_ecore_evas, ee); + + ecore_event_add(ECORE_EVAS_EWS_EVENT_DEL, ee, _ecore_evas_ews_event_free_del, NULL); +} + +static void +_ecore_evas_ews_move(Ecore_Evas *ee, int x, int y) +{ + ee->req.x = x; + ee->req.y = y; + + if ((x == ee->x) && (y == ee->y)) return; + ee->x = x; + ee->y = y; + evas_object_move(ee->engine.ews.image, x, y); + if (ee->func.fn_move) ee->func.fn_move(ee); + + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MOVE); +} + +static void +_ecore_evas_ews_managed_move(Ecore_Evas *ee, int x, int y) +{ + ee->req.x = x; + ee->req.y = y; + + if ((x == ee->x) && (y == ee->y)) return; + ee->x = x; + ee->y = y; + if (ee->func.fn_move) ee->func.fn_move(ee); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MOVE); +} + +static void +_ecore_evas_ews_resize_internal(Ecore_Evas *ee, int w, int h) +{ + Evas_Engine_Info_Buffer *einfo; + void *pixels; + int stride; + + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + evas_damage_rectangle_add(ee->evas, 0, 0, w, h); + + evas_object_image_size_set(ee->engine.ews.image, w, h); + evas_object_image_fill_set(ee->engine.ews.image, 0, 0, w, h); + evas_object_resize(ee->engine.ews.image, w, h); + + pixels = evas_object_image_data_get(ee->engine.ews.image, 1); + evas_object_image_data_set(ee->engine.ews.image, pixels); // refcount + stride = evas_object_image_stride_get(ee->engine.ews.image); + + einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); + EINA_SAFETY_ON_NULL_RETURN(einfo); + + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; + einfo->info.dest_buffer = pixels; + einfo->info.dest_buffer_row_bytes = stride; + einfo->info.use_color_key = 0; + einfo->info.alpha_threshold = 0; + einfo->info.func.new_update_region = NULL; + einfo->info.func.free_update_region = NULL; + evas_object_image_data_set(ee->engine.ews.image, pixels); + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } +} + +static void +_ecore_evas_ews_resize(Ecore_Evas *ee, int w, int h) +{ + if (w < 1) w = 1; + if (h < 1) h = 1; + + ee->req.w = w; + ee->req.h = h; + + if ((w == ee->w) && (h == ee->h)) return; + ee->w = w; + ee->h = h; + _ecore_evas_ews_resize_internal(ee, w, h); + if (ee->func.fn_resize) ee->func.fn_resize(ee); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_RESIZE); +} + +static void +_ecore_evas_ews_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) +{ + _ecore_evas_ews_move(ee, x, y); + _ecore_evas_ews_resize(ee, w, h); +} + +static void +_ecore_evas_ews_rotation_set(Ecore_Evas *ee, int rot, int resize) +{ + if (ee->rotation == rot) return; + ee->rotation = rot; + + ERR("TODO: rot=%d, resize=%d", rot, resize); + + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_shaped_set(Ecore_Evas *ee, int val) +{ + if (ee->shaped == val) return; + ee->shaped = val; + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_show(Ecore_Evas *ee) +{ + ee->should_be_visible = EINA_TRUE; + evas_object_show(ee->engine.ews.image); + if (ee->prop.fullscreen) + evas_object_focus_set(ee->engine.ews.image, EINA_TRUE); + + if (ee->func.fn_show) ee->func.fn_show(ee); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_SHOW); +} + +static void +_ecore_evas_ews_hide(Ecore_Evas *ee) +{ + ee->should_be_visible = EINA_FALSE; + evas_object_hide(ee->engine.ews.image); + + if (ee->func.fn_hide) ee->func.fn_hide(ee); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_HIDE); +} + +static void +_ecore_evas_ews_raise(Ecore_Evas *ee) +{ + evas_object_raise(ee->engine.ews.image); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_RAISE); +} + +static void +_ecore_evas_ews_lower(Ecore_Evas *ee) +{ + evas_object_lower(ee->engine.ews.image); + evas_object_lower(_ews_bg); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_LOWER); +} + +static void +_ecore_evas_ews_activate(Ecore_Evas *ee) +{ + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ACTIVATE); +} + +static void +_ecore_evas_ews_title_set(Ecore_Evas *ee, const char *t) +{ + if (ee->prop.title) free(ee->prop.title); + ee->prop.title = NULL; + if (t) ee->prop.title = strdup(t); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_name_class_set(Ecore_Evas *ee, const char *n, const char *c) +{ + if (ee->prop.name) free(ee->prop.name); + if (ee->prop.clas) free(ee->prop.clas); + ee->prop.name = NULL; + ee->prop.clas = NULL; + if (n) ee->prop.name = strdup(n); + if (c) ee->prop.clas = strdup(c); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_size_min_set(Ecore_Evas *ee, int w, int h) +{ + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return; + ee->prop.min.w = w; + ee->prop.min.h = h; + evas_object_size_hint_min_set(ee->engine.ews.image, w, h); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_size_max_set(Ecore_Evas *ee, int w, int h) +{ + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return; + ee->prop.max.w = w; + ee->prop.max.h = h; + evas_object_size_hint_max_set(ee->engine.ews.image, w, h); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_size_base_set(Ecore_Evas *ee, int w, int h) +{ + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return; + ee->prop.base.w = w; + ee->prop.base.h = h; + evas_object_size_hint_request_set(ee->engine.ews.image, w, h); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_size_step_set(Ecore_Evas *ee, int w, int h) +{ + if (w < 1) w = 1; + if (h < 1) h = 1; + if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return; + ee->prop.step.w = w; + ee->prop.step.h = h; + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + ee->prop.cursor.object = NULL; +} + +static void +_ecore_evas_ews_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +{ + int x, y; + + if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); + + if (!obj) + { + ee->prop.cursor.object = NULL; + ee->prop.cursor.layer = 0; + ee->prop.cursor.hot.x = 0; + ee->prop.cursor.hot.y = 0; + return; + } + + ee->prop.cursor.object = obj; + ee->prop.cursor.layer = layer; + ee->prop.cursor.hot.x = hot_x; + ee->prop.cursor.hot.y = hot_y; + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_move(ee->prop.cursor.object, + x - ee->prop.cursor.hot.x, + y - ee->prop.cursor.hot.y); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); + + evas_object_event_callback_add + (obj, EVAS_CALLBACK_DEL, _ecore_evas_ews_object_cursor_del, ee); + + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_layer_set(Ecore_Evas *ee, int layer) +{ + if (layer < EVAS_LAYER_MIN + 1) + layer = EVAS_LAYER_MIN + 1; + else if (layer > EVAS_LAYER_MAX) + layer = EVAS_LAYER_MAX; + + if (ee->prop.layer == layer) return; + ee->prop.layer = layer; + evas_object_layer_set(ee->engine.ews.image, layer); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_LAYER_CHANGE); +} + +static void +_ecore_evas_ews_focus_set(Ecore_Evas *ee, int val) +{ + evas_object_focus_set(ee->engine.ews.image, val); + ee->prop.focused = val; + if (val) + { + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_FOCUS); + } + else + { + evas_focus_out(ee->evas); + if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_UNFOCUS); + } +} + +static void +_ecore_evas_ews_iconified_set(Ecore_Evas *ee, int val) +{ + if (ee->prop.iconified == val) return; + ee->prop.iconified = val; + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE); +} + +static void +_ecore_evas_ews_borderless_set(Ecore_Evas *ee, int val) +{ + if (ee->prop.borderless == val) return; + ee->prop.borderless = val; + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_override_set(Ecore_Evas *ee, int val) +{ + if (ee->prop.override == val) return; + if (ee->visible) evas_object_show(ee->engine.ews.image); + if (ee->prop.focused) evas_object_focus_set(ee->engine.ews.image, EINA_TRUE); + ee->prop.override = val; + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_maximized_set(Ecore_Evas *ee, int val) +{ + if (ee->prop.maximized == val) return; + ee->prop.maximized = val; + if (val) evas_object_show(ee->engine.ews.image); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE); +} + +static void +_ecore_evas_ews_fullscreen_set(Ecore_Evas *ee, int val) +{ + if (ee->prop.fullscreen == val) return; + ee->prop.fullscreen = val; + + if (!val) + { + evas_object_move(ee->engine.ews.image, ee->x, ee->y); + evas_object_resize(ee->engine.ews.image, ee->w, ee->h); + } + else + { + Evas_Coord w, h; + ecore_evas_geometry_get(_ews_ee, NULL, NULL, &w, &h); + evas_object_move(ee->engine.ews.image, 0, 0); + evas_object_resize(ee->engine.ews.image, w, h); + evas_object_focus_set(ee->engine.ews.image, EINA_TRUE); + } + + if (ee->should_be_visible) + evas_object_show(ee->engine.ews.image); + else + evas_object_hide(ee->engine.ews.image); + + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE); +} + +static void +_ecore_evas_ews_avoid_damage_set(Ecore_Evas *ee, int val) +{ + if (ee->prop.avoid_damage == val) return; + ee->prop.avoid_damage = val; + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_withdrawn_set(Ecore_Evas *ee, int val) +{ + if (ee->prop.withdrawn == val) return; + ee->prop.withdrawn = val; + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_sticky_set(Ecore_Evas *ee, int val) +{ + if (ee->prop.sticky == val) return; + ee->prop.sticky = val; + if ((val) && (ee->func.fn_sticky)) ee->func.fn_sticky(ee); + else if ((!val) && (ee->func.fn_unsticky)) ee->func.fn_unsticky(ee); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_ignore_events_set(Ecore_Evas *ee, int val) +{ + if (ee->ignore_events == val) return; + ee->ignore_events = val; + evas_object_pass_events_set(ee->engine.ews.image, val); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_alpha_set(Ecore_Evas *ee, int val) +{ + if (ee->alpha == val) return; + ee->alpha = val; + evas_object_image_alpha_set(ee->engine.ews.image, val); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static void +_ecore_evas_ews_transparent_set(Ecore_Evas *ee, int val) +{ + if (ee->transparent == val) return; + ee->transparent = val; + evas_object_image_alpha_set(ee->engine.ews.image, val); + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE); +} + +static int +_ecore_evas_ews_render(Ecore_Evas *ee) +{ + Eina_List *updates = NULL, *l, *ll; + Ecore_Evas *ee2; + Eina_Rectangle *r; + int w, h, rend = 0; + void *pixels; + + EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) + { + if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); + rend |= _ecore_evas_ews_render(ee2); + if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); + } + + evas_object_image_size_get(ee->engine.ews.image, &w, &h); + if ((w != ee->w) || (h != ee->h)) + ecore_evas_resize(ee, w, h); + + pixels = evas_object_image_data_get(ee->engine.ews.image, 1); + if (pixels) + { + updates = evas_render_updates(ee->evas); + } + evas_object_image_data_set(ee->engine.ews.image, pixels); + + EINA_LIST_FOREACH(updates, l, r) + evas_object_image_data_update_add(ee->engine.ews.image, + r->x, r->y, r->w, r->h); + + if (updates) + { + evas_render_updates_free(updates); + _ecore_evas_idle_timeout_update(ee); + } + + return updates ? 1 : rend; +} + +static void +_ecore_evas_ews_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) +{ + ecore_evas_geometry_get(_ews_ee, x, y, w, h); +} + +static const Ecore_Evas_Engine_Func _ecore_ews_engine_func = +{ + _ecore_evas_ews_free, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_ews_move, + _ecore_evas_ews_managed_move, + _ecore_evas_ews_resize, + _ecore_evas_ews_move_resize, + _ecore_evas_ews_rotation_set, + _ecore_evas_ews_shaped_set, + _ecore_evas_ews_show, + _ecore_evas_ews_hide, + _ecore_evas_ews_raise, + _ecore_evas_ews_lower, + _ecore_evas_ews_activate, + _ecore_evas_ews_title_set, + _ecore_evas_ews_name_class_set, + _ecore_evas_ews_size_min_set, + _ecore_evas_ews_size_max_set, + _ecore_evas_ews_size_base_set, + _ecore_evas_ews_size_step_set, + _ecore_evas_ews_object_cursor_set, + _ecore_evas_ews_layer_set, + _ecore_evas_ews_focus_set, + _ecore_evas_ews_iconified_set, + _ecore_evas_ews_borderless_set, + _ecore_evas_ews_override_set, + _ecore_evas_ews_maximized_set, + _ecore_evas_ews_fullscreen_set, + _ecore_evas_ews_avoid_damage_set, + _ecore_evas_ews_withdrawn_set, + _ecore_evas_ews_sticky_set, + _ecore_evas_ews_ignore_events_set, + _ecore_evas_ews_alpha_set, + _ecore_evas_ews_transparent_set, + _ecore_evas_ews_render, + _ecore_evas_ews_screen_geometry_get +}; + +void +_ecore_evas_ews_events_init(void) +{ + if (ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE != 0) return; + ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_ADD = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_DEL = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_RESIZE = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_MOVE = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_SHOW = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_HIDE = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_FOCUS = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_UNFOCUS = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_RAISE = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_LOWER = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_ACTIVATE = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_ICONIFIED_CHANGE = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_MAXIMIZED_CHANGE = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_LAYER_CHANGE = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_FULLSCREEN_CHANGE = ecore_event_type_new(); + ECORE_EVAS_EWS_EVENT_CONFIG_CHANGE = ecore_event_type_new(); +} + +static int +_ecore_evas_ews_init(void) +{ + _ecore_evas_init_count++; + if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; + + _ecore_evas_ews_env_setup(); + + return _ecore_evas_init_count; +} + +int +_ecore_evas_ews_shutdown(void) +{ + _ecore_evas_init_count--; + if (_ecore_evas_init_count == 0) + { + if (_ews_ee) + { + ecore_evas_free(_ews_ee); + _ews_ee = NULL; + } + if (_ews_children) + { + eina_list_free(_ews_children); + _ews_children = NULL; + } + + free(_ews_engine); + _ews_engine = NULL; + free(_ews_options); + _ews_options = NULL; + _ews_defaults_engine = EINA_TRUE; + _ews_defaults_geo = EINA_TRUE; + + } + if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; + return _ecore_evas_init_count; +} + +static void +_ecore_evas_ews_coord_translate(Ecore_Evas *ee, Evas_Coord *x, Evas_Coord *y) +{ + Evas_Coord xx, yy, ww, hh, fx, fy, fw, fh; + + evas_object_geometry_get(ee->engine.ews.image, &xx, &yy, &ww, &hh); + evas_object_image_fill_get(ee->engine.ews.image, &fx, &fy, &fw, &fh); + + if (fw < 1) fw = 1; + if (fh < 1) fh = 1; + + if ((fx == 0) && (fy == 0) && (fw == ww) && (fh == hh)) + { + *x = (ee->w * (*x - xx)) / fw; + *y = (ee->h * (*y - yy)) / fh; + } + else + { + xx = (*x - xx) - fx; + while (xx < 0) xx += fw; + while (xx > fw) xx -= fw; + *x = (ee->w * xx) / fw; + + yy = (*y - yy) - fy; + while (yy < 0) yy += fh; + while (yy > fh) yy -= fh; + *y = (ee->h * yy) / fh; + } +} + +static void +_ecore_evas_ews_modifiers_apply(Ecore_Evas *ee, const Evas_Modifier *modifier) +{ + Evas *e = ee->evas; + + if (evas_key_modifier_is_set(modifier, "Shift")) + evas_key_modifier_on(e, "Shift"); + else evas_key_modifier_off(e, "Shift"); + + if (evas_key_modifier_is_set(modifier, "Control")) + evas_key_modifier_on(e, "Control"); + else evas_key_modifier_off(e, "Control"); + + if (evas_key_modifier_is_set(modifier, "Alt")) + evas_key_modifier_on(e, "Alt"); + else evas_key_modifier_off(e, "Alt"); + + if (evas_key_modifier_is_set(modifier, "Super")) + evas_key_modifier_on(e, "Super"); + else evas_key_modifier_off(e, "Super"); + + if (evas_key_modifier_is_set(modifier, "Hyper")) + evas_key_modifier_on(e, "Hyper"); + else evas_key_modifier_off(e, "Hyper"); + + if (evas_key_modifier_is_set(modifier, "Scroll_Lock")) + evas_key_lock_on(e, "Scroll_Lock"); + else evas_key_lock_off(e, "Scroll_Lock"); + + if (evas_key_modifier_is_set(modifier, "Num_Lock")) + evas_key_lock_on(e, "Num_Lock"); + else evas_key_lock_off(e, "Num_Lock"); + + if (evas_key_modifier_is_set(modifier, "Caps_Lock")) + evas_key_lock_on(e, "Caps_Lock"); + else evas_key_lock_off(e, "Caps_Lock"); + + if (evas_key_modifier_is_set(modifier, "Shift_Lock")) + evas_key_lock_on(e, "Shift_Lock"); + else evas_key_lock_off(e, "Shift_Lock"); +} + +static void +_ecore_evas_ews_cb_mouse_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + Evas_Event_Mouse_In *ev = event_info; + Evas_Coord x = ev->canvas.x; + Evas_Coord y = ev->canvas.y; + _ecore_evas_ews_coord_translate(ee, &x, &y); + if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); + _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); + evas_event_feed_mouse_in(ee->evas, ev->timestamp, NULL); + _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); +} + +static void +_ecore_evas_ews_cb_mouse_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + Evas_Event_Mouse_Out *ev = event_info; + Evas_Coord x = ev->canvas.x; + Evas_Coord y = ev->canvas.y; + // TODO: consider grab mode in EWS + _ecore_evas_ews_coord_translate(ee, &x, &y); + if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); + _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); + evas_event_feed_mouse_out(ee->evas, ev->timestamp, NULL); + if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); + _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); +} + +static void +_ecore_evas_ews_cb_mouse_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Mouse_Down *ev = event_info; + _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); + evas_event_feed_mouse_down(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); +} + +static void +_ecore_evas_ews_cb_mouse_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Mouse_Up *ev = event_info; + _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); + evas_event_feed_mouse_up(ee->evas, ev->button, ev->flags, ev->timestamp, NULL); +} + +static void +_ecore_evas_ews_cb_mouse_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Mouse_Move *ev = event_info; + Evas_Coord x = ev->cur.canvas.x; + Evas_Coord y = ev->cur.canvas.y; + _ecore_evas_ews_coord_translate(ee, &x, &y); + _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); + _ecore_evas_mouse_move_process(ee, x, y, ev->timestamp); +} + +static void +_ecore_evas_ews_cb_mouse_wheel(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Mouse_Wheel *ev = event_info; + _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); + evas_event_feed_mouse_wheel(ee->evas, ev->direction, ev->z, ev->timestamp, NULL); +} + +static void +_ecore_evas_ews_cb_multi_down(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Multi_Down *ev = event_info; + Evas_Coord x, y, xx, yy; + double xf, yf; + + x = ev->canvas.x; + y = ev->canvas.y; + xx = x; + yy = y; + _ecore_evas_ews_coord_translate(ee, &x, &y); + xf = (ev->canvas.xsub - (double)xx) + (double)x; + yf = (ev->canvas.ysub - (double)yy) + (double)y; + _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); + evas_event_feed_multi_down(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL); +} + +static void +_ecore_evas_ews_cb_multi_up(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Multi_Up *ev = event_info; + Evas_Coord x, y, xx, yy; + double xf, yf; + + x = ev->canvas.x; + y = ev->canvas.y; + xx = x; + yy = y; + _ecore_evas_ews_coord_translate(ee, &x, &y); + xf = (ev->canvas.xsub - (double)xx) + (double)x; + yf = (ev->canvas.ysub - (double)yy) + (double)y; + _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); + evas_event_feed_multi_up(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->flags, ev->timestamp, NULL); +} + +static void +_ecore_evas_ews_cb_multi_move(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Multi_Move *ev = event_info; + Evas_Coord x, y, xx, yy; + double xf, yf; + + x = ev->cur.canvas.x; + y = ev->cur.canvas.y; + xx = x; + yy = y; + _ecore_evas_ews_coord_translate(ee, &x, &y); + xf = (ev->cur.canvas.xsub - (double)xx) + (double)x; + yf = (ev->cur.canvas.ysub - (double)yy) + (double)y; + _ecore_evas_ews_modifiers_apply(ee, ev->modifiers); + evas_event_feed_multi_move(ee->evas, ev->device, x, y, ev->radius, ev->radius_x, ev->radius_y, ev->pressure, ev->angle, xf, yf, ev->timestamp, NULL); +} + +static void +_ecore_evas_ews_cb_free(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + if (ee->driver) _ecore_evas_free(ee); +} + +static void +_ecore_evas_ews_cb_key_down(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Key_Down *ev = event_info; + + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) + evas_key_modifier_on(ee->evas, "Shift"); + else + evas_key_modifier_off(ee->evas, "Shift"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) + evas_key_modifier_on(ee->evas, "Control"); + else + evas_key_modifier_off(ee->evas, "Control"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) + evas_key_modifier_on(ee->evas, "Alt"); + else + evas_key_modifier_off(ee->evas, "Alt"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) + evas_key_modifier_on(ee->evas, "Meta"); + else + evas_key_modifier_off(ee->evas, "Meta"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) + evas_key_modifier_on(ee->evas, "Hyper"); + else + evas_key_modifier_off(ee->evas, "Hyper"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) + evas_key_modifier_on(ee->evas, "Super"); + else + evas_key_modifier_off(ee->evas, "Super"); + if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) + evas_key_lock_on(ee->evas, "Scroll_Lock"); + else + evas_key_lock_off(ee->evas, "Scroll_Lock"); + if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) + evas_key_lock_on(ee->evas, "Num_Lock"); + else + evas_key_lock_off(ee->evas, "Num_Lock"); + if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) + evas_key_lock_on(ee->evas, "Caps_Lock"); + else + evas_key_lock_off(ee->evas, "Caps_Lock"); + evas_event_feed_key_down(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); +} + +static void +_ecore_evas_ews_cb_key_up(void *data, Evas *e, Evas_Object *obj __UNUSED__, void *event_info) +{ + Ecore_Evas *ee = data; + Evas_Event_Key_Up *ev = event_info; + + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Shift")) + evas_key_modifier_on(ee->evas, "Shift"); + else + evas_key_modifier_off(ee->evas, "Shift"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Control")) + evas_key_modifier_on(ee->evas, "Control"); + else + evas_key_modifier_off(ee->evas, "Control"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Alt")) + evas_key_modifier_on(ee->evas, "Alt"); + else + evas_key_modifier_off(ee->evas, "Alt"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Meta")) + evas_key_modifier_on(ee->evas, "Meta"); + else + evas_key_modifier_off(ee->evas, "Meta"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Hyper")) + evas_key_modifier_on(ee->evas, "Hyper"); + else + evas_key_modifier_off(ee->evas, "Hyper"); + if (evas_key_modifier_is_set(evas_key_modifier_get(e), "Super")) + evas_key_modifier_on(ee->evas, "Super"); + else + evas_key_modifier_off(ee->evas, "Super"); + if (evas_key_lock_is_set(evas_key_lock_get(e), "Scroll_Lock")) + evas_key_lock_on(ee->evas, "Scroll_Lock"); + else + evas_key_lock_off(ee->evas, "Scroll_Lock"); + if (evas_key_lock_is_set(evas_key_lock_get(e), "Num_Lock")) + evas_key_lock_on(ee->evas, "Num_Lock"); + else + evas_key_lock_off(ee->evas, "Num_Lock"); + if (evas_key_lock_is_set(evas_key_lock_get(e), "Caps_Lock")) + evas_key_lock_on(ee->evas, "Caps_Lock"); + else + evas_key_lock_off(ee->evas, "Caps_Lock"); + evas_event_feed_key_up(ee->evas, ev->keyname, ev->key, ev->string, ev->compose, ev->timestamp, NULL); +} + +static void +_ecore_evas_ews_cb_focus_in(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + ecore_evas_focus_set(ee, EINA_TRUE); +} + +static void +_ecore_evas_ews_cb_focus_out(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + if (ee->deleted) return; + ecore_evas_focus_set(ee, EINA_FALSE); +} + +static void +_ecore_evas_ews_cb_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + ecore_evas_show(ee); +} + +static void +_ecore_evas_ews_cb_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + if (ee->deleted) return; + ecore_evas_hide(ee); +} +#endif + +EAPI Ecore_Evas * +ecore_evas_ews_new(int x, int y, int w, int h) +{ +// basically a copy of ecore_evas_buffer_new() keep in sync... +#ifdef BUILD_ECORE_EVAS_EWS + Evas_Object *o; + Evas_Engine_Info_Buffer *einfo; + Ecore_Evas *ee; + int rmethod; + + if (_ecore_evas_ews_init() < 1) return NULL; + + if (!_ews_ee) _ews_ee = _ecore_evas_ews_ee_new(); + if (!_ews_ee) + { + ERR("Could not create EWS backing store"); + _ecore_evas_ews_shutdown(); + return NULL; + } + + rmethod = evas_render_method_lookup("buffer"); + if (!rmethod) return NULL; + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) return NULL; + + if (w < 1) w = 1; + if (h < 1) h = 1; + + o = evas_object_image_add(_ews_ee->evas); + evas_object_image_content_hint_set(o, EVAS_IMAGE_CONTENT_HINT_DYNAMIC); + evas_object_image_colorspace_set(o, EVAS_COLORSPACE_ARGB8888); + evas_object_image_size_set(o, w, h); + evas_object_image_alpha_set(o, 1); + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_ews_engine_func; + + ee->driver = EWS_ENGINE_NAME; + + ee->x = 0; + ee->y = 0; + ee->w = w; + ee->h = h; + ee->req.x = ee->x; + ee->req.y = ee->y; + ee->req.w = ee->w; + ee->req.h = ee->h; + + /* init evas here */ + ee->evas = evas_new(); + evas_data_attach_set(ee->evas, ee); + evas_output_method_set(ee->evas, rmethod); + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + + evas_object_move(o, x, y); + evas_object_resize(o, w, h); + evas_object_image_fill_set(o, 0, 0, w, h); + + ee->engine.ews.image = o; + evas_object_data_set(ee->engine.ews.image, "Ecore_Evas", ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_MOUSE_IN, + _ecore_evas_ews_cb_mouse_in, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_MOUSE_OUT, + _ecore_evas_ews_cb_mouse_out, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_MOUSE_DOWN, + _ecore_evas_ews_cb_mouse_down, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_MOUSE_UP, + _ecore_evas_ews_cb_mouse_up, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_MOUSE_MOVE, + _ecore_evas_ews_cb_mouse_move, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_MOUSE_WHEEL, + _ecore_evas_ews_cb_mouse_wheel, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_MULTI_DOWN, + _ecore_evas_ews_cb_multi_down, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_MULTI_UP, + _ecore_evas_ews_cb_multi_up, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_MULTI_MOVE, + _ecore_evas_ews_cb_multi_move, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_FREE, + _ecore_evas_ews_cb_free, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_KEY_DOWN, + _ecore_evas_ews_cb_key_down, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_KEY_UP, + _ecore_evas_ews_cb_key_up, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_FOCUS_IN, + _ecore_evas_ews_cb_focus_in, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_FOCUS_OUT, + _ecore_evas_ews_cb_focus_out, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_SHOW, + _ecore_evas_ews_cb_show, ee); + evas_object_event_callback_add(ee->engine.ews.image, + EVAS_CALLBACK_HIDE, + _ecore_evas_ews_cb_hide, ee); + einfo = (Evas_Engine_Info_Buffer *)evas_engine_info_get(ee->evas); + if (einfo) + { + void *pixels = evas_object_image_data_get(o, 1); + evas_object_image_data_set(o, pixels); // refcount + einfo->info.depth_type = EVAS_ENGINE_BUFFER_DEPTH_ARGB32; + einfo->info.dest_buffer = pixels; + einfo->info.dest_buffer_row_bytes = evas_object_image_stride_get(o); + einfo->info.use_color_key = 0; + einfo->info.alpha_threshold = 0; + einfo->info.func.new_update_region = NULL; + einfo->info.func.free_update_region = NULL; + evas_object_image_data_set(o, pixels); + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + } + else + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + evas_key_modifier_add(ee->evas, "Shift"); + evas_key_modifier_add(ee->evas, "Control"); + evas_key_modifier_add(ee->evas, "Alt"); + evas_key_modifier_add(ee->evas, "Meta"); + evas_key_modifier_add(ee->evas, "Hyper"); + evas_key_modifier_add(ee->evas, "Super"); + evas_key_lock_add(ee->evas, "Caps_Lock"); + evas_key_lock_add(ee->evas, "Num_Lock"); + evas_key_lock_add(ee->evas, "Scroll_Lock"); + + _ews_ee->sub_ecore_evas = eina_list_append(_ews_ee->sub_ecore_evas, ee); + _ews_children = eina_list_append(_ews_children, ee); + + _ecore_evas_ews_event(ee, ECORE_EVAS_EWS_EVENT_ADD); + + return ee; +#else + return NULL; + (void)x; + (void)y; + (void)w; + (void)h; +#endif +} + +EAPI Evas_Object * +ecore_evas_ews_backing_store_get(const Ecore_Evas *ee) +{ +#ifdef BUILD_ECORE_EVAS_EWS + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_ews_backing_store_get"); + return NULL; + } + return ee->engine.ews.image; +#else + return NULL; + (void)ee; +#endif +} + +EAPI void +ecore_evas_ews_delete_request(Ecore_Evas *ee) +{ +#ifdef BUILD_ECORE_EVAS_EWS + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_ews_delete_request"); + return; + } + if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); + else ecore_evas_free(ee); +#else + (void)ee; +#endif +} + + +EAPI Eina_Bool +ecore_evas_ews_engine_set(const char *engine, const char *options) +{ +#ifdef BUILD_ECORE_EVAS_EWS + if (_ews_ee) return EINA_FALSE; + + free(_ews_engine); + free(_ews_options); + + _ews_engine = engine ? strdup(engine) : NULL; + _ews_options = options ? strdup(options) : NULL; + + if ((engine) && (!_ews_engine)) return EINA_FALSE; + if ((options) && (!_ews_options)) return EINA_FALSE; + + _ews_defaults_engine = EINA_FALSE; + return EINA_TRUE; +#else + return EINA_FALSE; + (void)engine; + (void)options; +#endif +} + +EAPI Eina_Bool +ecore_evas_ews_setup(int x, int y, int w, int h) +{ +#ifdef BUILD_ECORE_EVAS_EWS + Eina_Bool ret = EINA_TRUE; + + _ews_defaults_geo = EINA_FALSE; + _ews_x = x; + _ews_y = y; + _ews_w = w; + _ews_h = h; + + if (!_ews_ee) return EINA_TRUE; + + /* move-resize is not as implemented as move + resize */ + ecore_evas_move(_ews_ee, x, y); + ecore_evas_size_min_set(_ews_ee, w, h); + ecore_evas_size_max_set(_ews_ee, w, h); + ecore_evas_resize(_ews_ee, w, h); + + ecore_evas_geometry_get(_ews_ee, &x, &y, &w, &h); + +#define TST(n) if ((n != _ews_##n)) \ + { \ + WRN("Asked %d, got %d for "#n, _ews_##n, n); \ + ret = EINA_FALSE; \ + } + TST(x); + TST(y); + TST(w); + TST(h); +#undef TST + return ret; +#else + return EINA_FALSE; + (void)x; + (void)y; + (void)w; + (void)h; +#endif +} + +EAPI Ecore_Evas * +ecore_evas_ews_ecore_evas_get(void) +{ +#ifdef BUILD_ECORE_EVAS_EWS + if (!_ews_ee) _ews_ee = _ecore_evas_ews_ee_new(); + return _ews_ee; +#else + return NULL; +#endif +} + +EAPI Evas * +ecore_evas_ews_evas_get(void) +{ +#ifdef BUILD_ECORE_EVAS_EWS + return ecore_evas_get(ecore_evas_ews_ecore_evas_get()); +#else + return NULL; +#endif +} + +EAPI Evas_Object * +ecore_evas_ews_background_get(void) +{ +#ifdef BUILD_ECORE_EVAS_EWS + return _ews_bg; +#else + return NULL; +#endif +} + +#ifdef BUILD_ECORE_EVAS_EWS +static void +_ecore_evas_ews_background_free(void *data __UNUSED__, Evas *e __UNUSED__, Evas_Object *o __UNUSED__, void *event_info __UNUSED__) +{ + _ews_bg = NULL; + ecore_evas_ews_background_set(NULL); +} +#endif + +EAPI void +ecore_evas_ews_background_set(Evas_Object *o) +{ +#ifdef BUILD_ECORE_EVAS_EWS + if ((o) && (o == _ews_bg)) return; + + if (_ews_bg) + { + evas_object_del(_ews_bg); + _ews_bg = NULL; + } + + if ((!o) && (_ews_ee)) + { + o = evas_object_rectangle_add(ecore_evas_get(_ews_ee)); + evas_object_color_set(o, 0, 0, 0, 255); + } + + if (_ews_ee) + { + Evas_Coord w, h; + Evas *e = ecore_evas_get(_ews_ee); + + if (e != evas_object_evas_get(o)) + { + ERR("background not in ecore_evas_ews_evas_get() canvas!"); + return; + } + + evas_output_viewport_get(e, NULL, NULL, &w, &h); + evas_object_move(o, 0, 0); + evas_object_resize(o, w, h); + evas_object_layer_set(o, EVAS_LAYER_MIN); + evas_object_lower(o); + evas_object_show(o); + + evas_object_event_callback_add + (o, EVAS_CALLBACK_FREE, _ecore_evas_ews_background_free, NULL); + } + + _ews_bg = o; +#else + return; + (void)o; +#endif +} + + +EAPI const Eina_List * +ecore_evas_ews_children_get(void) +{ +#ifdef BUILD_ECORE_EVAS_EWS + return _ews_children; +#else + return NULL; +#endif +} + +EAPI void +ecore_evas_ews_manager_set(const void *manager) +{ +#ifdef BUILD_ECORE_EVAS_EWS + if (_ews_manager == manager) return; + _ews_manager = manager; + ecore_event_add(ECORE_EVAS_EWS_EVENT_MANAGER_CHANGE, NULL, NULL, NULL); +#else + (void)manager; +#endif +} + +EAPI const void * +ecore_evas_ews_manager_get(void) +{ +#ifdef BUILD_ECORE_EVAS_EWS + return _ews_manager; +#else + return NULL; +#endif +} diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c new file mode 100644 index 0000000..3ee913e --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_fb.c @@ -0,0 +1,659 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include +#include "ecore_private.h" +#ifdef BUILD_ECORE_EVAS_FB +#include +#include +#endif + +#include "ecore_evas_private.h" +#include "Ecore_Evas.h" + +#ifdef BUILD_ECORE_EVAS_FB +static int _ecore_evas_init_count = 0; + +static char *ecore_evas_default_display = "0"; +static Eina_List *ecore_evas_input_devices = NULL; +static Ecore_Event_Handler *ecore_evas_event_handlers[4] = {NULL, NULL, NULL, NULL}; + +static void +_ecore_evas_mouse_move_process_fb(Ecore_Evas *ee, int x, int y) +{ + int fbw, fbh; + + ee->mouse.x = x; + ee->mouse.y = y; + ecore_fb_size_get(&fbw, &fbh); + if (ee->prop.cursor.object) + { + evas_object_show(ee->prop.cursor.object); + if (ee->rotation == 0) + evas_object_move(ee->prop.cursor.object, + x - ee->prop.cursor.hot.x, + y - ee->prop.cursor.hot.y); + else if (ee->rotation == 90) + evas_object_move(ee->prop.cursor.object, + (fbh - ee->h) + ee->h - y - 1 - ee->prop.cursor.hot.x, + x - ee->prop.cursor.hot.y); + else if (ee->rotation == 180) + evas_object_move(ee->prop.cursor.object, + (fbw - ee->w) + ee->w - x - 1 - ee->prop.cursor.hot.x, + (fbh - ee->h) + ee->h - y - 1 - ee->prop.cursor.hot.y); + else if (ee->rotation == 270) + evas_object_move(ee->prop.cursor.object, + y - ee->prop.cursor.hot.x, + (fbw - ee->w) + ee->w - x - 1 - ee->prop.cursor.hot.y); + } +} + +static Ecore_Evas *fb_ee = NULL; + +static Ecore_Evas * +_ecore_evas_fb_match(void) +{ + return fb_ee; +} + +static void +_ecore_evas_fb_lose(void *data __UNUSED__) +{ + Eina_List *ll; + Ecore_Fb_Input_Device *dev; + + if (fb_ee) fb_ee->visible = 0; + + EINA_LIST_FOREACH(ecore_evas_input_devices, ll, dev) + ecore_fb_input_device_listen(dev, 0); +} + +static void +_ecore_evas_fb_gain(void *data __UNUSED__) +{ + Ecore_Evas *ee; + Eina_List *ll; + Ecore_Fb_Input_Device *dev; + + if (fb_ee) + { + ee = fb_ee; + + ee->visible = 1; + if ((ee->rotation == 90) || (ee->rotation == 270)) + evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); + else + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } + + EINA_LIST_FOREACH(ecore_evas_input_devices, ll, dev) + ecore_fb_input_device_listen(dev, 1); +} + +static Eina_Bool +_ecore_evas_event_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Event_Mouse_Button *e; + + e = event; + ee = _ecore_evas_fb_match(); + if (!ee) return ECORE_CALLBACK_PASS_ON; + _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_event_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Event_Mouse_Button *e; + + e = event; + ee = _ecore_evas_fb_match(); + if (!ee) return ECORE_CALLBACK_PASS_ON; + _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_event_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Event_Mouse_Move *e; + + e = event; + ee = _ecore_evas_fb_match(); + if (!ee) return ECORE_CALLBACK_PASS_ON; + _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_event_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Event_Mouse_Wheel *e; + + e = event; + ee = _ecore_evas_fb_match(); + if (!ee) return ECORE_CALLBACK_PASS_ON; + _ecore_evas_mouse_move_process_fb(ee, e->x, e->y); + return ECORE_CALLBACK_PASS_ON; +} + +static int +_ecore_evas_fb_render(Ecore_Evas *ee) +{ + int rend = 0; + + if (ee->visible) + { + Eina_List *updates; + + Eina_List *ll; + Ecore_Evas *ee2; + if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); + + EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) + { + if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); + if (ee2->engine.func->fn_render) + rend |= ee2->engine.func->fn_render(ee2); + if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); + } + + updates = evas_render_updates(ee->evas); + if (updates) + { + evas_render_updates_free(updates); + _ecore_evas_idle_timeout_update(ee); + rend = 1; + } + if (ee->func.fn_post_render) ee->func.fn_post_render(ee); + } + else + evas_norender(ee->evas); + return rend; +} + +static int +_ecore_evas_fb_init(Ecore_Evas *ee, int w, int h) +{ + Ecore_Fb_Input_Device *device; + Ecore_Fb_Input_Device_Cap caps; + int mouse_handled = 0; + + DIR *input_dir; + struct dirent *input_entry; + + _ecore_evas_init_count++; + if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; + + ecore_event_evas_init(); + + /* register all input devices */ + input_dir = opendir("/dev/input/"); + if (!input_dir) return _ecore_evas_init_count; + + while ((input_entry = readdir(input_dir))) + { + char device_path[256]; + + if (strncmp(input_entry->d_name, "event", 5) != 0) + continue; + + snprintf(device_path, 256, "/dev/input/%s", input_entry->d_name); + if (!(device = ecore_fb_input_device_open(device_path))) + continue; + ecore_fb_input_device_window_set(device, ee); + + caps = ecore_fb_input_device_cap_get(device); + + /* Mouse */ +#ifdef HAVE_TSLIB + if (caps & ECORE_FB_INPUT_DEVICE_CAP_RELATIVE) +#else + if ((caps & ECORE_FB_INPUT_DEVICE_CAP_RELATIVE) || (caps & ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE)) +#endif + { + ecore_fb_input_device_axis_size_set(device, w, h); + ecore_fb_input_device_listen(device,1); + ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device); + if (!mouse_handled) + { + ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL); + ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL); + ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL); + ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, _ecore_evas_event_mouse_wheel, NULL); + mouse_handled = 1; + } + } + /* Keyboard */ + else if ((caps & ECORE_FB_INPUT_DEVICE_CAP_KEYS_OR_BUTTONS) && !(caps & ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE)) + { + ecore_fb_input_device_listen(device,1); + ecore_evas_input_devices = eina_list_append(ecore_evas_input_devices, device); + } + } + closedir(input_dir); + + if (!mouse_handled) + { + if (ecore_fb_ts_init()) + { + ecore_fb_ts_event_window_set(ee); + ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, _ecore_evas_event_mouse_button_down, NULL); + ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, _ecore_evas_event_mouse_button_up, NULL); + ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, _ecore_evas_event_mouse_move, NULL); + mouse_handled = 1; + } + } + return _ecore_evas_init_count; +} + +static void +_ecore_evas_fb_free(Ecore_Evas *ee) +{ + ecore_evas_input_event_unregister(ee); + if (fb_ee == ee) fb_ee = NULL; + _ecore_evas_fb_shutdown(); + ecore_fb_shutdown(); +} + +static void +_ecore_evas_resize(Ecore_Evas *ee, int w, int h) +{ + ee->req.w = w; + ee->req.h = h; + if ((w == ee->w) && (h == ee->h)) return; + ee->w = w; + ee->h = h; + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); + } + else + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } + if (ee->func.fn_resize) ee->func.fn_resize(ee); +} + +static void +_ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) +{ + ee->req.w = w; + ee->req.h = h; + if ((w == ee->w) && (h == ee->h)) return; + ee->w = w; + ee->h = h; + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); + } + else + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } + if (ee->func.fn_resize) ee->func.fn_resize(ee); +} + +static void +_ecore_evas_rotation_set(Ecore_Evas *ee, int rotation, int resize __UNUSED__) +{ + Evas_Engine_Info_FB *einfo; + int rot_dif; + + if (ee->rotation == rotation) return; + einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(ee->evas); + if (!einfo) return; + rot_dif = ee->rotation - rotation; + if (rot_dif < 0) rot_dif = -rot_dif; + if (rot_dif != 180) + { + + einfo->info.rotation = rotation; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + if (!ee->prop.fullscreen) + { + int tmp; + + tmp = ee->w; + ee->w = ee->h; + ee->h = tmp; + ee->req.w = ee->w; + ee->req.h = ee->h; + } + else + { + if ((rotation == 0) || (rotation == 180)) + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } + else + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + } + } + ee->rotation = rotation; + } + else + { + einfo->info.rotation = rotation; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + ee->rotation = rotation; + } + if ((ee->rotation == 90) || (ee->rotation == 270)) + evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); + else + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + _ecore_evas_mouse_move_process_fb(ee, ee->mouse.x, ee->mouse.y); + if (ee->func.fn_resize) ee->func.fn_resize(ee); +} + +static void +_ecore_evas_show(Ecore_Evas *ee) +{ + if (ee->prop.focused) return; + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); +} + +static void +_ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + + ee = data; + if (ee) + ee->prop.cursor.object = NULL; +} + +static void +_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +{ + int x, y; + + if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); + + if (!obj) + { + ee->prop.cursor.object = NULL; + ee->prop.cursor.layer = 0; + ee->prop.cursor.hot.x = 0; + ee->prop.cursor.hot.y = 0; + return; + } + + ee->prop.cursor.object = obj; + ee->prop.cursor.layer = layer; + ee->prop.cursor.hot.x = hot_x; + ee->prop.cursor.hot.y = hot_y; + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_move(ee->prop.cursor.object, + x - ee->prop.cursor.hot.x, + y - ee->prop.cursor.hot.y); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); +} + +static void +_ecore_evas_fullscreen_set(Ecore_Evas *ee, int on) +{ + Eina_List *l; + Ecore_Fb_Input_Device *dev; + int resized = 0; + + if (((ee->prop.fullscreen) && (on)) || + ((!ee->prop.fullscreen) && (!on))) return; + if (on) + { + int w, h; + + ee->engine.fb.real_w = ee->w; + ee->engine.fb.real_h = ee->h; + w = ee->w; + h = ee->h; + ecore_fb_size_get(&w, &h); + if ((w == 0) && (h == 0)) + { + w = ee->w; + h = ee->h; + } + if ((w != ee->w) || (h != ee->h)) resized = 1; + ee->w = w; + ee->h = h; + ee->req.w = ee->w; + ee->req.h = ee->h; + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } + else + { + if ((ee->engine.fb.real_w != ee->w) || (ee->engine.fb.real_h != ee->h)) resized = 1; + ee->w = ee->engine.fb.real_w; + ee->h = ee->engine.fb.real_h; + ee->req.w = ee->w; + ee->req.h = ee->h; + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } + ee->prop.fullscreen = on; + EINA_LIST_FOREACH(ecore_evas_input_devices, l, dev) + ecore_fb_input_device_axis_size_set(dev, ee->w, ee->h); + /* rescale the input device area */ + if (resized) + { + if (ee->func.fn_resize) ee->func.fn_resize(ee); + } +} + +int +_ecore_evas_fb_shutdown(void) +{ + _ecore_evas_init_count--; + if (_ecore_evas_init_count == 0) + { + int i; + + for (i = 0; i < 4; i++) + { + if (ecore_evas_event_handlers[i]) + ecore_event_handler_del(ecore_evas_event_handlers[i]); + } + ecore_fb_ts_shutdown(); + ecore_event_evas_shutdown(); + } + if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; + return _ecore_evas_init_count; +} + +static Ecore_Evas_Engine_Func _ecore_fb_engine_func = +{ + _ecore_evas_fb_free, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_resize, + _ecore_evas_move_resize, + _ecore_evas_rotation_set, + NULL, + _ecore_evas_show, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_object_cursor_set, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_fullscreen_set, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, //transparent + + NULL, // render + NULL // screen_geometry_get +}; +#endif + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#ifdef BUILD_ECORE_EVAS_FB +EAPI Ecore_Evas * +ecore_evas_fb_new(const char *disp_name, int rotation, int w, int h) +{ + Evas_Engine_Info_FB *einfo; + Ecore_Evas *ee; + + int rmethod; + + if (!disp_name) + disp_name = ecore_evas_default_display; + + rmethod = evas_render_method_lookup("fb"); + if (!rmethod) return NULL; + + if (!ecore_fb_init(disp_name)) return NULL; + ecore_fb_callback_gain_set(_ecore_evas_fb_gain, NULL); + ecore_fb_callback_lose_set(_ecore_evas_fb_lose, NULL); + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) return NULL; + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + _ecore_evas_fb_init(ee, w, h); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_fb_engine_func; + + ee->driver = "fb"; + if (disp_name) ee->name = strdup(disp_name); + + if (w < 1) w = 1; + if (h < 1) h = 1; + ee->rotation = rotation; + ee->visible = 1; + ee->w = w; + ee->h = h; + ee->req.w = ee->w; + ee->req.h = ee->h; + + ee->prop.max.w = 0; + ee->prop.max.h = 0; + ee->prop.layer = 0; + ee->prop.focused = 1; + ee->prop.borderless = 1; + ee->prop.override = 1; + ee->prop.maximized = 1; + ee->prop.fullscreen = 0; + ee->prop.withdrawn = 0; + ee->prop.sticky = 0; + + /* init evas here */ + ee->evas = evas_new(); + evas_data_attach_set(ee->evas, ee); + evas_output_method_set(ee->evas, rmethod); + + if ((rotation == 90) || (rotation == 270)) + { + evas_output_size_set(ee->evas, h, w); + evas_output_viewport_set(ee->evas, 0, 0, h, w); + } + else + { + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + } + + einfo = (Evas_Engine_Info_FB *)evas_engine_info_get(ee->evas); + if (einfo) + { + einfo->info.virtual_terminal = 0; + einfo->info.device_number = strtol(disp_name, NULL, 10); + einfo->info.refresh = 0; + einfo->info.rotation = ee->rotation; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + + ecore_evas_input_event_register(ee); + + ee->engine.func->fn_render = _ecore_evas_fb_render; + _ecore_evas_register(ee); + fb_ee = ee; + evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); + return ee; +} +#else +EAPI Ecore_Evas * +ecore_evas_fb_new(const char *disp_name __UNUSED__, int rotation __UNUSED__, int w __UNUSED__, int h __UNUSED__) +{ + return NULL; +} +#endif diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h b/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h new file mode 100644 index 0000000..2c20761 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_private.h @@ -0,0 +1,433 @@ +#ifndef _ECORE_EVAS_PRIVATE_H +#define _ECORE_EVAS_PRIVATE_H + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#ifdef HAVE_SYS_MMAN_H +# include +#endif + +#include +#include +#include +#include +#include + +#define ECORE_MAGIC_EVAS 0x76543211 + +#ifdef BUILD_ECORE_EVAS_X11 +# include +# include +# ifdef HAVE_ECORE_X_XCB +# include +# endif +# ifdef HAVE_ECORE_X_XLIB +# include +# include +# endif +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 +# include +#endif + +#ifdef BUILD_ECORE_EVAS_OPENGL_X11 +# include +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_8_X11 +# include +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_X11 +# include +#endif + +#ifdef BUILD_ECORE_EVAS_FB +# include +#endif + +#ifdef BUILD_ECORE_EVAS_DIRECTFB +# include +# include "Ecore_DirectFB.h" +#endif + +#if defined(BUILD_ECORE_EVAS_SOFTWARE_BUFFER) || defined(BUILD_ECORE_EVAS_EWS) +# include +#endif + +#ifdef BUILD_ECORE_EVAS_WIN32 +# include "Ecore_Win32.h" +# ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI +# include +# endif +# ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW +# include +# endif +# ifdef BUILD_ECORE_EVAS_DIRECT3D +# include +# endif +# ifdef BUILD_ECORE_EVAS_OPENGL_GLEW +# include +# endif +# ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW +# include +# endif +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE +# include "Ecore_WinCE.h" +# include +#endif + +#ifdef BUILD_ECORE_EVAS_GL_COCOA +# include "Ecore_Cocoa.h" +# include +#endif + +/** + Log domain macros and variable + **/ + +extern int _ecore_evas_log_dom; + +#ifdef ECORE_EVAS_DEFAULT_LOG_COLOR +# undef ECORE_EVAS_DEFAULT_LOG_COLOR +#endif +#define ECORE_EVAS_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_ecore_evas_log_dom, __VA_ARGS__) +#ifdef DBG +# undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_ecore_evas_log_dom, __VA_ARGS__) +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_ecore_evas_log_dom, __VA_ARGS__) +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_ecore_evas_log_dom, __VA_ARGS__) +#ifdef CRIT +# undef CRIT +#endif +#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_evas_log_dom, __VA_ARGS__) + + +#define IDLE_FLUSH_TIME 0.5 +#ifndef _ECORE_EVAS_H +typedef struct _Ecore_Evas Ecore_Evas; +#endif + +typedef struct _Ecore_Evas_Engine Ecore_Evas_Engine; +typedef struct _Ecore_Evas_Engine_Func Ecore_Evas_Engine_Func; + +struct _Ecore_Evas_Engine_Func +{ + void (*fn_free) (Ecore_Evas *ee); + void (*fn_callback_resize_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_callback_move_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_callback_show_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_callback_hide_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_callback_delete_request_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_callback_destroy_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_callback_focus_in_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_callback_focus_out_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_callback_mouse_in_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_callback_mouse_out_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_callback_sticky_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_callback_unsticky_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_callback_pre_render_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_callback_post_render_set) (Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)); + void (*fn_move) (Ecore_Evas *ee, int x, int y); + void (*fn_managed_move) (Ecore_Evas *ee, int x, int y); + void (*fn_resize) (Ecore_Evas *ee, int w, int h); + void (*fn_move_resize) (Ecore_Evas *ee, int x, int y, int w, int h); + void (*fn_rotation_set) (Ecore_Evas *ee, int rot, int resize); + void (*fn_shaped_set) (Ecore_Evas *ee, int shaped); + void (*fn_show) (Ecore_Evas *ee); + void (*fn_hide) (Ecore_Evas *ee); + void (*fn_raise) (Ecore_Evas *ee); + void (*fn_lower) (Ecore_Evas *ee); + void (*fn_activate) (Ecore_Evas *ee); + void (*fn_title_set) (Ecore_Evas *ee, const char *t); + void (*fn_name_class_set) (Ecore_Evas *ee, const char *n, const char *c); + void (*fn_size_min_set) (Ecore_Evas *ee, int w, int h); + void (*fn_size_max_set) (Ecore_Evas *ee, int w, int h); + void (*fn_size_base_set) (Ecore_Evas *ee, int w, int h); + void (*fn_size_step_set) (Ecore_Evas *ee, int w, int h); + void (*fn_object_cursor_set) (Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y); + void (*fn_layer_set) (Ecore_Evas *ee, int layer); + void (*fn_focus_set) (Ecore_Evas *ee, int on); + void (*fn_iconified_set) (Ecore_Evas *ee, int on); + void (*fn_borderless_set) (Ecore_Evas *ee, int on); + void (*fn_override_set) (Ecore_Evas *ee, int on); + void (*fn_maximized_set) (Ecore_Evas *ee, int on); + void (*fn_fullscreen_set) (Ecore_Evas *ee, int on); + void (*fn_avoid_damage_set) (Ecore_Evas *ee, int on); + void (*fn_withdrawn_set) (Ecore_Evas *ee, int withdrawn); + void (*fn_sticky_set) (Ecore_Evas *ee, int sticky); + void (*fn_ignore_events_set) (Ecore_Evas *ee, int ignore); + void (*fn_alpha_set) (Ecore_Evas *ee, int alpha); + void (*fn_transparent_set) (Ecore_Evas *ee, int transparent); + + int (*fn_render) (Ecore_Evas *ee); + void (*fn_screen_geometry_get) (const Ecore_Evas *ee, int *x, int *y, int *w, int *h); +}; + +struct _Ecore_Evas_Engine +{ + Ecore_Evas_Engine_Func *func; + +/* TODO: UGLY! This should be an union or inheritance! */ +#ifdef BUILD_ECORE_EVAS_X11 + struct + { + Ecore_X_Window win_root; + Eina_List *win_extra; + Ecore_X_Pixmap pmap; + Ecore_X_Pixmap mask; + Ecore_X_GC gc; + Ecore_X_XRegion *damages; + Ecore_X_Sync_Counter sync_counter; + Ecore_X_Window leader; + Ecore_X_Sync_Counter netwm_sync_counter; + int netwm_sync_val_hi; + unsigned int netwm_sync_val_lo; + int sync_val; // bigger! this will screw up at 2 billion frames (414 days of continual rendering @ 60fps) + int screen_num; + int px, py, pw, ph; + unsigned char direct_resize : 1; + unsigned char using_bg_pixmap : 1; + unsigned char managed : 1; + unsigned char sync_began : 1; + unsigned char sync_cancel : 1; + unsigned char netwm_sync_set : 1; + unsigned char configure_coming : 1; + struct { + unsigned char modal : 1; + unsigned char sticky : 1; + unsigned char maximized_v : 1; + unsigned char maximized_h : 1; + unsigned char shaded : 1; + unsigned char skip_taskbar : 1; + unsigned char skip_pager : 1; + unsigned char fullscreen : 1; + unsigned char above : 1; + unsigned char below : 1; + } state; + Ecore_X_Window win_shaped_input; + } x; +#endif +#ifdef BUILD_ECORE_EVAS_FB + struct { + int real_w; + int real_h; + } fb; +#endif +#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER + struct { + void *pixels; + Evas_Object *image; + void (*free_func) (void *data, void *pix); + void *(*alloc_func) (void *data, int size); + void *data; + } buffer; +#endif +#ifdef BUILD_ECORE_EVAS_DIRECTFB + struct { + Ecore_DirectFB_Window *window; + } directfb; +#endif +#ifdef BUILD_ECORE_EVAS_WIN32 + struct { + Ecore_Win32_Window *parent; + struct { + unsigned char region : 1; + unsigned char fullscreen : 1; + } state; + } win32; +#endif +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE + struct { + Ecore_WinCE_Window *window; + struct { + unsigned char fullscreen : 1; + } state; + } wince; +#endif +#ifdef BUILD_ECORE_EVAS_EWS + struct { + Evas_Object *image; + } ews; +#endif + + Ecore_Timer *idle_flush_timer; +}; + +struct _Ecore_Evas +{ + EINA_INLIST; + ECORE_MAGIC; + Evas *evas; + const char *driver; + char *name; + int x, y, w, h; + short rotation; + Eina_Bool shaped : 1; + Eina_Bool visible : 1; + Eina_Bool draw_ok : 1; + Eina_Bool should_be_visible : 1; + Eina_Bool alpha : 1; + Eina_Bool transparent : 1; + + Eina_Hash *data; + + struct { + int x, y, w, h; + } req; + + struct { + int x, y; + } mouse; + + struct { + int w, h; + } expecting_resize; + + struct { + char *title; + char *name; + char *clas; + struct { + int w, h; + } min, + max, + base, + step; + struct { + Evas_Object *object; + int layer; + struct { + int x, y; + } hot; + } cursor; + int layer; + Ecore_Window window; + unsigned char avoid_damage; + char focused : 1; + char iconified : 1; + char borderless : 1; + char override : 1; + char maximized : 1; + char fullscreen : 1; + char withdrawn : 1; + char sticky : 1; + char request_pos : 1; + } prop; + + struct { + void (*fn_resize) (Ecore_Evas *ee); + void (*fn_move) (Ecore_Evas *ee); + void (*fn_show) (Ecore_Evas *ee); + void (*fn_hide) (Ecore_Evas *ee); + void (*fn_delete_request) (Ecore_Evas *ee); + void (*fn_destroy) (Ecore_Evas *ee); + void (*fn_focus_in) (Ecore_Evas *ee); + void (*fn_focus_out) (Ecore_Evas *ee); + void (*fn_sticky) (Ecore_Evas *ee); + void (*fn_unsticky) (Ecore_Evas *ee); + void (*fn_mouse_in) (Ecore_Evas *ee); + void (*fn_mouse_out) (Ecore_Evas *ee); + void (*fn_pre_render) (Ecore_Evas *ee); + void (*fn_post_render) (Ecore_Evas *ee); + void (*fn_pre_free) (Ecore_Evas *ee); + } func; + + Ecore_Evas_Engine engine; + Eina_List *sub_ecore_evas; + + int refcount; + + unsigned char ignore_events : 1; + unsigned char manual_render : 1; + unsigned char registered : 1; + unsigned char no_comp_sync : 1; + unsigned char semi_sync : 1; + unsigned char deleted : 1; +}; + +void _ecore_evas_ref(Ecore_Evas *ee); +void _ecore_evas_unref(Ecore_Evas *ee); + +#ifdef BUILD_ECORE_EVAS_X11 +int _ecore_evas_x_shutdown(void); +#endif +#ifdef BUILD_ECORE_EVAS_FB +int _ecore_evas_fb_shutdown(void); +#endif +#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER +int _ecore_evas_buffer_shutdown(void); +int _ecore_evas_buffer_render(Ecore_Evas *ee); +#endif +#ifdef BUILD_ECORE_EVAS_DIRECTFB +int _ecore_evas_directfb_shutdown(void); +#endif +#ifdef BUILD_ECORE_EVAS_WIN32 +int _ecore_evas_win32_shutdown(void); +#endif +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE +int _ecore_evas_wince_shutdown(void); +#endif +#ifdef BUILD_ECORE_EVAS_EWS +void _ecore_evas_ews_events_init(void); +int _ecore_evas_ews_shutdown(void); +#endif + +void _ecore_evas_fps_debug_init(void); +void _ecore_evas_fps_debug_shutdown(void); +void _ecore_evas_fps_debug_rendertime_add(double t); +void _ecore_evas_register(Ecore_Evas *ee); +void _ecore_evas_free(Ecore_Evas *ee); +void _ecore_evas_idle_timeout_update(Ecore_Evas *ee); +void _ecore_evas_mouse_move_process(Ecore_Evas *ee, int x, int y, unsigned int timestamp); +void _ecore_evas_mouse_multi_move_process(Ecore_Evas *ee, int device, + int x, int y, + double radius, + double radius_x, double radius_y, + double pressure, + double angle, + double mx, double my, + unsigned int timestamp); +void _ecore_evas_mouse_multi_down_process(Ecore_Evas *ee, int device, + int x, int y, + double radius, + double radius_x, double radius_y, + double pressure, + double angle, + double mx, double my, + Evas_Button_Flags flags, + unsigned int timestamp); +void _ecore_evas_mouse_multi_up_process(Ecore_Evas *ee, int device, + int x, int y, + double radius, + double radius_x, double radius_y, + double pressure, + double angle, + double mx, double my, + Evas_Button_Flags flags, + unsigned int timestamp); + +extern Eina_Bool _ecore_evas_app_comp_sync; + +#endif diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c new file mode 100644 index 0000000..0849c79 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_psl1ght.c @@ -0,0 +1,476 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#include "ecore_evas_private.h" +#include "Ecore_Evas.h" + +#ifdef BUILD_ECORE_EVAS_PSL1GHT +#include +#include + +static int _ecore_evas_init_count = 0; + +static Ecore_Evas *psl1ght_ee = NULL; +static Ecore_Event_Handler *ecore_evas_event_handlers[4] = { + NULL, NULL, NULL, NULL +}; + +static const char *ecore_evas_psl1ght_default = "EFL PSL1GHT"; +static int _ecore_evas_fps_debug = 0; +static Ecore_Poller *ecore_evas_event; + +static unsigned int +_ecore_evas_time_get() +{ + return (unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff; +} + +static Ecore_Evas * +_ecore_evas_psl1ght_match(void) +{ + return psl1ght_ee; +} + +static Eina_Bool +_ecore_evas_psl1ght_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) +{ + Ecore_Evas *ee; + + ee = _ecore_evas_psl1ght_match(); + + if (!ee) return ECORE_CALLBACK_PASS_ON; + /* pass on event */ + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); + + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_psl1ght_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) +{ + Ecore_Evas *ee; + + ee = _ecore_evas_psl1ght_match(); + + if (!ee) return ECORE_CALLBACK_PASS_ON; + /* pass on event */ + evas_focus_out(ee->evas); + ee->prop.focused = 0; + if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); + + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_psl1ght_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) +{ + Ecore_Evas *ee; + int w; + int h; + + ee = _ecore_evas_psl1ght_match(); + + if (!ee) return ECORE_CALLBACK_PASS_ON; + evas_output_size_get(ee->evas, &w, &h); + evas_damage_rectangle_add(ee->evas, 0, 0, w, h); + + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_psl1ght_event_key_modifiers(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Psl1ght_Event_Key_Modifiers *e = event; + + ee = _ecore_evas_psl1ght_match(); + + if (!ee) return ECORE_CALLBACK_PASS_ON; + ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); + + return ECORE_CALLBACK_PASS_ON; +} + +static int +_ecore_evas_render(Ecore_Evas *ee) +{ + Eina_List *updates; + + updates = evas_render_updates(ee->evas); + if (updates) + { + evas_render_updates_free(updates); + _ecore_evas_idle_timeout_update(ee); + } + return updates ? 1 : 0; +} + +static int +_ecore_evas_psl1ght_render(Ecore_Evas *ee) +{ + int rend = 0; + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_BUFFER + Eina_List *ll; + Ecore_Evas *ee2; + + EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) + { + if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); + rend |= _ecore_evas_buffer_render(ee2); + if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); + } +#endif + + if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); + + if (ee->prop.avoid_damage) rend = _ecore_evas_render(ee); + else if ((ee->visible) || + ((ee->should_be_visible) && (ee->prop.fullscreen)) || + ((ee->should_be_visible) && (ee->prop.override))) + rend |= _ecore_evas_render(ee); + else + evas_norender(ee->evas); + + if (ee->func.fn_post_render) ee->func.fn_post_render(ee); + return rend; +} + +static Eina_Bool +_ecore_evas_psl1ght_event(void *data __UNUSED__) +{ + ecore_psl1ght_poll_events(); + return ECORE_CALLBACK_RENEW; +} + +static int +_ecore_evas_psl1ght_init(int w __UNUSED__, int h __UNUSED__) +{ + _ecore_evas_init_count++; + if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; + + _ecore_evas_fps_debug = 1; + + // this is pretty bad: poller? and set poll time? pol time is meant to be + // adjustable for things like polling battery state, or amoutn of spare + // memory etc. + // + ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, _ecore_evas_psl1ght_event, NULL); + ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006); + + if (_ecore_evas_fps_debug) + _ecore_evas_fps_debug_init(); + + ecore_event_evas_init(); + + ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_GOT_FOCUS, _ecore_evas_psl1ght_event_got_focus, NULL); + ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_LOST_FOCUS, _ecore_evas_psl1ght_event_lost_focus, NULL); + ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_EXPOSE, _ecore_evas_psl1ght_event_video_expose, NULL); + ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS, _ecore_evas_psl1ght_event_key_modifiers, NULL); + + return _ecore_evas_init_count; +} + +static int +_ecore_evas_psl1ght_shutdown(void) +{ + _ecore_evas_init_count--; + if (_ecore_evas_init_count == 0) + { + unsigned int i; + + for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler *); i++) + ecore_event_handler_del(ecore_evas_event_handlers[i]); + ecore_event_evas_shutdown(); + ecore_poller_del(ecore_evas_event); + ecore_evas_event = NULL; + if (_ecore_evas_fps_debug) + _ecore_evas_fps_debug_shutdown(); + } + if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; + return _ecore_evas_init_count; +} + +static void +_ecore_evas_psl1ght_free(Ecore_Evas *ee) +{ + if (psl1ght_ee == ee) psl1ght_ee = NULL; + + ecore_event_window_unregister(0); + _ecore_evas_psl1ght_shutdown(); + ecore_psl1ght_shutdown(); +} + +static void +_ecore_evas_screen_resized(Ecore_Evas *ee) +{ + int w, h; + + /* Do not resize if the window is not fullscreen */ + if (ee->prop.fullscreen == 0) return; + + ecore_psl1ght_screen_resolution_get (&w, &h); + + if (w != ee->w || h != ee->h) + { + ee->req.w = ee->w = w; + ee->req.h = ee->h = h; + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + ecore_psl1ght_resolution_set (w, h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + + _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, + _ecore_evas_time_get()); + if (ee->func.fn_resize) ee->func.fn_resize(ee); + } +} + +static void +_ecore_evas_resize(Ecore_Evas *ee, int w, int h) +{ + if ((w == ee->w) && (h == ee->h)) return; + ee->w = w; + ee->h = h; + + evas_output_size_set(ee->evas, ee->w, ee->h); + + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + + ecore_psl1ght_resolution_set (w, h); + + if (ee->func.fn_resize) ee->func.fn_resize(ee); + + _ecore_evas_screen_resized (ee); +} + +static void +_ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) +{ + _ecore_evas_resize (ee, w, h); +} + +static void +_ecore_evas_show(Ecore_Evas *ee) +{ + if (ee->prop.focused) return; + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); +} + +static void +_ecore_evas_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) +{ + if (x) *x = 0; + if (y) *y = 0; + ecore_psl1ght_screen_resolution_get (w, h); +} + +static void +_ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + + ee = data; + if (ee) + ee->prop.cursor.object = NULL; +} + +static void +_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +{ + int x, y; + + if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); + + if (!obj) + { + ee->prop.cursor.object = NULL; + ee->prop.cursor.layer = 0; + ee->prop.cursor.hot.x = 0; + ee->prop.cursor.hot.y = 0; + return; + } + + ee->prop.cursor.object = obj; + ee->prop.cursor.layer = layer; + ee->prop.cursor.hot.x = hot_x; + ee->prop.cursor.hot.y = hot_y; + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_move(ee->prop.cursor.object, + x - ee->prop.cursor.hot.x, + y - ee->prop.cursor.hot.y); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); +} + +static Ecore_Evas_Engine_Func _ecore_psl1ght_engine_func = +{ + _ecore_evas_psl1ght_free, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_resize, + _ecore_evas_move_resize, + NULL, + NULL, + _ecore_evas_show, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_object_cursor_set, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, //transparent + + NULL, // render + _ecore_evas_screen_geometry_get // screen_geometry_get +}; + +EAPI Ecore_Evas * +ecore_evas_psl1ght_new(const char *name, int w, int h) +{ + void *einfo; + Ecore_Evas *ee; + + if (!name) + name = ecore_evas_psl1ght_default; + + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) return NULL; + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_psl1ght_engine_func; + + ee->driver = "psl1ght"; + if (name) ee->name = strdup(name); + + if (w < 1) w = 1; + if (h < 1) h = 1; + ee->visible = 1; + ee->w = w; + ee->h = h; + + ee->prop.max.w = 0; + ee->prop.max.h = 0; + ee->prop.layer = 0; + ee->prop.focused = 1; + ee->prop.borderless = 1; + ee->prop.override = 1; + ee->prop.maximized = 1; + ee->prop.fullscreen = 0; + ee->prop.withdrawn = 0; + ee->prop.sticky = 0; + ee->prop.window = 0; + + /* init evas here */ + ee->evas = evas_new(); + evas_data_attach_set(ee->evas, ee); + evas_output_method_set(ee->evas, evas_render_method_lookup("psl1ght")); + + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + + einfo = evas_engine_info_get(ee->evas); + if (einfo) + { + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + + if (!ecore_psl1ght_init(name)) + { + evas_free(ee->evas); + if (ee->name) free(ee->name); + free(ee); + return NULL; + } + ecore_psl1ght_resolution_set (w, h); + + _ecore_evas_psl1ght_init(w, h); + + ecore_event_window_register(0, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + + ee->engine.func->fn_render = _ecore_evas_psl1ght_render; + _ecore_evas_register(ee); + + psl1ght_ee = ee; + + _ecore_evas_screen_resized (ee); + + if (getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH")) + ecore_evas_cursor_set(ee, getenv("ECORE_EVAS_PSL1GHT_CURSOR_PATH"), EVAS_LAYER_MAX, 0, 0); + + evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); + + return ee; +} + +#else /* BUILD_ECORE_EVAS_PSL1GHT */ + +EAPI Ecore_Evas * +ecore_evas_psl1ght_new(const char *name __UNUSED__, int w __UNUSED__, int h __UNUSED__) +{ + ERR("OUTCH !"); + return NULL; +} + +#endif /* BUILD_ECORE_EVAS_PSL1GHT */ diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c new file mode 100644 index 0000000..b333d96 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_sdl.c @@ -0,0 +1,542 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL) +# include +# ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL +# include +# endif +# ifdef BUILD_ECORE_EVAS_OPENGL_SDL +# include +# endif +#endif + +#include "ecore_evas_private.h" +#include "Ecore_Evas.h" + +// fixme: 1 sdl window only at a time? seems wrong + +#if defined(BUILD_ECORE_EVAS_SOFTWARE_SDL) || defined(BUILD_ECORE_EVAS_OPENGL_SDL) + +/* static char *ecore_evas_default_display = "0"; */ +/* static Ecore_List *ecore_evas_input_devices = NULL; */ + +static int _ecore_evas_init_count = 0; + +static Ecore_Evas *sdl_ee = NULL; +static Ecore_Event_Handler *ecore_evas_event_handlers[4] = { + NULL, NULL, NULL, NULL +}; + +static const char *ecore_evas_sdl_default = "EFL SDL"; +static int _ecore_evas_fps_debug = 0; +static Ecore_Poller *ecore_evas_event; + +static Ecore_Evas * +_ecore_evas_sdl_match(void) +{ + return sdl_ee; +} + +static Eina_Bool +_ecore_evas_sdl_event_got_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) +{ + Ecore_Evas *ee; + + ee = _ecore_evas_sdl_match(); + + if (!ee) return ECORE_CALLBACK_PASS_ON; + /* pass on event */ + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_sdl_event_lost_focus(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) +{ + Ecore_Evas *ee; + + ee = _ecore_evas_sdl_match(); + + if (!ee) return ECORE_CALLBACK_PASS_ON; + /* pass on event */ + ee->prop.focused = 0; + evas_focus_out(ee->evas); + if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_sdl_event_video_resize(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Sdl_Event_Video_Resize *e; + Ecore_Evas *ee; + + e = event; + ee = _ecore_evas_sdl_match(); + + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + evas_output_size_set(ee->evas, e->w, e->h); + + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_sdl_event_video_expose(void *data __UNUSED__, int type __UNUSED__, void *event __UNUSED__) +{ + Ecore_Evas *ee; + int w; + int h; + + ee = _ecore_evas_sdl_match(); + + if (!ee) return ECORE_CALLBACK_PASS_ON; + evas_output_size_get(ee->evas, &w, &h); + evas_damage_rectangle_add(ee->evas, 0, 0, w, h); + + return ECORE_CALLBACK_PASS_ON; +} + +static int +_ecore_evas_render(Ecore_Evas *ee) +{ + Eina_List *updates; + + updates = evas_render_updates(ee->evas); + if (updates) + { + evas_render_updates_free(updates); + _ecore_evas_idle_timeout_update(ee); + } + return updates ? 1 : 0; +} + +static int +_ecore_evas_sdl_render(Ecore_Evas *ee) +{ + int rend = 0; + Eina_List *ll; + Ecore_Evas *ee2; + + EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) + { + if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); + if (ee2->engine.func->fn_render) + rend |= ee2->engine.func->fn_render(ee2); + if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); + } + + if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); + + if (ee->prop.avoid_damage) rend = _ecore_evas_render(ee); + else if ((ee->visible) || + ((ee->should_be_visible) && (ee->prop.fullscreen)) || + ((ee->should_be_visible) && (ee->prop.override))) + rend |= _ecore_evas_render(ee); + else + evas_norender(ee->evas); + + if (ee->func.fn_post_render) ee->func.fn_post_render(ee); + return rend; +} + +static Eina_Bool +_ecore_evas_sdl_event(void *data __UNUSED__) +{ + ecore_sdl_feed_events(); + return ECORE_CALLBACK_RENEW; +} + +static int +_ecore_evas_sdl_init(int w __UNUSED__, int h __UNUSED__) +{ + _ecore_evas_init_count++; + if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; + +#ifndef _WIN32 + if (getenv("ECORE_EVAS_FPS_DEBUG")) _ecore_evas_fps_debug = 1; +#endif /* _WIN32 */ + // this is pretty bad: poller? and set poll time? pol time is meant to be + // adjustable for things like polling battery state, or amoutn of spare + // memory etc. + // + ecore_evas_event = ecore_poller_add(ECORE_POLLER_CORE, 1, _ecore_evas_sdl_event, NULL); + ecore_poller_poll_interval_set(ECORE_POLLER_CORE, 0.006); +#ifndef _WIN32 + if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_init(); +#endif /* _WIN32 */ + + ecore_event_evas_init(); + + ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_SDL_EVENT_GOT_FOCUS, _ecore_evas_sdl_event_got_focus, NULL); + ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_SDL_EVENT_LOST_FOCUS, _ecore_evas_sdl_event_lost_focus, NULL); + ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_SDL_EVENT_RESIZE, _ecore_evas_sdl_event_video_resize, NULL); + ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_SDL_EVENT_EXPOSE, _ecore_evas_sdl_event_video_expose, NULL); + + return _ecore_evas_init_count; +} + +static int +_ecore_evas_sdl_shutdown(void) +{ + _ecore_evas_init_count--; + if (_ecore_evas_init_count == 0) + { + int i; + + for (i = 0; i < sizeof (ecore_evas_event_handlers) / sizeof (Ecore_Event_Handler*); i++) + ecore_event_handler_del(ecore_evas_event_handlers[i]); + ecore_event_evas_shutdown(); + ecore_poller_del(ecore_evas_event); + ecore_evas_event = NULL; +#ifndef _WIN32 + if (_ecore_evas_fps_debug) _ecore_evas_fps_debug_shutdown(); +#endif /* _WIN32 */ + } + if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; + return _ecore_evas_init_count; +} + +static void +_ecore_evas_sdl_free(Ecore_Evas *ee) +{ + if (sdl_ee == ee) sdl_ee = NULL; + + ecore_event_window_unregister(0); + _ecore_evas_sdl_shutdown(); + ecore_sdl_shutdown(); +} + +static void +_ecore_evas_resize(Ecore_Evas *ee, int w, int h) +{ + if ((w == ee->w) && (h == ee->h)) return; + ee->w = w; + ee->h = h; + + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + + if (ee->func.fn_resize) ee->func.fn_resize(ee); +} + +static void +_ecore_evas_move_resize(Ecore_Evas *ee, int x __UNUSED__, int y __UNUSED__, int w, int h) +{ + if ((w == ee->w) && (h == ee->h)) return; + ee->w = w; + ee->h = h; + + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + + if (ee->func.fn_resize) ee->func.fn_resize(ee); +} + +static void +_ecore_evas_show(Ecore_Evas *ee) +{ + if (ee->prop.focused) return; + ee->prop.focused = 1; + evas_event_feed_mouse_in(ee->evas, (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff), NULL); +} + +static void +_ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + + ee = data; + if (ee) ee->prop.cursor.object = NULL; +} + +static void +_ecore_evas_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +{ + int x, y; + + if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); + + if (!obj) + { + ee->prop.cursor.object = NULL; + ee->prop.cursor.layer = 0; + ee->prop.cursor.hot.x = 0; + ee->prop.cursor.hot.y = 0; + return; + } + + ee->prop.cursor.object = obj; + ee->prop.cursor.layer = layer; + ee->prop.cursor.hot.x = hot_x; + ee->prop.cursor.hot.y = hot_y; + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_move(ee->prop.cursor.object, + x - ee->prop.cursor.hot.x, + y - ee->prop.cursor.hot.y); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); +} + +static Ecore_Evas_Engine_Func _ecore_sdl_engine_func = +{ + _ecore_evas_sdl_free, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_resize, + _ecore_evas_move_resize, + NULL, + NULL, + _ecore_evas_show, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_object_cursor_set, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, //transparent + + NULL, // render + NULL // screen_geometry_get +}; + +static Ecore_Evas* +_ecore_evas_internal_sdl_new(int rmethod, const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha) +{ + void *einfo; + Ecore_Evas *ee; + + if (!name) + name = ecore_evas_sdl_default; + + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) return NULL; + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_sdl_engine_func; + + ee->driver = "sdl"; + if (name) ee->name = strdup(name); + + if (w < 1) w = 1; + if (h < 1) h = 1; + ee->visible = 1; + ee->w = w; + ee->h = h; + + ee->prop.max.w = 0; + ee->prop.max.h = 0; + ee->prop.layer = 0; + ee->prop.focused = 1; + ee->prop.borderless = 1; + ee->prop.override = 1; + ee->prop.maximized = 1; + ee->prop.fullscreen = fullscreen; + ee->prop.withdrawn = 0; + ee->prop.sticky = 0; + ee->prop.window = 0; + + /* init evas here */ + ee->evas = evas_new(); + evas_data_attach_set(ee->evas, ee); + evas_output_method_set(ee->evas, rmethod); + + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + + if (rmethod == evas_render_method_lookup("software_sdl") || + rmethod == evas_render_method_lookup("software_16_sdl") ) + { +#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL + einfo = evas_engine_info_get(ee->evas); + if (einfo) + { + ((Evas_Engine_Info_SDL *)einfo)->info.rotation = 0; + ((Evas_Engine_Info_SDL *)einfo)->info.fullscreen = fullscreen; + ((Evas_Engine_Info_SDL *)einfo)->info.hwsurface = hwsurface; + ((Evas_Engine_Info_SDL *)einfo)->info.noframe = noframe; + ((Evas_Engine_Info_SDL *)einfo)->info.alpha = alpha; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } +#endif + } + else if (rmethod == evas_render_method_lookup("gl_sdl")) + { +#ifdef BUILD_ECORE_EVAS_OPENGL_SDL + einfo = evas_engine_info_get(ee->evas); + if (einfo) + { + ((Evas_Engine_Info_GL_SDL *)einfo)->flags.fullscreen = fullscreen; + ((Evas_Engine_Info_GL_SDL *)einfo)->flags.noframe = noframe; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } +#endif + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + + if (!ecore_sdl_init(name)) + { + evas_free(ee->evas); + if (ee->name) free(ee->name); + free(ee); + return NULL; + } + + _ecore_evas_sdl_init(w, h); + + ecore_event_window_register(0, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + + SDL_ShowCursor(SDL_DISABLE); + + ee->engine.func->fn_render = _ecore_evas_sdl_render; + _ecore_evas_register(ee); + + sdl_ee = ee; + return ee; +} +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL +EAPI Ecore_Evas* +ecore_evas_sdl_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha) +{ + Ecore_Evas *ee; + int rmethod; + + rmethod = evas_render_method_lookup("software_sdl"); + if (!rmethod) return NULL; + + ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, hwsurface, noframe, alpha); + ee->driver = "sdl"; + return ee; +} +#else +EAPI Ecore_Evas* +ecore_evas_sdl_new(const char* name __UNUSED__, int w __UNUSED__, int h __UNUSED__, int fullscreen __UNUSED__, int hwsurface __UNUSED__, int noframe __UNUSED__, int alpha __UNUSED__) +{ + ERR("OUTCH !"); + return NULL; +} +#endif + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_SDL +EAPI Ecore_Evas* +ecore_evas_sdl16_new(const char* name, int w, int h, int fullscreen, int hwsurface, int noframe, int alpha) +{ + Ecore_Evas *ee; + int rmethod; + + rmethod = evas_render_method_lookup("software_16_sdl"); + if (!rmethod) return NULL; + + ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, hwsurface, noframe, alpha); + ee->driver = "software_16_sdl"; + return ee; +} +#else +EAPI Ecore_Evas* +ecore_evas_sdl16_new(const char* name __UNUSED__, int w __UNUSED__, int h __UNUSED__, int fullscreen __UNUSED__, int hwsurface __UNUSED__, int noframe __UNUSED__, int alpha __UNUSED__) +{ + ERR("OUTCH !"); + return NULL; +} +#endif + +#ifdef BUILD_ECORE_EVAS_OPENGL_SDL +EAPI Ecore_Evas* +ecore_evas_gl_sdl_new(const char* name, int w, int h, int fullscreen, int noframe) +{ + Ecore_Evas *ee; + int rmethod; + + rmethod = evas_render_method_lookup("gl_sdl"); + if (!rmethod) return NULL; + + ee = _ecore_evas_internal_sdl_new(rmethod, name, w, h, fullscreen, 0, noframe, 0); + ee->driver = "gl_sdl"; + return ee; +} +#else +EAPI Ecore_Evas* +ecore_evas_gl_sdl_new(const char* name __UNUSED__, int w __UNUSED__, int h __UNUSED__, int fullscreen __UNUSED__, int noframe __UNUSED__) +{ + ERR("OUTCH !"); + return NULL; +} +#endif + diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c new file mode 100644 index 0000000..95b6d22 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_util.c @@ -0,0 +1,437 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include +#include "ecore_private.h" + +#include "ecore_evas_private.h" +#include "Ecore_Evas.h" + +static const char ASSOCIATE_KEY[] = "__Ecore_Evas_Associate"; + +static void _ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags); +static void _ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj); + + +static Evas_Object * +_ecore_evas_associate_get(const Ecore_Evas *ee) +{ + return ecore_evas_data_get(ee, ASSOCIATE_KEY); +} + +static void +_ecore_evas_associate_set(Ecore_Evas *ee, Evas_Object *obj) +{ + ecore_evas_data_set(ee, ASSOCIATE_KEY, obj); +} + +static void +_ecore_evas_associate_del(Ecore_Evas *ee) +{ + ecore_evas_data_set(ee, ASSOCIATE_KEY, NULL); +} + +static Ecore_Evas * +_evas_object_associate_get(const Evas_Object *obj) +{ + return evas_object_data_get(obj, ASSOCIATE_KEY); +} + +static void +_evas_object_associate_set(Evas_Object *obj, Ecore_Evas *ee) +{ + evas_object_data_set(obj, ASSOCIATE_KEY, ee); +} + +static void +_evas_object_associate_del(Evas_Object *obj) +{ + evas_object_data_del(obj, ASSOCIATE_KEY); +} + +/** Associated Events: ******************************************************/ + +/* Interceptors Callbacks */ + +static void +_ecore_evas_obj_intercept_move(void *data, Evas_Object *obj, Evas_Coord x, Evas_Coord y) +{ + Ecore_Evas *ee = data; + // FIXME: account for frame + ecore_evas_move(ee, x, y); + if (ecore_evas_override_get(ee)) evas_object_move(obj, x, y); +} + +static void +_ecore_evas_obj_intercept_raise(void *data, Evas_Object *obj __UNUSED__) +{ + Ecore_Evas *ee = data; + ecore_evas_raise(ee); +} + +static void +_ecore_evas_obj_intercept_lower(void *data, Evas_Object *obj __UNUSED__) +{ + Ecore_Evas *ee = data; + ecore_evas_lower(ee); +} + +static void +_ecore_evas_obj_intercept_stack_above(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Object *above __UNUSED__) +{ + INF("TODO: %s", __FUNCTION__); +} + +static void +_ecore_evas_obj_intercept_stack_below(void *data __UNUSED__, Evas_Object *obj __UNUSED__, Evas_Object *below __UNUSED__) +{ + INF("TODO: %s", __FUNCTION__); +} + +static void +_ecore_evas_obj_intercept_layer_set(void *data, Evas_Object *obj __UNUSED__, int l) +{ + Ecore_Evas *ee = data; + ecore_evas_layer_set(ee, l); +} + +/* Event Callbacks */ + +static void +_ecore_evas_obj_callback_show(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + ecore_evas_show(ee); +} + +static void +_ecore_evas_obj_callback_hide(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + ecore_evas_hide(ee); +} + +static void +_ecore_evas_obj_callback_resize(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + Evas_Coord ow, oh, w, h; + + evas_object_geometry_get(obj, NULL, NULL, &ow, &oh); + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + /*if ((w != ow) || (h != oh))*/ /* avoid recursion on ecore_evas_resize side */ + ecore_evas_resize(ee, ow, oh); +} + +static void +_ecore_evas_obj_callback_changed_size_hints(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + Evas_Coord w, h; + + evas_object_size_hint_min_get(obj, &w, &h); + ecore_evas_size_min_set(ee, w, h); + + evas_object_size_hint_max_get(obj, &w, &h); + if (w < 1) w = -1; + if (h < 1) h = -1; + ecore_evas_size_max_set(ee, w, h); +} + +static void +_ecore_evas_obj_callback_del(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + _ecore_evas_object_dissociate(ee, obj); + ecore_evas_free(ee); +} + +static void +_ecore_evas_obj_callback_del_dissociate(void *data, Evas *e __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + _ecore_evas_object_dissociate(ee, obj); +} + +static void +_ecore_evas_delete_request(Ecore_Evas *ee) +{ + Evas_Object *obj = _ecore_evas_associate_get(ee); + _ecore_evas_object_dissociate(ee, obj); + evas_object_del(obj); + ecore_evas_free(ee); +} + +static void +_ecore_evas_destroy(Ecore_Evas *ee) +{ + Evas_Object *obj = _ecore_evas_associate_get(ee); + if (!obj) + return; + _ecore_evas_object_dissociate(ee, obj); + evas_object_del(obj); +} + +static void +_ecore_evas_resize(Ecore_Evas *ee) +{ + Evas_Object *obj = _ecore_evas_associate_get(ee); + Evas_Coord w, h; + ecore_evas_geometry_get(ee, NULL, NULL, &w, &h); + evas_object_resize(obj, w, h); +} + +static void +_ecore_evas_pre_free(Ecore_Evas *ee) +{ + Evas_Object *obj = _ecore_evas_associate_get(ee); + if (!obj) + return; + _ecore_evas_object_dissociate(ee, obj); + evas_object_del(obj); +} + +static int +_ecore_evas_object_evas_check(const char *function, const Ecore_Evas *ee, const Evas_Object *obj) +{ + const char *name, *type; + Evas *e; + + e = evas_object_evas_get(obj); + if (e == ee->evas) + return 1; + + name = evas_object_name_get(obj); + type = evas_object_type_get(obj); + + ERR("ERROR: %s(): object %p (name=\"%s\", type=\"%s\") evas " + "is not the same as this Ecore_Evas evas: %p != %p", + function, obj, + name ? name : "", type ? type : "", e, ee->evas); + fflush(stderr); + if (getenv("ECORE_ERROR_ABORT")) abort(); + + return 0; +} + +EAPI Eina_Bool +ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags) +{ + Ecore_Evas *old_ee; + Evas_Object *old_obj; + + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__); + return EINA_FALSE; + } + + CHECK_PARAM_POINTER_RETURN("obj", obj, EINA_FALSE); + if (!_ecore_evas_object_evas_check(__FUNCTION__, ee, obj)) + return EINA_FALSE; + + old_ee = _evas_object_associate_get(obj);; + if (old_ee) + ecore_evas_object_dissociate(old_ee, obj); + + old_obj = _ecore_evas_associate_get(ee); + if (old_obj) + ecore_evas_object_dissociate(ee, old_obj); + + _ecore_evas_object_associate(ee, obj, flags); + return EINA_TRUE; +} + +EAPI Eina_Bool +ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj) +{ + Ecore_Evas *old_ee; + Evas_Object *old_obj; + + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__); + return EINA_FALSE; + } + + CHECK_PARAM_POINTER_RETURN("obj", obj, EINA_FALSE); + old_ee = _evas_object_associate_get(obj); + if (ee != old_ee) { + ERR("ERROR: trying to dissociate object that is not using " + "this Ecore_Evas: %p != %p", ee, old_ee); + return EINA_FALSE; + } + + old_obj = _ecore_evas_associate_get(ee); + if (old_obj != obj) { + ERR("ERROR: trying to dissociate object that is not being " + "used by this Ecore_Evas: %p != %p", old_obj, obj); + return EINA_FALSE; + } + + _ecore_evas_object_dissociate(ee, obj); + + return EINA_TRUE; +} + +EAPI Evas_Object * +ecore_evas_object_associate_get(const Ecore_Evas *ee) +{ + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__); + return NULL; + } + return _ecore_evas_associate_get(ee); +} + +static void +_ecore_evas_object_associate(Ecore_Evas *ee, Evas_Object *obj, Ecore_Evas_Object_Associate_Flags flags) +{ + evas_object_event_callback_add + (obj, EVAS_CALLBACK_SHOW, + _ecore_evas_obj_callback_show, ee); + evas_object_event_callback_add + (obj, EVAS_CALLBACK_HIDE, + _ecore_evas_obj_callback_hide, ee); + evas_object_event_callback_add + (obj, EVAS_CALLBACK_RESIZE, + _ecore_evas_obj_callback_resize, ee); + evas_object_event_callback_add + (obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _ecore_evas_obj_callback_changed_size_hints, ee); + if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_DEL) + evas_object_event_callback_add + (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del, ee); + else + evas_object_event_callback_add + (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del_dissociate, ee); + + evas_object_intercept_move_callback_add + (obj, _ecore_evas_obj_intercept_move, ee); + + if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_STACK) + { + evas_object_intercept_raise_callback_add + (obj, _ecore_evas_obj_intercept_raise, ee); + evas_object_intercept_lower_callback_add + (obj, _ecore_evas_obj_intercept_lower, ee); + evas_object_intercept_stack_above_callback_add + (obj, _ecore_evas_obj_intercept_stack_above, ee); + evas_object_intercept_stack_below_callback_add + (obj, _ecore_evas_obj_intercept_stack_below, ee); + } + + if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_LAYER) + evas_object_intercept_layer_set_callback_add + (obj, _ecore_evas_obj_intercept_layer_set, ee); + + if (flags & ECORE_EVAS_OBJECT_ASSOCIATE_DEL) + { + ecore_evas_callback_delete_request_set(ee, _ecore_evas_delete_request); + ecore_evas_callback_destroy_set(ee, _ecore_evas_destroy); + } + ecore_evas_callback_pre_free_set(ee, _ecore_evas_pre_free); + ecore_evas_callback_resize_set(ee, _ecore_evas_resize); + + _evas_object_associate_set(obj, ee); + _ecore_evas_associate_set(ee, obj); +} + +static void +_ecore_evas_object_dissociate(Ecore_Evas *ee, Evas_Object *obj) +{ + evas_object_event_callback_del_full + (obj, EVAS_CALLBACK_SHOW, + _ecore_evas_obj_callback_show, ee); + evas_object_event_callback_del_full + (obj, EVAS_CALLBACK_HIDE, + _ecore_evas_obj_callback_hide, ee); + evas_object_event_callback_del_full + (obj, EVAS_CALLBACK_RESIZE, + _ecore_evas_obj_callback_resize, ee); + evas_object_event_callback_del_full + (obj, EVAS_CALLBACK_CHANGED_SIZE_HINTS, + _ecore_evas_obj_callback_changed_size_hints, ee); + evas_object_event_callback_del_full + (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del, ee); + evas_object_event_callback_del_full + (obj, EVAS_CALLBACK_DEL, _ecore_evas_obj_callback_del_dissociate, ee); + + evas_object_intercept_move_callback_del + (obj, _ecore_evas_obj_intercept_move); + + evas_object_intercept_raise_callback_del + (obj, _ecore_evas_obj_intercept_raise); + evas_object_intercept_lower_callback_del + (obj, _ecore_evas_obj_intercept_lower); + evas_object_intercept_stack_above_callback_del + (obj, _ecore_evas_obj_intercept_stack_above); + evas_object_intercept_stack_below_callback_del + (obj, _ecore_evas_obj_intercept_stack_below); + + evas_object_intercept_layer_set_callback_del + (obj, _ecore_evas_obj_intercept_layer_set); + + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, __FUNCTION__); + } + else + { + if (ee->func.fn_delete_request == _ecore_evas_delete_request) + ecore_evas_callback_delete_request_set(ee, NULL); + if (ee->func.fn_destroy == _ecore_evas_destroy) + ecore_evas_callback_destroy_set(ee, NULL); + if (ee->func.fn_resize == _ecore_evas_resize) + ecore_evas_callback_resize_set(ee, NULL); + if (ee->func.fn_pre_free == _ecore_evas_pre_free) + ecore_evas_callback_pre_free_set(ee, NULL); + + _ecore_evas_associate_del(ee); + } + + _evas_object_associate_del(obj); +} + +/** + * Helper ecore_getopt callback to list available Ecore_Evas engines. + * + * This will list all available engines except buffer, this is useful + * for applications to let user choose how they should create windows + * with ecore_evas_new(). + * + * @c callback_data value is used as @c FILE* and says where to output + * messages, by default it is @c stdout. You can specify this value + * with ECORE_GETOPT_CALLBACK_FULL() or ECORE_GETOPT_CALLBACK_ARGS(). + * + * If there is a boolean storage provided, then it is marked with 1 + * when this option is executed. + */ +unsigned char +ecore_getopt_callback_ecore_evas_list_engines(const Ecore_Getopt *parser __UNUSED__, const Ecore_Getopt_Desc *desc __UNUSED__, const char *str __UNUSED__, void *data, Ecore_Getopt_Value *storage) +{ + Eina_List *lst, *n; + const char *engine; + FILE *fp = data; + + if (!fp) + fp = stdout; + + lst = ecore_evas_engines_get(); + + fputs("supported engines:\n", fp); + EINA_LIST_FOREACH(lst, n, engine) + if (strcmp(engine, "buffer") != 0) + fprintf(fp, "\t%s\n", engine); + + ecore_evas_engines_free(lst); + + if (storage->boolp) + *storage->boolp = 1; + + return 1; +} diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c new file mode 100644 index 0000000..2ca7cb0 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_win32.c @@ -0,0 +1,1451 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include /* for NULL */ + +#include +#include "ecore_private.h" +#ifdef BUILD_ECORE_EVAS_WIN32 +# define WIN32_LEAN_AND_MEAN +# include +# undef WIN32_LEAN_AND_MEAN +# include +# include +#endif /* BUILD_ECORE_EVAS_WIN32 */ + +#include "ecore_evas_private.h" +#include "Ecore_Evas.h" + +#ifdef BUILD_ECORE_EVAS_WIN32 + +#define ECORE_EVAS_EVENT_COUNT 10 + +static int _ecore_evas_init_count = 0; + +static Ecore_Event_Handler *ecore_evas_event_handlers[ECORE_EVAS_EVENT_COUNT]; + +static Eina_Bool _ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_win32_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_win32_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_win32_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_win32_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_win32_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_win32_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_win32_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_win32_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event); + +/* Private functions */ + +static int +_ecore_evas_win32_render(Ecore_Evas *ee) +{ + int rend = 0; + Eina_List *updates = NULL; + Eina_List *ll; + Ecore_Evas *ee2; + + EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) + { + if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); + if (ee2->engine.func->fn_render) + rend |= ee2->engine.func->fn_render(ee2); + if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); + } + + if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); + if (ee->prop.avoid_damage) + { + updates = evas_render_updates(ee->evas); + if (updates) evas_render_updates_free(updates); + } + else if ((ee->visible) || + ((ee->should_be_visible) && (ee->prop.fullscreen)) || + ((ee->should_be_visible) && (ee->prop.override))) + { + if (ee->shaped) + { + updates = evas_render_updates(ee->evas); + if (updates) evas_render_updates_free(updates); + } + else + { + updates = evas_render_updates(ee->evas); + if (updates) evas_render_updates_free(updates); + } + } + else + evas_norender(ee->evas); + if (updates) rend = 1; + if (ee->func.fn_post_render) ee->func.fn_post_render(ee); + return rend; +} + +static int +_ecore_evas_win32_init(void) +{ + _ecore_evas_init_count++; + if (_ecore_evas_init_count > 1) + return _ecore_evas_init_count; + + ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_IN, _ecore_evas_win32_event_mouse_in, NULL); + ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_WIN32_EVENT_MOUSE_OUT, _ecore_evas_win32_event_mouse_out, NULL); + ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, _ecore_evas_win32_event_window_focus_in, NULL); + ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, _ecore_evas_win32_event_window_focus_out, NULL); + ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, _ecore_evas_win32_event_window_damage, NULL); + ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, _ecore_evas_win32_event_window_destroy, NULL); + ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_SHOW, _ecore_evas_win32_event_window_show, NULL); + ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_HIDE, _ecore_evas_win32_event_window_hide, NULL); + ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, _ecore_evas_win32_event_window_configure, NULL); + ecore_evas_event_handlers[9] = ecore_event_handler_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, _ecore_evas_win32_event_window_delete_request, NULL); + + ecore_event_evas_init(); + return _ecore_evas_init_count; +} + +int +_ecore_evas_win32_shutdown(void) +{ + _ecore_evas_init_count--; + if (_ecore_evas_init_count == 0) + { + int i; + + for (i = 0; i < ECORE_EVAS_EVENT_COUNT; i++) + ecore_event_handler_del(ecore_evas_event_handlers[i]); + ecore_event_evas_shutdown(); + } + + if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; + + return _ecore_evas_init_count; +} + +static Eina_Bool +_ecore_evas_win32_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Win32_Event_Mouse_In *e; + + INF("mouse in"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ + if ((Ecore_Window)e->window != ee->prop.window) return 1; + + if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); + /* FIXME to do */ +/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ + evas_event_feed_mouse_in(ee->evas, e->time, NULL); + evas_focus_in(ee->evas); + _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + + return 1; +} + +static Eina_Bool +_ecore_evas_win32_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Win32_Event_Mouse_Out *e; + + INF("mouse out"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ + if ((Ecore_Window)e->window != ee->prop.window) return 1; + + /* FIXME to do */ +/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ + _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + + evas_event_feed_mouse_out(ee->evas, e->time, NULL); + if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); + if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); + + return 1; +} + +static Eina_Bool +_ecore_evas_win32_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Win32_Event_Window_Focus_In *e; + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; + if ((Ecore_Window)e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_win32_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Win32_Event_Window_Focus_Out *e; + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; + if ((Ecore_Window)e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + + evas_focus_out(ee->evas); + ee->prop.focused = 0; + if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_win32_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Win32_Event_Window_Damage *e; + + INF("window damage"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if (!ee) return 1; /* pass on event */ + if ((Ecore_Window)e->window != ee->prop.window) return 1; + + if (ee->prop.avoid_damage) + { +#ifdef _MSC_VER +# pragma message ("[ECORE] [WIN32] No Region code") +#else +# warning [ECORE] [WIN32] No Region code +#endif /* ! _MSC_VER */ + } + else + { + if (ee->rotation == 0) + evas_damage_rectangle_add(ee->evas, + e->x, + e->y, + e->width, + e->height); + else if (ee->rotation == 90) + evas_damage_rectangle_add(ee->evas, + ee->h - e->y - e->height, + e->x, + e->height, + e->width); + else if (ee->rotation == 180) + evas_damage_rectangle_add(ee->evas, + ee->w - e->x - e->width, + ee->h - e->y - e->height, + e->width, + e->height); + else if (ee->rotation == 270) + evas_damage_rectangle_add(ee->evas, + e->y, + ee->w - e->x - e->width, + e->height, + e->width); + } + + return 1; +} + +static Eina_Bool +_ecore_evas_win32_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Win32_Event_Window_Destroy *e; + + INF("window destroy"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if (!ee) return 1; /* pass on event */ + if ((Ecore_Window)e->window != ee->prop.window) return 1; + if (ee->func.fn_destroy) ee->func.fn_destroy(ee); + ecore_evas_free(ee); + + return 1; +} + +static Eina_Bool +_ecore_evas_win32_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Win32_Event_Window_Show *e; + + INF("window show"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if (!ee) return 1; /* pass on event */ + if ((Ecore_Window)e->window != ee->prop.window) return 1; + if (ee->visible) return 0; /* dont pass it on */ + ee->visible = 1; + if (ee->func.fn_show) ee->func.fn_show(ee); + + return 1; +} + +static Eina_Bool +_ecore_evas_win32_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Win32_Event_Window_Hide *e; + + INF("window hide"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if (!ee) return 1; /* pass on event */ + if ((Ecore_Window)e->window != ee->prop.window) return 1; + if (!ee->visible) return 0; /* dont pass it on */ + ee->visible = 0; + if (ee->func.fn_hide) ee->func.fn_hide(ee); + + return 1; +} + +static Eina_Bool +_ecore_evas_win32_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Win32_Event_Window_Configure *e; + + INF("window configure"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if (!ee) return 1; /* pass on event */ + if ((Ecore_Window)e->window != ee->prop.window) return 1; + + if ((ee->x != e->x) || (ee->y != e->y)) + { + ee->x = e->x; + ee->y = e->y; + ee->req.x = ee->x; + ee->req.y = ee->y; + + if (ee->func.fn_move) ee->func.fn_move(ee); + } + + if ((ee->w != e->width) || (ee->h != e->height)) + { + ee->w = e->width; + ee->h = e->height; + ee->req.w = ee->w; + ee->req.h = ee->h; + + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + } + else + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } + if (ee->prop.avoid_damage) + { + int pdam; + + pdam = ecore_evas_avoid_damage_get(ee); + ecore_evas_avoid_damage_set(ee, 0); + ecore_evas_avoid_damage_set(ee, pdam); + } +/* if (ee->shaped) */ +/* _ecore_evas_win32_region_border_resize(ee); */ + if ((ee->expecting_resize.w > 0) && + (ee->expecting_resize.h > 0)) + { + if ((ee->expecting_resize.w == ee->w) && + (ee->expecting_resize.h == ee->h)) + _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, + ecore_win32_current_time_get()); + ee->expecting_resize.w = 0; + ee->expecting_resize.h = 0; + } + if (ee->func.fn_resize) ee->func.fn_resize(ee); + } + + return 1; +} + +static Eina_Bool +_ecore_evas_win32_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_Win32_Event_Window_Delete_Request *e; + + INF("window delete request"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if (!ee) return 1; /* pass on event */ + if ((Ecore_Window)e->window != ee->prop.window) return 1; + if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); + + INF(" * ee event delete\n"); + return 1; +} + + +/* Ecore_Evas interface */ + +static void +_ecore_evas_win32_free(Ecore_Evas *ee) +{ + INF("ecore evas free"); + + ecore_win32_window_free((struct _Ecore_Win32_Window *)ee->prop.window); + ecore_event_window_unregister(ee->prop.window); + _ecore_evas_win32_shutdown(); + ecore_win32_shutdown(); +} + +static void +_ecore_evas_win32_callback_delete_request_set(Ecore_Evas *ee, + void (*func) (Ecore_Evas *ee)) +{ + ee->func.fn_delete_request = func; +} + +static void +_ecore_evas_win32_move(Ecore_Evas *ee, int x, int y) +{ + INF("ecore evas move (%dx%d)", x, y); + ee->req.x = x; + ee->req.y = y; + + if ((x != ee->x) || (y != ee->y)) + { + ee->x = x; + ee->y = y; + ecore_win32_window_move((struct _Ecore_Win32_Window *)ee->prop.window, + x, y); + if (ee->func.fn_move) ee->func.fn_move(ee); + } +} + +static void +_ecore_evas_win32_resize(Ecore_Evas *ee, int width, int height) +{ + INF("ecore evas resize (%dx%d)", width, height); + ee->req.w = width; + ee->req.h = height; + + if ((ee->w != width) || (ee->h != height)) + { + ee->w = width; + ee->h = height; + ecore_win32_window_resize((struct _Ecore_Win32_Window *)ee->prop.window, + width, height); + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + } + else + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } + if (ee->prop.avoid_damage) + { + int pdam; + + pdam = ecore_evas_avoid_damage_get(ee); + ecore_evas_avoid_damage_set(ee, 0); + ecore_evas_avoid_damage_set(ee, pdam); + } +/* if ((ee->shaped) || (ee->alpha)) */ +/* _ecore_evas_win32_region_border_resize(ee); */ + if (ee->func.fn_resize) ee->func.fn_resize(ee); + } +} + +static void +_ecore_evas_win32_move_resize(Ecore_Evas *ee, int x, int y, int width, int height) +{ + INF("ecore evas resize (%dx%d %dx%d)", x, y, width, height); + ee->req.x = x; + ee->req.y = y; + ee->req.w = width; + ee->req.h = height; + + if ((ee->w != width) || (ee->h != height) || (x != ee->x) || (y != ee->y)) + { + int change_size = 0; + int change_pos = 0; + + if ((ee->w != width) || (ee->h != height)) change_size = 1; + if ((x != ee->x) || (y != ee->y)) change_pos = 1; + + ee->x = x; + ee->y = y; + ee->w = width; + ee->h = height; + ecore_win32_window_move_resize((struct _Ecore_Win32_Window *)ee->prop.window, + x, y, width, height); + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + } + else + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } + if (ee->prop.avoid_damage) + { + int pdam; + + pdam = ecore_evas_avoid_damage_get(ee); + ecore_evas_avoid_damage_set(ee, 0); + ecore_evas_avoid_damage_set(ee, pdam); + } +/* if ((ee->shaped) || (ee->alpha)) */ +/* _ecore_evas_win32_region_border_resize(ee); */ + if (change_pos) + { + if (ee->func.fn_move) ee->func.fn_move(ee); + } + if (change_size) + { + if (ee->func.fn_resize) ee->func.fn_resize(ee); + } + } +} + +static void +_ecore_evas_win32_rotation_set_internal(Ecore_Evas *ee, int rotation) +{ + int rot_dif; + + rot_dif = ee->rotation - rotation; + if (rot_dif < 0) rot_dif = -rot_dif; + + if (rot_dif != 180) + { + int minw, minh, maxw, maxh, basew, baseh, stepw, steph; + + if (!ee->prop.fullscreen) + { + ecore_win32_window_resize((struct _Ecore_Win32_Window *)ee->prop.window, + ee->h, ee->w); + ee->expecting_resize.w = ee->h; + ee->expecting_resize.h = ee->w; + } + else + { + int w, h; + + ecore_win32_window_size_get((struct _Ecore_Win32_Window *)ee->prop.window, + &w, &h); + ecore_win32_window_resize((struct _Ecore_Win32_Window *)ee->prop.window, + h, w); + if ((rotation == 0) || (rotation == 180)) + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } + else + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + } + if (ee->func.fn_resize) ee->func.fn_resize(ee); + } + ecore_evas_size_min_get(ee, &minw, &minh); + ecore_evas_size_max_get(ee, &maxw, &maxh); + ecore_evas_size_base_get(ee, &basew, &baseh); + ecore_evas_size_step_get(ee, &stepw, &steph); + ee->rotation = rotation; + ecore_evas_size_min_set(ee, minh, minw); + ecore_evas_size_max_set(ee, maxh, maxw); + ecore_evas_size_base_set(ee, baseh, basew); + ecore_evas_size_step_set(ee, steph, stepw); + _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, + ecore_win32_current_time_get()); + } + else + { + ee->rotation = rotation; + _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, + ecore_win32_current_time_get()); + if (ee->func.fn_resize) ee->func.fn_resize(ee); + } + + if ((ee->rotation == 90) || (ee->rotation == 270)) + evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); + else + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); +} + +static void +_ecore_evas_win32_rotation_set(Ecore_Evas *ee, int rotation, int resize) +{ + INF("ecore evas rotation: %s", rotation ? "yes" : "no"); + + if (ee->rotation == rotation) return; + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI + if (!strcmp(ee->driver, "software_gdi")) + { + Evas_Engine_Info_Software_Gdi *einfo; + + einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas); + if (!einfo) return; + einfo->info.rotation = rotation; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + _ecore_evas_win32_rotation_set_internal(ee, rotation); + } +#endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */ + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW + if (!strcmp(ee->driver, "software_ddraw")) + { + Evas_Engine_Info_Software_DDraw *einfo; + + einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ee->evas); + if (!einfo) return; + einfo->info.rotation = rotation; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + _ecore_evas_win32_rotation_set_internal(ee, rotation); + } +#endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ +} + +static void +_ecore_evas_win32_shaped_set(Ecore_Evas *ee, int shaped) +{ + if (((ee->shaped) && (shaped)) || ((!ee->shaped) && (!shaped))) + return; + + if (!strcmp(ee->driver, "software_ddraw")) return; + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI + if (!strcmp(ee->driver, "software_gdi")) + { + Evas_Engine_Info_Software_Gdi *einfo; + + einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas); + ee->shaped = shaped; + if (einfo) + { + ee->engine.win32.state.region = ee->shaped; + einfo->info.region = ee->engine.win32.state.region; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + if (ee->shaped) + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } +#endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */ + } +} + +static void +_ecore_evas_win32_show(Ecore_Evas *ee) +{ + INF("ecore evas show"); + + ee->should_be_visible = 1; + if (ee->prop.avoid_damage) + _ecore_evas_win32_render(ee); + ecore_win32_window_show((struct _Ecore_Win32_Window *)ee->prop.window); +/* if (ee->prop.fullscreen) */ +/* ecore_win32_window_focus(ee->prop.window); */ +} + +static void +_ecore_evas_win32_hide(Ecore_Evas *ee) +{ + INF("ecore evas hide"); + + ecore_win32_window_hide((struct _Ecore_Win32_Window *)ee->prop.window); + ee->should_be_visible = 0; +} + +static void +_ecore_evas_win32_raise(Ecore_Evas *ee) +{ + INF("ecore evas raise"); + + if (!ee->prop.fullscreen) + ecore_win32_window_raise((struct _Ecore_Win32_Window *)ee->prop.window); + else + ecore_win32_window_raise((struct _Ecore_Win32_Window *)ee->prop.window); +} + +static void +_ecore_evas_win32_lower(Ecore_Evas *ee) +{ + INF("ecore evas lower"); + + if (!ee->prop.fullscreen) + ecore_win32_window_lower((struct _Ecore_Win32_Window *)ee->prop.window); + else + ecore_win32_window_lower((struct _Ecore_Win32_Window *)ee->prop.window); +} + +static void +_ecore_evas_win32_activate(Ecore_Evas *ee) +{ + INF("ecore evas activate"); + + ecore_win32_window_focus_set((struct _Ecore_Win32_Window *)ee->prop.window); +} + +static void +_ecore_evas_win32_title_set(Ecore_Evas *ee, const char *title) +{ + INF("ecore evas title set"); + + if (ee->prop.title) free(ee->prop.title); + ee->prop.title = NULL; + if (title) ee->prop.title = strdup(title); + ecore_win32_window_title_set((struct _Ecore_Win32_Window *)ee->prop.window, + ee->prop.title); +} + +static void +_ecore_evas_win32_size_min_set(Ecore_Evas *ee, int width, int height) +{ + if (width < 0) width = 0; + if (height < 0) height = 0; + if ((ee->prop.min.w == width) && (ee->prop.min.h == height)) return; + ee->prop.min.w = width; + ee->prop.min.h = height; + ecore_win32_window_size_min_set((struct _Ecore_Win32_Window *)ee->prop.window, + width, height); +} + +static void +_ecore_evas_win32_size_max_set(Ecore_Evas *ee, int width, int height) +{ + if (width < 0) width = 0; + if (height < 0) height = 0; + if ((ee->prop.max.w == width) && (ee->prop.max.h == height)) return; + ee->prop.max.w = width; + ee->prop.max.h = height; + ecore_win32_window_size_max_set((struct _Ecore_Win32_Window *)ee->prop.window, + width, height); +} + +static void +_ecore_evas_win32_size_base_set(Ecore_Evas *ee, int width, int height) +{ + if (width < 0) width = 0; + if (height < 0) height = 0; + if ((ee->prop.base.w == width) && (ee->prop.base.h == height)) return; + ee->prop.base.w = width; + ee->prop.base.h = height; + ecore_win32_window_size_base_set((struct _Ecore_Win32_Window *)ee->prop.window, + width, height); +} + +static void +_ecore_evas_win32_size_step_set(Ecore_Evas *ee, int width, int height) +{ + if (width < 1) width = 1; + if (height < 1) height = 1; + if ((ee->prop.step.w == width) && (ee->prop.step.h == height)) return; + ee->prop.step.w = width; + ee->prop.step.h = height; + ecore_win32_window_size_step_set((struct _Ecore_Win32_Window *)ee->prop.window, + width, height); +} + +static void +_ecore_evas_win32_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +{ +#if 0 + int x, y; + + if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); + + if (obj == NULL) + { + ee->prop.cursor.object = NULL; + ee->prop.cursor.layer = 0; + ee->prop.cursor.hot.x = 0; + ee->prop.cursor.hot.y = 0; + ecore_win32_window_cursor_show(ee->prop.window, 1); + return; + } + + ee->prop.cursor.object = obj; + ee->prop.cursor.layer = layer; + ee->prop.cursor.hot.x = hot_x; + ee->prop.cursor.hot.y = hot_y; + + ecore_win32_window_cursor_show(ee->prop.window, 0); + + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_move(ee->prop.cursor.object, + x - ee->prop.cursor.hot.x, + y - ee->prop.cursor.hot.y); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); +#endif +} + +static void +_ecore_evas_win32_focus_set(Ecore_Evas *ee, int on __UNUSED__) +{ + ecore_win32_window_focus_set((struct _Ecore_Win32_Window *)ee->prop.window); +} + +static void +_ecore_evas_win32_iconified_set(Ecore_Evas *ee, int on) +{ +/* if (((ee->prop.borderless) && (on)) || */ +/* ((!ee->prop.borderless) && (!on))) return; */ + ee->prop.iconified = on; + ecore_win32_window_iconified_set((struct _Ecore_Win32_Window *)ee->prop.window, + ee->prop.iconified); +} + +static void +_ecore_evas_win32_borderless_set(Ecore_Evas *ee, int on) +{ + if (((ee->prop.borderless) && (on)) || + ((!ee->prop.borderless) && (!on))) return; + ee->prop.borderless = on; + ecore_win32_window_borderless_set((struct _Ecore_Win32_Window *)ee->prop.window, + ee->prop.borderless); + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI + if (!strcmp(ee->driver, "software_gdi")) + { + Evas_Engine_Info_Software_Gdi *einfo; + + einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas); + if (einfo) + { + einfo->info.borderless = ee->prop.borderless; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + if (ee->prop.borderless) + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } + } +#endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */ +} + +static void +_ecore_evas_win32_fullscreen_set(Ecore_Evas *ee, int on) +{ + struct _Ecore_Win32_Window *window; + + INF("ecore evas fullscreen set"); + + if ((ee->engine.win32.state.fullscreen && on) || + (!ee->engine.win32.state.fullscreen && !on)) + return; + + ee->engine.win32.state.fullscreen = on; + ee->prop.fullscreen = on; + + window = (struct _Ecore_Win32_Window *)ee->prop.window; + + if (on != 0) + { + ecore_win32_window_shape_set((struct _Ecore_Win32_Window *)ee->prop.window, + 0, 0, NULL); + ecore_win32_window_fullscreen_set((struct _Ecore_Win32_Window *)ee->prop.window, + on); + } + else + { + ecore_win32_window_fullscreen_set(window, on); + ecore_win32_window_shape_set(window, + window->shape.width, + window->shape.height, + window->shape.mask); + } + + /* Nothing to be done for the GDI backend at the evas level */ + +#ifdef BUILD_ECORE_EVAS_SOFTWRE_DDRAW + if (strcmp(ee->driver, "software_ddraw") == 0) + { + Evas_Engine_Info_Software_DDraw *einfo; + + einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ecore_evas_get(ee)); + if (einfo) + { + einfo->info.fullscreen = !!on; +/* einfo->info.layered = window->shape.layered; */ + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + } + } +#endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ + +#ifdef BUILD_ECORE_EVAS_DIRECT3D + if (strcmp(ee->driver, "direct3d") == 0) + { + Evas_Engine_Info_Direct3D *einfo; + + einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ecore_evas_get(ee)); + if (einfo) + { + einfo->info.fullscreen = !!on; + einfo->info.layered = window->shape.layered; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + } + } +#endif /* BUILD_ECORE_EVAS_DIRECT3D */ +} + + +static Ecore_Evas_Engine_Func _ecore_win32_engine_func = +{ + _ecore_evas_win32_free, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_win32_callback_delete_request_set, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_win32_move, + NULL, + _ecore_evas_win32_resize, + _ecore_evas_win32_move_resize, + _ecore_evas_win32_rotation_set, + _ecore_evas_win32_shaped_set, + _ecore_evas_win32_show, + _ecore_evas_win32_hide, + _ecore_evas_win32_raise, + _ecore_evas_win32_lower, + _ecore_evas_win32_activate, + _ecore_evas_win32_title_set, + NULL, /* _ecore_evas_x_name_class_set */ + _ecore_evas_win32_size_min_set, + _ecore_evas_win32_size_max_set, + _ecore_evas_win32_size_base_set, + _ecore_evas_win32_size_step_set, + _ecore_evas_win32_cursor_set, + NULL, /* _ecore_evas_x_layer_set */ + _ecore_evas_win32_focus_set, + _ecore_evas_win32_iconified_set, + _ecore_evas_win32_borderless_set, + NULL, /* _ecore_evas_x_override_set */ + NULL, + _ecore_evas_win32_fullscreen_set, + NULL, /* _ecore_evas_x_avoid_damage_set */ + NULL, /* _ecore_evas_x_withdrawn_set */ + NULL, /* _ecore_evas_x_sticky_set */ + NULL, /* _ecore_evas_x_ignore_events_set */ + NULL, /* _ecore_evas_x_alpha_set */ + NULL, //transparent + + NULL, // render + NULL //screen_geometry_get +}; + +#endif /* BUILD_ECORE_EVAS_WIN32 */ + +/* API */ + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI +static int +_ecore_evas_engine_software_gdi_init(Ecore_Evas *ee) +{ + Evas_Engine_Info_Software_Gdi *einfo; + const char *driver; + int rmethod; + + driver = "software_gdi"; + + rmethod = evas_render_method_lookup(driver); + if (!rmethod) + return 0; + + ee->driver = driver; + evas_output_method_set(ee->evas, rmethod); + + einfo = (Evas_Engine_Info_Software_Gdi *)evas_engine_info_get(ee->evas); + if (einfo) + { + /* FIXME: REDRAW_DEBUG missing for now */ + einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; + einfo->info.depth = ecore_win32_screen_depth_get(); + einfo->info.rotation = 0; + einfo->info.borderless = 0; + einfo->info.fullscreen = 0; + einfo->info.region = 0; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + return 0; + } + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + return 0; + } + + return 1; +} +#endif /* BUILD_ECORE_EVAS_SOFTWARE_GDI */ + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW +static int +_ecore_evas_engine_software_ddraw_init(Ecore_Evas *ee) +{ + Evas_Engine_Info_Software_DDraw *einfo; + const char *driver; + int rmethod; + + driver = "software_ddraw"; + + rmethod = evas_render_method_lookup(driver); + if (!rmethod) + return 0; + + ee->driver = driver; + evas_output_method_set(ee->evas, rmethod); + + einfo = (Evas_Engine_Info_Software_DDraw *)evas_engine_info_get(ee->evas); + if (einfo) + { + /* FIXME: REDRAW_DEBUG missing for now */ + einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; + einfo->info.depth = ecore_win32_screen_depth_get(); + einfo->info.rotation = 0; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + return 0; + } + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + return 0; + } + + return 1; +} +#endif /* BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ + +#ifdef BUILD_ECORE_EVAS_DIRECT3D +static int +_ecore_evas_engine_direct3d_init(Ecore_Evas *ee) +{ + Evas_Engine_Info_Direct3D *einfo; + const char *driver; + int rmethod; + + driver = "direct3d"; + + rmethod = evas_render_method_lookup(driver); + if (!rmethod) + return 0; + + ee->driver = driver; + evas_output_method_set(ee->evas, rmethod); + + einfo = (Evas_Engine_Info_Direct3D *)evas_engine_info_get(ee->evas); + if (einfo) + { + /* FIXME: REDRAW_DEBUG missing for now */ + einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; + einfo->info.depth = ecore_win32_screen_depth_get(); + einfo->info.rotation = 0; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + return 0; + } + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + return 0; + } + + return 1; +} +#endif /* BUILD_ECORE_EVAS_DIRECT3D */ + +#ifdef BUILD_ECORE_EVAS_OPENGL_GLEW +static int +_ecore_evas_engine_opengl_glew_init(Ecore_Evas *ee) +{ + Evas_Engine_Info_GL_Glew *einfo; + const char *driver; + int rmethod; + + driver = "gl_glew"; + + rmethod = evas_render_method_lookup(driver); + if (!rmethod) + return 0; + + ee->driver = driver; + evas_output_method_set(ee->evas, rmethod); + + einfo = (Evas_Engine_Info_GL_Glew *)evas_engine_info_get(ee->evas); + if (einfo) + { + /* FIXME: REDRAW_DEBUG missing for now */ + einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; + einfo->info.depth = ecore_win32_screen_depth_get(); + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + return 0; + } + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + return 0; + } + + return 1; +} +#endif /* BUILD_ECORE_EVAS_OPENGL_GLEW */ + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW +static int +_ecore_evas_engine_software_16_ddraw_init(Ecore_Evas *ee) +{ + Evas_Engine_Info_Software_DDraw *einfo; + const char *driver; + int rmethod; + + driver = "software_16_ddraw"; + + rmethod = evas_render_method_lookup(driver); + if (!rmethod) + return 0; + + ee->driver = driver; + evas_output_method_set(ee->evas, rmethod); + + if (ecore_win32_screen_depth_get() != 16) + return 0; + + einfo = (Evas_Engine_Info_Software_16_DDraw *)evas_engine_info_get(ee->evas); + if (einfo) + { + /* FIXME: REDRAW_DEBUG missing for now */ + einfo->info.window = ((struct _Ecore_Win32_Window *)ee->prop.window)->window; + einfo->info.depth = ecore_win32_screen_depth_get(); + einfo->info.rotation = 0; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + return 0; + } + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + return 0; + } + + return 1; +} +#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW */ + +#ifdef BUILD_ECORE_EVAS_WIN32 +static Ecore_Evas * +_ecore_evas_win32_new_internal(int (*_ecore_evas_engine_init)(Ecore_Evas *ee), + Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height) +{ + Ecore_Evas *ee; + + if (!ecore_win32_init()) + return NULL; + + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) + return NULL; + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + _ecore_evas_win32_init(); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_win32_engine_func; + + if (width < 1) width = 1; + if (height < 1) height = 1; + ee->x = x; + ee->y = y; + ee->w = width; + ee->h = height; + ee->req.x = ee->x; + ee->req.y = ee->y; + ee->req.w = ee->w; + ee->req.h = ee->h; + + ee->prop.max.w = 32767; + ee->prop.max.h = 32767; + ee->prop.layer = 4; + ee->prop.request_pos = 0; + ee->prop.sticky = 0; + /* FIXME: sticky to add */ + ee->prop.window = 0; + + /* init evas here */ + ee->evas = evas_new(); + evas_data_attach_set(ee->evas, ee); + evas_output_size_set(ee->evas, width, height); + evas_output_viewport_set(ee->evas, 0, 0, width, height); + + ee->engine.win32.parent = parent; + ee->prop.window = (Ecore_Window)ecore_win32_window_new(parent, x, y, width, height); + if (!ee->prop.window) + { + _ecore_evas_win32_shutdown(); + free(ee); + return NULL; + } + + if (!_ecore_evas_engine_init(ee)) + { + _ecore_evas_win32_shutdown(); + free(ee); + return NULL; + } + + ee->engine.func->fn_render = _ecore_evas_win32_render; + _ecore_evas_register(ee); + ecore_event_window_register(ee->prop.window, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + + return ee; +} + +#endif /* BUILD_ECORE_EVAS_WIN32 */ + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_GDI + +EAPI Ecore_Evas * +ecore_evas_software_gdi_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height) +{ + return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_gdi_init, + parent, + x, + y, + width, + height); +} + +#else + +EAPI Ecore_Evas * +ecore_evas_software_gdi_new(Ecore_Win32_Window *parent __UNUSED__, + int x __UNUSED__, + int y __UNUSED__, + int width __UNUSED__, + int height __UNUSED__) +{ + return NULL; +} + +#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_GDI */ + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_DDRAW + +EAPI Ecore_Evas * +ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height) +{ + return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_ddraw_init, + parent, + x, + y, + width, + height); +} + +#else + +EAPI Ecore_Evas * +ecore_evas_software_ddraw_new(Ecore_Win32_Window *parent __UNUSED__, + int x __UNUSED__, + int y __UNUSED__, + int width __UNUSED__, + int height __UNUSED__) +{ + return NULL; +} + +#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_DDRAW */ + + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW + +EAPI Ecore_Evas * +ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height) +{ + return _ecore_evas_win32_new_internal(_ecore_evas_engine_software_16_ddraw_init, + parent, + x, + y, + width, + height); +} + +#else + +EAPI Ecore_Evas * +ecore_evas_software_16_ddraw_new(Ecore_Win32_Window *parent __UNUSED__, + int x __UNUSED__, + int y __UNUSED__, + int width __UNUSED__, + int height __UNUSED__) +{ + return NULL; +} + +#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_DDRAW */ + + +#ifdef BUILD_ECORE_EVAS_DIRECT3D + +EAPI Ecore_Evas * +ecore_evas_direct3d_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height) +{ + return _ecore_evas_win32_new_internal(_ecore_evas_engine_direct3d_init, + parent, + x, + y, + width, + height); +} + +#else + +EAPI Ecore_Evas * +ecore_evas_direct3d_new(Ecore_Win32_Window *parent __UNUSED__, + int x __UNUSED__, + int y __UNUSED__, + int width __UNUSED__, + int height __UNUSED__) +{ + return NULL; +} + +#endif /* ! BUILD_ECORE_EVAS_DIRECT3D */ + + +#ifdef BUILD_ECORE_EVAS_OPENGL_GLEW + +EAPI Ecore_Evas * +ecore_evas_gl_glew_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height) +{ + return _ecore_evas_win32_new_internal(_ecore_evas_engine_opengl_glew_init, + parent, + x, + y, + width, + height); +} + +#else + +EAPI Ecore_Evas * +ecore_evas_gl_glew_new(Ecore_Win32_Window *parent __UNUSED__, + int x __UNUSED__, + int y __UNUSED__, + int width __UNUSED__, + int height __UNUSED__) +{ + return NULL; +} + +#endif /* BUILD_ECORE_EVAS_OPENGL_GLEW */ + + +#ifdef BUILD_ECORE_EVAS_WIN32 + +EAPI Ecore_Win32_Window * +ecore_evas_win32_window_get(const Ecore_Evas *ee) +{ + return (Ecore_Win32_Window *) ecore_evas_window_get(ee); +} + +#else + +EAPI Ecore_Win32_Window * +ecore_evas_win32_window_get(const Ecore_Evas *ee __UNUSED__) +{ + return NULL; +} + +#endif /* BUILD_ECORE_EVAS_WIN32 */ diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c new file mode 100644 index 0000000..e102cb7 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_wince.c @@ -0,0 +1,985 @@ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include /* for NULL */ + +#include +#include "ecore_private.h" +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE +# define WIN32_LEAN_AND_MEAN +# include +# undef WIN32_LEAN_AND_MEAN +# include +# include +#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */ + +#include "ecore_evas_private.h" +#include "Ecore_Evas.h" + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE + +#define ECORE_EVAS_EVENT_COUNT 9 + +static int _ecore_evas_init_count = 0; + +static Ecore_Event_Handler *ecore_evas_event_handlers[ECORE_EVAS_EVENT_COUNT]; + +static Eina_Bool _ecore_evas_wince_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_wince_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_wince_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_wince_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_wince_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_wince_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_wince_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_wince_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event); + +static Eina_Bool _ecore_evas_wince_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event); + +/* Private functions */ + +static int +_ecore_evas_wince_render(Ecore_Evas *ee) +{ + int rend = 0; + Eina_List *updates = NULL; + Eina_List *ll; + Ecore_Evas *ee2; + + EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) + { + if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); + if (ee2->engine.func->fn_render) + rend |= ee2->engine.func->fn_render(ee2); + if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); + } + + if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); + if (ee->prop.avoid_damage) + { + updates = evas_render_updates(ee->evas); + if (updates) evas_render_updates_free(updates); + } + else if ((ee->visible) || + ((ee->should_be_visible) && (ee->prop.fullscreen)) || + ((ee->should_be_visible) && (ee->prop.override))) + { + if (ee->shaped) + { + updates = evas_render_updates(ee->evas); + if (updates) evas_render_updates_free(updates); + } + else + { + updates = evas_render_updates(ee->evas); + if (updates) evas_render_updates_free(updates); + } + } + else + evas_norender(ee->evas); + if (updates) rend = 1; + if (ee->func.fn_post_render) ee->func.fn_post_render(ee); + return rend; +} + +static int +_ecore_evas_wince_init(void) +{ + _ecore_evas_init_count++; + if (_ecore_evas_init_count > 1) + return _ecore_evas_init_count; + + ecore_evas_event_handlers[0] = ecore_event_handler_add(ECORE_WINCE_EVENT_MOUSE_IN, _ecore_evas_wince_event_mouse_in, NULL); + ecore_evas_event_handlers[1] = ecore_event_handler_add(ECORE_WINCE_EVENT_MOUSE_OUT, _ecore_evas_wince_event_mouse_out, NULL); + ecore_evas_event_handlers[2] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_FOCUS_IN, _ecore_evas_wince_event_window_focus_in, NULL); + ecore_evas_event_handlers[3] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT, _ecore_evas_wince_event_window_focus_out, NULL); + ecore_evas_event_handlers[4] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_DAMAGE, _ecore_evas_wince_event_window_damage, NULL); + ecore_evas_event_handlers[5] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_DESTROY, _ecore_evas_wince_event_window_destroy, NULL); + ecore_evas_event_handlers[6] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_SHOW, _ecore_evas_wince_event_window_show, NULL); + ecore_evas_event_handlers[7] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_HIDE, _ecore_evas_wince_event_window_hide, NULL); + ecore_evas_event_handlers[8] = ecore_event_handler_add(ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST, _ecore_evas_wince_event_window_delete_request, NULL); + + ecore_event_evas_init(); + return _ecore_evas_init_count; +} + +int +_ecore_evas_wince_shutdown(void) +{ + _ecore_evas_init_count--; + if (_ecore_evas_init_count == 0) + { + int i; + + for (i = 0; i < ECORE_EVAS_EVENT_COUNT; i++) + ecore_event_handler_del(ecore_evas_event_handlers[i]); + ecore_event_evas_shutdown(); + } + + if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; + + return _ecore_evas_init_count; +} + +static Eina_Bool +_ecore_evas_wince_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_WinCE_Event_Mouse_In *e; + + INF("mouse in"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ + if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1; + + if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); + /* FIXME to do */ +/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ + evas_event_feed_mouse_in(ee->evas, e->time, NULL); + _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + + return 1; +} + +static Eina_Bool +_ecore_evas_wince_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_WinCE_Event_Mouse_Out *e; + + INF("mouse out"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if ((!ee) || (ee->ignore_events)) return 1; /* pass on event */ + if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1; + + /* FIXME to do */ +/* _ecore_evas_x_modifier_locks_update(ee, e->modifiers); */ + _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + + evas_event_feed_mouse_out(ee->evas, e->time, NULL); + if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); + if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); + + return 1; +} + +static Eina_Bool +_ecore_evas_wince_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_WinCE_Event_Window_Focus_In *e; + + e = event; + ee = ecore_event_window_match(e->window); + if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; + if (e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_wince_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_WinCE_Event_Window_Focus_Out *e; + + e = event; + ee = ecore_event_window_match(e->window); + if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; + if (e->window != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + + evas_focus_out(ee->evas); + ee->prop.focused = 0; + if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_wince_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_WinCE_Event_Window_Damage *e; + + INF("window damage"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if (!ee) return 1; /* pass on event */ + if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1; + + if (ee->prop.avoid_damage) + { +#warning [ECORE] [WINCE] No Region code + } + else + { + if (ee->rotation == 0) + evas_damage_rectangle_add(ee->evas, + e->x, + e->y, + e->width, + e->height); + else if (ee->rotation == 90) + evas_damage_rectangle_add(ee->evas, + ee->h - e->y - e->height, + e->x, + e->height, + e->width); + else if (ee->rotation == 180) + evas_damage_rectangle_add(ee->evas, + ee->w - e->x - e->width, + ee->h - e->y - e->height, + e->width, + e->height); + else if (ee->rotation == 270) + evas_damage_rectangle_add(ee->evas, + e->y, + ee->w - e->x - e->width, + e->height, + e->width); + } + + return 1; +} + +static Eina_Bool +_ecore_evas_wince_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_WinCE_Event_Window_Destroy *e; + + INF("window destroy"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if (!ee) return 1; /* pass on event */ + if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1; + if (ee->func.fn_destroy) ee->func.fn_destroy(ee); + ecore_evas_free(ee); + + return 1; +} + +static Eina_Bool +_ecore_evas_wince_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_WinCE_Event_Window_Show *e; + + INF("window show"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if (!ee) return 1; /* pass on event */ + if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1; + if (ee->visible) return 0; /* dont pass it on */ + ee->visible = 1; + if (ee->func.fn_show) ee->func.fn_show(ee); + + return 1; +} + +static Eina_Bool +_ecore_evas_wince_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_WinCE_Event_Window_Hide *e; + + INF("window hide"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if (!ee) return 1; /* pass on event */ + if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1; + if (!ee->visible) return 0; /* dont pass it on */ + ee->visible = 0; + if (ee->func.fn_hide) ee->func.fn_hide(ee); + + return 1; +} + +static Eina_Bool +_ecore_evas_wince_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_WinCE_Event_Window_Delete_Request *e; + + INF("window delete request"); + + e = event; + ee = ecore_event_window_match((Ecore_Window)e->window); + if (!ee) return 1; /* pass on event */ + if (e->window != (Ecore_WinCE_Window *)ee->prop.window) return 1; + if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); + + return 1; +} + + +/* Ecore_Evas interface */ + +static void +_ecore_evas_wince_free(Ecore_Evas *ee) +{ + INF("ecore evas free"); + + ecore_wince_window_free((Ecore_WinCE_Window *)ee->prop.window); + ecore_event_window_unregister(ee->prop.window); + _ecore_evas_wince_shutdown(); + ecore_wince_shutdown(); +} + +static void +_ecore_evas_wince_callback_delete_request_set(Ecore_Evas *ee, + void (*func) (Ecore_Evas *ee)) +{ + ee->func.fn_delete_request = func; +} + +static void +_ecore_evas_wince_move(Ecore_Evas *ee, int x, int y) +{ + INF("ecore evas move (%dx%d)", x, y); + ee->req.x = x; + ee->req.y = y; + + if ((x != ee->x) || (y != ee->y)) + { + ee->x = x; + ee->y = y; + ecore_wince_window_move((Ecore_WinCE_Window *)ee->prop.window, x, y); + if (ee->func.fn_move) ee->func.fn_move(ee); + } +} + +static void +_ecore_evas_wince_resize(Ecore_Evas *ee, int width, int height) +{ + INF("ecore evas resize (%dx%d)", width, height); + ee->req.w = width; + ee->req.h = height; + + if ((ee->w != width) || (ee->h != height)) + { + ee->w = width; + ee->h = height; + ecore_wince_window_resize((Ecore_WinCE_Window *)ee->prop.window, width, height); + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + } + else + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } + /* FIXME: damage and shape */ + + if (ee->func.fn_resize) ee->func.fn_resize(ee); + } +} + +static void +_ecore_evas_wince_move_resize(Ecore_Evas *ee, int x, int y, int width, int height) +{ + INF("ecore evas resize (%dx%d %dx%d)", x, y, width, height); + ee->req.x = x; + ee->req.y = y; + ee->req.w = width; + ee->req.h = height; + + if ((ee->w != width) || (ee->h != height) || (x != ee->x) || (y != ee->y)) + { + int change_size = 0; + int change_pos = 0; + + if ((ee->w != width) || (ee->h != height)) change_size = 1; + if ((x != ee->x) || (y != ee->y)) change_pos = 1; + + ee->x = x; + ee->y = y; + ee->w = width; + ee->h = height; + ecore_wince_window_move_resize((Ecore_WinCE_Window *)ee->prop.window, x, y, width, height); + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + } + else + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } + /* FIXME: damage and shape */ + if (change_pos) + { + if (ee->func.fn_move) ee->func.fn_move(ee); + } + if (change_size) + { + if (ee->func.fn_resize) ee->func.fn_resize(ee); + } + } +} + +/* static void */ +/* _ecore_evas_wince_rotation_set(Ecore_Evas *ee, int rotation) */ +/* { */ +/* int rot_dif; */ + +/* if (ee->rotation == rotation) return; */ +/* rot_dif = ee->rotation - rotation; */ +/* if (rot_dif < 0) rot_dif = -rot_dif; */ +/* if (!strcmp(ee->driver, "software_ddraw")) */ +/* { */ +/* Evas_Engine_Info_Software_16_WinCE *einfo; */ + +/* einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ee->evas); */ +/* if (!einfo) return; */ +/* if (rot_dif != 180) */ +/* { */ +/* int minw, minh, maxw, maxh, basew, baseh, stepw, steph; */ + +/* einfo->info.rotation = rotation; */ +/* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */ +/* if (!ee->prop.fullscreen) */ +/* { */ +/* ecore_wince_window_resize(ee->prop.window, ee->h, ee->w); */ +/* ee->expecting_resize.w = ee->h; */ +/* ee->expecting_resize.h = ee->w; */ +/* } */ +/* else */ +/* { */ +/* int w, h; */ + +/* ecore_wince_window_size_get(ee->prop.window, &w, &h); */ +/* ecore_wince_window_resize(ee->prop.window, h, w); */ +/* if ((rotation == 0) || (rotation == 180)) */ +/* { */ +/* evas_output_size_set(ee->evas, ee->w, ee->h); */ +/* evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); */ +/* } */ +/* else */ +/* { */ +/* evas_output_size_set(ee->evas, ee->h, ee->w); */ +/* evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); */ +/* } */ +/* if (ee->func.fn_resize) ee->func.fn_resize(ee); */ +/* } */ +/* ecore_evas_size_min_get(ee, &minw, &minh); */ +/* ecore_evas_size_max_get(ee, &maxw, &maxh); */ +/* ecore_evas_size_base_get(ee, &basew, &baseh); */ +/* ecore_evas_size_step_get(ee, &stepw, &steph); */ +/* ee->rotation = rotation; */ +/* ecore_evas_size_min_set(ee, minh, minw); */ +/* ecore_evas_size_max_set(ee, maxh, maxw); */ +/* ecore_evas_size_base_set(ee, baseh, basew); */ +/* ecore_evas_size_step_set(ee, steph, stepw); */ +/* _ecore_evas_wince_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, */ +/* ecore_wince_current_time_get()); */ +/* } */ +/* else */ +/* { */ +/* einfo->info.rotation = rotation; */ +/* evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); */ +/* ee->rotation = rotation; */ +/* _ecore_evas_wince_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, */ +/* ecore_wince_current_time_get()); */ +/* if (ee->func.fn_resize) ee->func.fn_resize(ee); */ +/* } */ +/* if ((ee->rotation == 90) || (ee->rotation == 270)) */ +/* evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); */ +/* else */ +/* evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); */ +/* } */ +/* } */ + +static void +_ecore_evas_wince_show(Ecore_Evas *ee) +{ + INF("ecore evas show"); + + ee->should_be_visible = 1; + if (ee->prop.avoid_damage) + _ecore_evas_wince_render(ee); + ecore_wince_window_show((Ecore_WinCE_Window *)ee->prop.window); +/* if (ee->prop.fullscreen) */ +/* ecore_wince_window_focus(ee->prop.window); */ +} + +static void +_ecore_evas_wince_hide(Ecore_Evas *ee) +{ + INF("ecore evas hide"); + + ecore_wince_window_hide((Ecore_WinCE_Window *)ee->prop.window); + ee->should_be_visible = 0; +} + +/* static void */ +/* _ecore_evas_wince_raise(Ecore_Evas *ee) */ +/* { */ +/* if (!ee->prop.fullscreen) */ +/* ecore_wince_window_raise(ee->prop.window); */ +/* else */ +/* ecore_wince_window_raise(ee->prop.window); */ +/* } */ + +/* static void */ +/* _ecore_evas_wince_lower(Ecore_Evas *ee) */ +/* { */ +/* if (!ee->prop.fullscreen) */ +/* ecore_wince_window_lower(ee->prop.window); */ +/* else */ +/* ecore_wince_window_lower(ee->prop.window); */ +/* } */ + +static void +_ecore_evas_wince_title_set(Ecore_Evas *ee, const char *title) +{ + INF("ecore evas title set"); + + if (ee->prop.title) free(ee->prop.title); + ee->prop.title = NULL; + if (title) ee->prop.title = strdup(title); + ecore_wince_window_title_set((Ecore_WinCE_Window *)ee->prop.window, ee->prop.title); +} + +/* static void */ +/* _ecore_evas_wince_size_min_set(Ecore_Evas *ee, int width, int height) */ +/* { */ +/* if (width < 0) width = 0; */ +/* if (height < 0) height = 0; */ +/* if ((ee->prop.min.w == width) && (ee->prop.min.h == height)) return; */ +/* ee->prop.min.w = width; */ +/* ee->prop.min.h = height; */ +/* ecore_wince_window_size_min_set(ee->prop.window, width, height); */ +/* } */ + +/* static void */ +/* _ecore_evas_wince_size_max_set(Ecore_Evas *ee, int width, int height) */ +/* { */ +/* if (width < 0) width = 0; */ +/* if (height < 0) height = 0; */ +/* if ((ee->prop.max.w == width) && (ee->prop.max.h == height)) return; */ +/* ee->prop.max.w = width; */ +/* ee->prop.max.h = height; */ +/* ecore_wince_window_size_max_set(ee->prop.window, width, height); */ +/* } */ + +/* static void */ +/* _ecore_evas_wince_size_base_set(Ecore_Evas *ee, int width, int height) */ +/* { */ +/* if (width < 0) width = 0; */ +/* if (height < 0) height = 0; */ +/* if ((ee->prop.base.w == width) && (ee->prop.base.h == height)) return; */ +/* ee->prop.base.w = width; */ +/* ee->prop.base.h = height; */ +/* ecore_wince_window_size_base_set(ee->prop.window, width, height); */ +/* } */ + +/* static void */ +/* _ecore_evas_wince_size_step_set(Ecore_Evas *ee, int width, int height) */ +/* { */ +/* if (width < 1) width = 1; */ +/* if (height < 1) height = 1; */ +/* if ((ee->prop.step.w == width) && (ee->prop.step.h == height)) return; */ +/* ee->prop.step.w = width; */ +/* ee->prop.step.h = height; */ +/* ecore_wince_window_size_step_set(ee->prop.window, width, height); */ +/* } */ + +static void +_ecore_evas_wince_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +{ +#if 0 + int x, y; + + if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); + + if (obj == NULL) + { + ee->prop.cursor.object = NULL; + ee->prop.cursor.layer = 0; + ee->prop.cursor.hot.x = 0; + ee->prop.cursor.hot.y = 0; + ecore_wince_window_cursor_show(ee->prop.window, 1); + return; + } + + ee->prop.cursor.object = obj; + ee->prop.cursor.layer = layer; + ee->prop.cursor.hot.x = hot_x; + ee->prop.cursor.hot.y = hot_y; + + ecore_wince_window_cursor_show(ee->prop.window, 0); + + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_move(ee->prop.cursor.object, + x - ee->prop.cursor.hot.x, + y - ee->prop.cursor.hot.y); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); +#endif +} + +/* static void */ +/* _ecore_evas_wince_focus_set(Ecore_Evas *ee, int on __UNUSED__) */ +/* { */ +/* ecore_wince_window_focus_set(ee->prop.window); */ +/* } */ + +/* static void */ +/* _ecore_evas_wince_iconified_set(Ecore_Evas *ee, int on) */ +/* { */ +/* /\* if (((ee->prop.borderless) && (on)) || *\/ */ +/* /\* ((!ee->prop.borderless) && (!on))) return; *\/ */ +/* ee->prop.iconified = on; */ +/* ecore_wince_window_iconified_set(ee->prop.window, ee->prop.iconified); */ +/* } */ + +/* static void */ +/* _ecore_evas_wince_borderless_set(Ecore_Evas *ee, int on) */ +/* { */ +/* if (((ee->prop.borderless) && (on)) || */ +/* ((!ee->prop.borderless) && (!on))) return; */ +/* ee->prop.borderless = on; */ +/* ecore_wince_window_borderless_set(ee->prop.window, ee->prop.borderless); */ +/* } */ + +static void +_ecore_evas_wince_fullscreen_set(Ecore_Evas *ee, int on) +{ + Evas_Engine_Info_Software_16_WinCE *einfo; + struct _Ecore_WinCE_Window *window; + + INF("ecore evas fullscreen set"); + + if ((ee->engine.wince.state.fullscreen && on) || + (!ee->engine.wince.state.fullscreen && !on)) + return; + + ee->engine.wince.state.fullscreen = on; + ee->prop.fullscreen = on; + + window = (struct _Ecore_WinCE_Window *)ee->prop.window; + + if (on != 0) + { +/* ecore_win32_window_shape_set(ee->engine.win32.window, 0, 0, NULL); */ + ecore_wince_window_fullscreen_set((Ecore_WinCE_Window *)ee->prop.window, on); + ee->w = GetSystemMetrics(SM_CXSCREEN); + ee->h = GetSystemMetrics(SM_CYSCREEN); + ee->req.w = ee->w; + ee->req.h = ee->h; + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } + else + { + int w; + int h; + + ecore_wince_window_fullscreen_set((Ecore_WinCE_Window *)ee->prop.window, on); + ecore_wince_window_size_get((Ecore_WinCE_Window *)ee->prop.window, &w, &h); + ee->w = w; + ee->h = h; + ee->req.w = ee->w; + ee->req.h = ee->h; + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); +/* ecore_win32_window_shape_set(window, */ +/* window->shape.width, */ +/* window->shape.height, */ +/* window->shape.mask); */ + } + + einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ecore_evas_get(ee)); + if (einfo) + { + einfo->info.fullscreen = !!on; +/* einfo->info.layered = window->shape.layered; */ + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + } +} + +static Ecore_Evas_Engine_Func _ecore_wince_engine_func = +{ + _ecore_evas_wince_free, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_wince_callback_delete_request_set, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_wince_move, + NULL, + _ecore_evas_wince_resize, + _ecore_evas_wince_move_resize, + NULL, //_ecore_evas_wince_rotation_set, + NULL, /* _ecore_evas_x_shaped_set */ + _ecore_evas_wince_show, + _ecore_evas_wince_hide, + NULL, //_ecore_evas_wince_raise, + NULL, //_ecore_evas_wince_lower, + NULL, //_ecore_evas_wince_activate, + _ecore_evas_wince_title_set, + NULL, /* _ecore_evas_x_name_class_set */ + NULL, //_ecore_evas_wince_size_min_set, + NULL, //_ecore_evas_wince_size_max_set, + NULL, //_ecore_evas_wince_size_base_set, + NULL, //_ecore_evas_wince_size_step_set, + _ecore_evas_wince_cursor_set, + NULL, /* _ecore_evas_x_layer_set */ + NULL, //_ecore_evas_wince_focus_set, + NULL, //_ecore_evas_wince_iconified_set, + NULL, //_ecore_evas_wince_borderless_set, + NULL, /* _ecore_evas_x_override_set */ + NULL, + _ecore_evas_wince_fullscreen_set, + NULL, /* _ecore_evas_x_avoid_damage_set */ + NULL, /* _ecore_evas_x_withdrawn_set */ + NULL, /* _ecore_evas_x_sticky_set */ + NULL, /* _ecore_evas_x_ignore_events_set */ + NULL, /* _ecore_evas_x_alpha_set */ + NULL, //transparent + + NULL, // render + NULL // screen_geometry_get +}; + +/* API */ + +static Ecore_Evas * +ecore_evas_software_wince_new_internal(int backend, + Ecore_WinCE_Window *parent, + int x, + int y, + int width, + int height, + int fullscreen) +{ + Evas_Engine_Info_Software_16_WinCE *einfo; + Ecore_Evas *ee; + int rmethod; + + rmethod = evas_render_method_lookup("software_16_wince"); + if (!rmethod) + return NULL; + + if (!ecore_wince_init()) + return NULL; + + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) + { + ecore_wince_shutdown(); + return NULL; + } + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + if (!_ecore_evas_wince_init()) + { + free(ee); + ecore_wince_shutdown(); + return NULL; + } + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_wince_engine_func; + + ee->driver = "software_16_wince"; + + if (width < 1) width = 1; + if (height < 1) height = 1; + ee->x = x; + ee->y = y; + ee->w = width; + ee->h = height; + ee->req.x = ee->x; + ee->req.y = ee->y; + ee->req.w = ee->w; + ee->req.h = ee->h; + + ee->prop.max.w = 32767; + ee->prop.max.h = 32767; + ee->prop.layer = 4; + ee->prop.request_pos = 0; + ee->prop.sticky = 0; + /* FIXME: sticky to add */ + + ee->prop.window = (Ecore_Window)ecore_wince_window_new((Ecore_WinCE_Window *)parent, x, y, width, height); + if (!ee->prop.window) + { + _ecore_evas_wince_shutdown(); + free(ee); + ecore_wince_shutdown(); + return NULL; + } + + ecore_wince_window_fullscreen_set((Ecore_WinCE_Window *)ee->prop.window, fullscreen); + + /* init evas here */ + ee->evas = evas_new(); + evas_data_attach_set(ee->evas, ee); + evas_output_method_set(ee->evas, rmethod); + evas_output_size_set(ee->evas, width, height); + evas_output_viewport_set(ee->evas, 0, 0, width, height); + + einfo = (Evas_Engine_Info_Software_16_WinCE *)evas_engine_info_get(ee->evas); + if (einfo) + { + /* FIXME: REDRAW_DEBUG missing for now */ + einfo->info.window = ((struct _Ecore_WinCE_Window *)ee->prop.window)->window; + einfo->info.width = width; + einfo->info.height = height; + einfo->info.backend = backend; + einfo->info.rotation = 0; + einfo->info.fullscreen = fullscreen; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + _ecore_evas_wince_shutdown(); + free(ee); + ecore_wince_shutdown(); + return NULL; + } + + ecore_wince_window_backend_set((Ecore_WinCE_Window *)ee->prop.window, backend); + ecore_wince_window_suspend_cb_set((Ecore_WinCE_Window *)ee->prop.window, einfo->func.suspend); + ecore_wince_window_resume_cb_set((Ecore_WinCE_Window *)ee->prop.window, einfo->func.resume); + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + _ecore_evas_wince_shutdown(); + free(ee); + ecore_wince_shutdown(); + return NULL; + } + + ee->engine.func->fn_render = _ecore_evas_wince_render; + _ecore_evas_register(ee); + ecore_event_window_register(ee->prop.window, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + evas_focus_in(ee->evas); + + return ee; +} + +#else + +static Ecore_Evas * +ecore_evas_software_wince_new_internal(int backend __UNUSED__, + Ecore_WinCE_Window *parent __UNUSED__, + int x __UNUSED__, + int y __UNUSED__, + int width __UNUSED__, + int height __UNUSED__, + int fullscreen __UNUSED__) +{ + return NULL; +} + +#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */ + + +EAPI Ecore_Evas * +ecore_evas_software_wince_new(Ecore_WinCE_Window *parent, + int x, + int y, + int width, + int height) +{ + return ecore_evas_software_wince_new_internal(0, parent, x, y, width, height, 1); +} + +EAPI Ecore_Evas * +ecore_evas_software_wince_fb_new(Ecore_WinCE_Window *parent, + int x, + int y, + int width, + int height) +{ + return ecore_evas_software_wince_new_internal(1, parent, x, y, width, height, 1); +} + +EAPI Ecore_Evas * +ecore_evas_software_wince_gapi_new(Ecore_WinCE_Window *parent, + int x, + int y, + int width, + int height) +{ + return ecore_evas_software_wince_new_internal(2, parent, x, y, width, height, 1); +} + +EAPI Ecore_Evas * +ecore_evas_software_wince_ddraw_new(Ecore_WinCE_Window *parent, + int x, + int y, + int width, + int height) +{ + return ecore_evas_software_wince_new_internal(3, parent, x, y, width, height, 1); +} + +EAPI Ecore_Evas * +ecore_evas_software_wince_gdi_new(Ecore_WinCE_Window *parent, + int x, + int y, + int width, + int height) +{ + return ecore_evas_software_wince_new_internal(4, parent, x, y, width, height, 0); +} + +#ifdef BUILD_ECORE_EVAS_SOFTWARE_16_WINCE + +EAPI Ecore_WinCE_Window * +ecore_evas_software_wince_window_get(const Ecore_Evas *ee) +{ + return (Ecore_WinCE_Window *) ecore_evas_window_get(ee); +} + +#else + +EAPI Ecore_WinCE_Window * +ecore_evas_software_wince_window_get(const Ecore_Evas *ee __UNUSED__) +{ + return NULL; +} + +#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_WINCE */ diff --git a/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c b/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c new file mode 100644 index 0000000..d9ccd6e --- /dev/null +++ b/libraries/ecore/src/lib/ecore_evas/ecore_evas_x.c @@ -0,0 +1,4289 @@ +#include +#include "ecore_evas_private.h" +#include "Ecore_Evas.h" + +#ifdef BUILD_ECORE_EVAS_X11 +static int _ecore_evas_init_count = 0; + +static Ecore_Event_Handler *ecore_evas_event_handlers[13]; + +static int leader_ref = 0; +static Ecore_X_Window leader_win = 0; + +static void +_ecore_evas_x_group_leader_set(Ecore_Evas *ee) +{ + leader_ref++; + if (leader_ref == 1) + { + char *id = NULL; + + leader_win = + ecore_x_window_override_new(ee->engine.x.win_root, 1234, 5678, 1, 2); + ecore_x_window_defaults_set(leader_win); + if ((id = getenv("DESKTOP_STARTUP_ID"))) + ecore_x_netwm_startup_id_set(leader_win,id); + ecore_x_icccm_client_leader_set(leader_win, leader_win); + } + ee->engine.x.leader = leader_win; + ecore_x_icccm_client_leader_set(ee->prop.window, leader_win); +} + +static void +_ecore_evas_x_group_leader_unset(Ecore_Evas *ee) +{ + ecore_x_window_prop_property_del(ee->prop.window, + ECORE_X_ATOM_WM_CLIENT_LEADER); + if (ee->engine.x.leader == leader_win) + { + leader_ref--; + if (leader_ref <= 0) + { + ecore_x_window_free(leader_win); + leader_win = 0; + } + ee->engine.x.leader = 0; + } +} + +static void +_ecore_evas_x_group_leader_update(Ecore_Evas *ee) +{ + if (ee->engine.x.leader) + ecore_x_icccm_client_leader_set(ee->prop.window, ee->engine.x.leader); +} + +static void +_ecore_evas_x_protocols_set(Ecore_Evas *ee) +{ + Ecore_X_Atom protos[3]; + unsigned int num = 0, tmp = 0; + + if (ee->func.fn_delete_request) + protos[num++] = ECORE_X_ATOM_WM_DELETE_WINDOW; + protos[num++] = ECORE_X_ATOM_NET_WM_PING; + protos[num++] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST; + ecore_x_icccm_protocol_atoms_set(ee->prop.window, protos, num); + + if (!ee->engine.x.netwm_sync_counter) + ee->engine.x.netwm_sync_counter = ecore_x_sync_counter_new(0); + + tmp = ee->engine.x.netwm_sync_counter; + ecore_x_window_prop_card32_set(ee->prop.window, + ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER, + &tmp, 1); +} + +static void +_ecore_evas_x_sync_set(Ecore_Evas *ee) +{ + if (((ee->should_be_visible) || (ee->visible)) && + ((ecore_x_e_comp_sync_supported_get(ee->engine.x.win_root)) && + (!ee->no_comp_sync) && (_ecore_evas_app_comp_sync))) + { + if (!ee->engine.x.sync_counter) + ee->engine.x.sync_counter = ecore_x_sync_counter_new(0); + } + else + { + if (ee->engine.x.sync_counter) + ecore_x_sync_counter_free(ee->engine.x.sync_counter); + ee->engine.x.sync_counter = 0; + } + ecore_x_e_comp_sync_counter_set(ee->prop.window, ee->engine.x.sync_counter); +} + +static void +_ecore_evas_x_sync_clear(Ecore_Evas *ee) +{ + if (!ee->engine.x.sync_counter) return; + ecore_x_sync_counter_free(ee->engine.x.sync_counter); + ee->engine.x.sync_counter = 0; +} + +# ifdef BUILD_ECORE_EVAS_OPENGL_X11 +static Ecore_X_Window +_ecore_evas_x_gl_window_new(Ecore_Evas *ee, Ecore_X_Window parent, int x, int y, int w, int h, int override, int argb, const int *opt) +{ + Evas_Engine_Info_GL_X11 *einfo; + Ecore_X_Window win; + + einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); + if (einfo) + { + int screen; + + if (opt) + { + int op; + + for (op = 0; opt[op]; op++) + { + if (opt[op] == ECORE_EVAS_GL_X11_OPT_INDIRECT) + { + op++; + einfo->indirect = opt[op]; + } + else if (opt[op] == ECORE_EVAS_GL_X11_OPT_VSYNC) + { + op++; + einfo->vsync = opt[op]; + } + } + } + + /* FIXME: this is inefficient as its 1 or more round trips */ + screen = ecore_x_screen_index_get(ecore_x_default_screen_get()); + if (ecore_x_screen_count_get() > 1) + { + Ecore_X_Window *roots; + int num, i; + + num = 0; + roots = ecore_x_window_root_list(&num); + if (roots) + { + Ecore_X_Window root; + + root = ecore_x_window_root_get(parent); + for (i = 0; i < num; i++) + { + if (root == roots[i]) + { + screen = i; + break; + } + } + free(roots); + } + } + + einfo->info.display = ecore_x_display_get(); + einfo->info.screen = screen; + + einfo->info.destination_alpha = argb; + + einfo->info.visual = einfo->func.best_visual_get(einfo); + einfo->info.colormap = einfo->func.best_colormap_get(einfo); + einfo->info.depth = einfo->func.best_depth_get(einfo); + + if ((!einfo->info.visual) || + (!einfo->info.colormap) || (!einfo->info.depth)) + { + WRN("OpenGL X11 init engine '%s' failed - no visual, colormap or depth.", ee->driver); + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + return 0; + } + } + + if (argb) + { + if (override) + win = ecore_x_window_override_argb_new(parent, x, y, w, h); + else + win = ecore_x_window_argb_new(parent, x, y, w, h); + } + else + { + if (override) + win = ecore_x_window_override_new(parent, x, y, w, h); + else + win = ecore_x_window_new(parent, x, y, w, h); + } + + ecore_x_window_pixel_gravity_set(win, ECORE_X_GRAVITY_FORGET); + + /* attr.backing_store = NotUseful; */ + /* attr.override_redirect = override; */ + /* attr.colormap = einfo->info.colormap; */ + /* attr.border_pixel = 0; */ + /* attr.background_pixmap = None; */ + /* attr.event_mask = */ + /* KeyPressMask | KeyReleaseMask | */ + /* ExposureMask | ButtonPressMask | ButtonReleaseMask | */ + /* EnterWindowMask | LeaveWindowMask | */ + /* PointerMotionMask | StructureNotifyMask | VisibilityChangeMask | */ + /* FocusChangeMask | PropertyChangeMask | ColormapChangeMask; */ + /* attr.bit_gravity = ForgetGravity; */ + + /* win = */ + /* XCreateWindow(einfo->info.display, parent, x, y, w, h, 0, */ + /* einfo->info.depth, InputOutput, einfo->info.visual, */ + /* CWBackingStore | CWColormap | CWBackPixmap | */ + /* CWBorderPixel | CWBitGravity | CWEventMask | */ + /* CWOverrideRedirect, &attr); */ + + einfo->info.drawable = win; + + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + ecore_x_window_free(win); + return 0; + } + } + else + win = 0; + + return win; +} +#endif + +static int +_ecore_evas_x_render(Ecore_Evas *ee) +{ + int rend = 0; + Eina_List *updates = NULL; + Eina_List *ll; + Ecore_Evas *ee2; + + if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync) && + (ee->engine.x.sync_counter) && (!ee->engine.x.sync_began) && + (!ee->engine.x.sync_cancel)) + return 0; + + EINA_LIST_FOREACH(ee->sub_ecore_evas, ll, ee2) + { + if (ee2->func.fn_pre_render) ee2->func.fn_pre_render(ee2); + if (ee2->engine.func->fn_render) + rend |= ee2->engine.func->fn_render(ee2); + if (ee2->func.fn_post_render) ee2->func.fn_post_render(ee2); + } + + if (ee->func.fn_pre_render) ee->func.fn_pre_render(ee); + updates = evas_render_updates(ee->evas); + if (ee->prop.avoid_damage) + { + if (ee->engine.x.using_bg_pixmap) + { + if (updates) + { + Eina_List *l = NULL; + Eina_Rectangle *r; + + EINA_LIST_FOREACH(updates, l, r) + ecore_x_window_area_clear(ee->prop.window, + r->x, r->y, r->w, r->h); + if (ee->shaped) + { +#ifdef EVAS_FRAME_QUEUING + evas_sync(ee->evas); +#endif + ecore_x_window_shape_mask_set(ee->prop.window, + ee->engine.x.mask); + } + if (ee->alpha) + { +#ifdef EVAS_FRAME_QUEUING + /* wait until ee->engine.x.mask being updated */ +// evas_sync(ee->evas); +#endif +// ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask); + } + evas_render_updates_free(updates); + _ecore_evas_idle_timeout_update(ee); + rend = 1; + } + } + else + { + if (updates) + { + Eina_List *l = NULL; + Eina_Rectangle *r; + + EINA_LIST_FOREACH(updates, l, r) + { + Ecore_X_Rectangle rect; + Ecore_X_XRegion *tmpr; + + if (!ee->engine.x.damages) + ee->engine.x.damages = ecore_x_xregion_new(); + tmpr = ecore_x_xregion_new(); + if (ee->rotation == 0) + { + rect.x = r->x; + rect.y = r->y; + rect.width = r->w; + rect.height = r->h; + } + else if (ee->rotation == 90) + { + rect.x = r->y; + rect.y = ee->h - r->x - r->w; + rect.width = r->h; + rect.height = r->w; + } + else if (ee->rotation == 180) + { + rect.x = ee->w - r->x - r->w; + rect.y = ee->h - r->y - r->h; + rect.width = r->w; + rect.height = r->h; + } + else if (ee->rotation == 270) + { + rect.x = ee->w - r->y - r->h; + rect.y = r->x; + rect.width = r->h; + rect.height = r->w; + } + ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, + &rect); + ecore_x_xregion_free(ee->engine.x.damages); + ee->engine.x.damages = tmpr; + } + if (ee->engine.x.damages) + { + /* if we have a damage pixmap - we can avoid exposures by + * disabling them just for setting the mask */ + ecore_x_event_mask_set(ee->prop.window, + ECORE_X_EVENT_MASK_KEY_DOWN | + ECORE_X_EVENT_MASK_KEY_UP | + ECORE_X_EVENT_MASK_MOUSE_DOWN | + ECORE_X_EVENT_MASK_MOUSE_UP | + ECORE_X_EVENT_MASK_MOUSE_IN | + ECORE_X_EVENT_MASK_MOUSE_OUT | + ECORE_X_EVENT_MASK_MOUSE_MOVE | + // ECORE_X_EVENT_MASK_WINDOW_DAMAGE | + ECORE_X_EVENT_MASK_WINDOW_VISIBILITY | + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE | + ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE | + ECORE_X_EVENT_MASK_WINDOW_PROPERTY | + ECORE_X_EVENT_MASK_WINDOW_COLORMAP + ); + if (ee->shaped) + ecore_x_window_shape_mask_set(ee->prop.window, + ee->engine.x.mask); + /* and re-enable them again */ + ecore_x_event_mask_set(ee->prop.window, + ECORE_X_EVENT_MASK_KEY_DOWN | + ECORE_X_EVENT_MASK_KEY_UP | + ECORE_X_EVENT_MASK_MOUSE_DOWN | + ECORE_X_EVENT_MASK_MOUSE_UP | + ECORE_X_EVENT_MASK_MOUSE_IN | + ECORE_X_EVENT_MASK_MOUSE_OUT | + ECORE_X_EVENT_MASK_MOUSE_MOVE | + ECORE_X_EVENT_MASK_WINDOW_DAMAGE | + ECORE_X_EVENT_MASK_WINDOW_VISIBILITY | + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE | + ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE | + ECORE_X_EVENT_MASK_WINDOW_PROPERTY | + ECORE_X_EVENT_MASK_WINDOW_COLORMAP + ); + ecore_x_xregion_set(ee->engine.x.damages, ee->engine.x.gc); + ecore_x_pixmap_paste(ee->engine.x.pmap, ee->prop.window, + ee->engine.x.gc, 0, 0, ee->w, ee->h, + 0, 0); + ecore_x_xregion_free(ee->engine.x.damages); + ee->engine.x.damages = NULL; + } + evas_render_updates_free(updates); + _ecore_evas_idle_timeout_update(ee); + rend = 1; + } + } + } + else if (((ee->visible) && (ee->draw_ok)) || + ((ee->should_be_visible) && (ee->prop.fullscreen)) || + ((ee->should_be_visible) && (ee->prop.override))) + { + if (updates) + { + if (ee->shaped) + { +#ifdef EVAS_FRAME_QUEUING + evas_sync(ee->evas); +#endif + ecore_x_window_shape_mask_set(ee->prop.window, + ee->engine.x.mask); + } + if (ee->alpha) + { +#ifdef EVAS_FRAME_QUEUING + /* wait until ee->engine.x.mask being updated */ +// evas_sync(ee->evas); +#endif +// ecore_x_window_shape_input_mask_set(ee->prop.window, ee->engine.x.mask); + } + evas_render_updates_free(updates); + _ecore_evas_idle_timeout_update(ee); + rend = 1; + } + } + else + evas_norender(ee->evas); + if (ee->func.fn_post_render) ee->func.fn_post_render(ee); +/* + if (rend) + { + static int frames = 0; + static double t0 = 0.0; + double t, td; + + t = ecore_time_get(); + frames++; + if ((t - t0) > 1.0) + { + td = t - t0; + printf("FPS: %3.3f\n", (double)frames / td); + frames = 0; + t0 = t; + } + } + */ + + return rend; +} + +static void +_ecore_evas_x_resize_shape(Ecore_Evas *ee) +{ + if (!strcmp(ee->driver, "software_x11")) + { +#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 + Evas_Engine_Info_Software_X11 *einfo; + + einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); + if (einfo) + { + unsigned int foreground; + Ecore_X_GC gc; + + if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); + foreground = 0; + gc = ecore_x_gc_new(ee->engine.x.mask, + ECORE_X_GC_VALUE_MASK_FOREGROUND, + &foreground); + ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, + 0, 0, ee->w, ee->h); + ecore_x_gc_free(gc); + einfo->info.mask = ee->engine.x.mask; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } +#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ + } + else if (!strcmp(ee->driver, "software_16_x11")) + { +#if BUILD_ECORE_EVAS_SOFTWARE_16_X11 +# if 0 /* XXX no shaped window support for software_16_x11 */ + Evas_Engine_Info_Software_16_X11 *einfo; + + einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); + if (einfo) + { + if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); + einfo->info.mask = ee->engine.x.mask; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } +# endif /* XXX no shaped window support for software_16_x11 */ +#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ + } + if (!strcmp(ee->driver, "software_8_x11")) + { +#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) + Evas_Engine_Info_Software_8_X11 *einfo; + + einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); + if (einfo) + { + unsigned int foreground; + Ecore_X_GC gc; + + if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); + foreground = 0; + gc = ecore_x_gc_new(ee->engine.x.mask, + ECORE_X_GC_VALUE_MASK_FOREGROUND, + &foreground); + ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, + 0, 0, ee->w, ee->h); + ecore_x_gc_free(gc); + einfo->info.mask = ee->engine.x.mask; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } +#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ + } +} + +/* TODO: we need to make this work for all the states, not just sticky */ +static Eina_Bool +_ecore_evas_x_event_property_change(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_X_Event_Window_Property *e; + + e = event; + ee = ecore_event_window_match(e->win); + if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (e->atom == ECORE_X_ATOM_NET_WM_STATE) + { + unsigned int i, num; + Ecore_X_Window_State *state; + int sticky = 0; + + /* TODO: we need to move those to the end, with if statements */ + ee->engine.x.state.modal = 0; + ee->engine.x.state.maximized_v = 0; + ee->engine.x.state.maximized_h = 0; + ee->engine.x.state.shaded = 0; + ee->engine.x.state.skip_taskbar = 0; + ee->engine.x.state.skip_pager = 0; + ee->prop.fullscreen = 0; + ee->engine.x.state.fullscreen = 0; + ee->engine.x.state.above = 0; + ee->engine.x.state.below = 0; + + ecore_x_netwm_window_state_get(e->win, &state, &num); + if (state) + { + for (i = 0; i < num; i++) + { + switch (state[i]) + { + case ECORE_X_WINDOW_STATE_MODAL: + ee->engine.x.state.modal = 1; + break; + case ECORE_X_WINDOW_STATE_STICKY: + if (ee->prop.sticky && ee->engine.x.state.sticky) + break; + + sticky = 1; + ee->prop.sticky = 1; + ee->engine.x.state.sticky = 1; + if (ee->func.fn_sticky) ee->func.fn_sticky(ee); + break; + case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT: + ee->engine.x.state.maximized_v = 1; + break; + case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ: + ee->engine.x.state.maximized_h = 1; + break; + case ECORE_X_WINDOW_STATE_SHADED: + ee->engine.x.state.shaded = 1; + break; + case ECORE_X_WINDOW_STATE_SKIP_TASKBAR: + ee->engine.x.state.skip_taskbar = 1; + break; + case ECORE_X_WINDOW_STATE_SKIP_PAGER: + ee->engine.x.state.skip_pager = 1; + break; + case ECORE_X_WINDOW_STATE_FULLSCREEN: + ee->prop.fullscreen = 1; + ee->engine.x.state.fullscreen = 1; + break; + case ECORE_X_WINDOW_STATE_ABOVE: + ee->engine.x.state.above = 1; + break; + case ECORE_X_WINDOW_STATE_BELOW: + ee->engine.x.state.below = 1; + break; + default: + break; + } + } + free(state); + } + + if ((ee->prop.sticky) && (!sticky)) + { + ee->prop.sticky = 0; + ee->engine.x.state.sticky = 0; + if (ee->func.fn_unsticky) ee->func.fn_unsticky(ee); + } + } + + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_x_event_visibility_change(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_X_Event_Window_Visibility_Change *e; + + e = event; + ee = ecore_event_window_match(e->win); + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; +// printf("VIS CHANGE OBSCURED: %p %i\n", ee, e->fully_obscured); + if (e->fully_obscured) + { + /* FIXME: round trip */ + if (!ecore_x_screen_is_composited(ee->engine.x.screen_num)) + ee->draw_ok = 0; + } + else + ee->draw_ok = 1; + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_x_event_client_message(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_X_Event_Client_Message *e; + + e = event; + if (e->format != 32) return ECORE_CALLBACK_PASS_ON; + if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_BEGIN) + { + ee = ecore_event_window_match(e->data.l[0]); + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->data.l[0] != (long)ee->prop.window) + return ECORE_CALLBACK_PASS_ON; + if (!ee->engine.x.sync_began) + { + // qeue a damage + draw. work around an event re-ordering thing. + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } + ee->engine.x.sync_began = 1; + ee->engine.x.sync_cancel = 0; + } + else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_END) + { + ee = ecore_event_window_match(e->data.l[0]); + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->data.l[0] != (long)ee->prop.window) + return ECORE_CALLBACK_PASS_ON; + ee->engine.x.sync_began = 0; + ee->engine.x.sync_cancel = 0; + } + else if (e->message_type == ECORE_X_ATOM_E_COMP_SYNC_CANCEL) + { + ee = ecore_event_window_match(e->data.l[0]); + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->data.l[0] != (long)ee->prop.window) + return ECORE_CALLBACK_PASS_ON; + ee->engine.x.sync_began = 0; + ee->engine.x.sync_cancel = 1; + } + else if ((e->message_type == ECORE_X_ATOM_WM_PROTOCOLS) && + (e->data.l[0] == (int)ECORE_X_ATOM_NET_WM_SYNC_REQUEST)) + { + ee = ecore_event_window_match(e->win); + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + ee->engine.x.netwm_sync_val_lo = (unsigned int)e->data.l[2]; + ee->engine.x.netwm_sync_val_hi = (int)e->data.l[3]; + ee->engine.x.netwm_sync_set = 1; + } + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_x_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_X_Event_Mouse_In *e; + + e = event; + ee = ecore_event_window_match(e->win); + if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; +/* { */ +/* time_t t; */ +/* char *ct; */ + +/* const char *modes[] = { */ +/* "MODE_NORMAL", */ +/* "MODE_WHILE_GRABBED", */ +/* "MODE_GRAB", */ +/* "MODE_UNGRAB" */ +/* }; */ +/* const char *details[] = { */ +/* "DETAIL_ANCESTOR", */ +/* "DETAIL_VIRTUAL", */ +/* "DETAIL_INFERIOR", */ +/* "DETAIL_NON_LINEAR", */ +/* "DETAIL_NON_LINEAR_VIRTUAL", */ +/* "DETAIL_POINTER", */ +/* "DETAIL_POINTER_ROOT", */ +/* "DETAIL_DETAIL_NONE" */ +/* }; */ +/* t = time(NULL); */ +/* ct = ctime(&t); */ +/* ct[strlen(ct) - 1] = 0; */ +/* printf("@@ ->IN 0x%x 0x%x %s md=%s dt=%s\n", */ +/* e->win, e->event_win, */ +/* ct, */ +/* modes[e->mode], */ +/* details[e->detail]); */ +/* } */ + // disable. causes more problems than it fixes + // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) || + // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) + // return 0; + /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ + if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee); + ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); + evas_event_feed_mouse_in(ee->evas, e->time, NULL); + _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_x_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_X_Event_Mouse_Out *e; + + e = event; + ee = ecore_event_window_match(e->win); + if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; + /* pass on event */ + if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; +/* { */ +/* time_t t; */ +/* char *ct; */ + +/* const char *modes[] = { */ +/* "MODE_NORMAL", */ +/* "MODE_WHILE_GRABBED", */ +/* "MODE_GRAB", */ +/* "MODE_UNGRAB" */ +/* }; */ +/* const char *details[] = { */ +/* "DETAIL_ANCESTOR", */ +/* "DETAIL_VIRTUAL", */ +/* "DETAIL_INFERIOR", */ +/* "DETAIL_NON_LINEAR", */ +/* "DETAIL_NON_LINEAR_VIRTUAL", */ +/* "DETAIL_POINTER", */ +/* "DETAIL_POINTER_ROOT", */ +/* "DETAIL_DETAIL_NONE" */ +/* }; */ +/* t = time(NULL); */ +/* ct = ctime(&t); */ +/* ct[strlen(ct) - 1] = 0; */ +/* printf("@@ ->OUT 0x%x 0x%x %s md=%s dt=%s\n", */ +/* e->win, e->event_win, */ +/* ct, */ +/* modes[e->mode], */ +/* details[e->detail]); */ +/* } */ + // disable. causes more problems than it fixes + // if ((e->mode == ECORE_X_EVENT_MODE_GRAB) || + // (e->mode == ECORE_X_EVENT_MODE_UNGRAB)) + // return 0; + /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */ + ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers); + _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time); + if (e->mode == ECORE_X_EVENT_MODE_GRAB) + evas_event_feed_mouse_cancel(ee->evas, e->time, NULL); + evas_event_feed_mouse_out(ee->evas, e->time, NULL); + if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee); + if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_x_event_window_focus_in(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_X_Event_Window_Focus_In *e; + + e = event; + ee = ecore_event_window_match(e->win); + if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (e->mode == ECORE_X_EVENT_MODE_UNGRAB) return ECORE_CALLBACK_PASS_ON; + ee->prop.focused = 1; + evas_focus_in(ee->evas); + if (ee->func.fn_focus_in) ee->func.fn_focus_in(ee); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_x_event_window_focus_out(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_X_Event_Window_Focus_Out *e; + + e = event; + ee = ecore_event_window_match(e->win); + if ((!ee) || (ee->ignore_events)) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (e->mode == ECORE_X_EVENT_MODE_GRAB) return ECORE_CALLBACK_PASS_ON; +// if (ee->prop.fullscreen) +// ecore_x_window_focus(ee->prop.window); + evas_focus_out(ee->evas); + ee->prop.focused = 0; + if (ee->func.fn_focus_out) ee->func.fn_focus_out(ee); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_x_event_window_damage(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_X_Event_Window_Damage *e; + + e = event; + ee = ecore_event_window_match(e->win); + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (ee->engine.x.using_bg_pixmap) return ECORE_CALLBACK_PASS_ON; +// printf("EXPOSE %p [%i] %i %i %ix%i\n", ee, ee->prop.avoid_damage, e->x, e->y, e->w, e->h); + if (ee->prop.avoid_damage) + { + Ecore_X_Rectangle rect; + Ecore_X_XRegion *tmpr; + + if (!ee->engine.x.damages) + ee->engine.x.damages = ecore_x_xregion_new(); + tmpr = ecore_x_xregion_new(); + rect.x = e->x; + rect.y = e->y; + rect.width = e->w; + rect.height = e->h; + ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect); + ecore_x_xregion_free(ee->engine.x.damages); + ee->engine.x.damages = tmpr; +/* no - this breaks things badly. disable. Ecore_X_Rectangle != XRectangle - see + * the typedefs in x's headers and ecore_x's. also same with Region - it's a pointer in x - not an X ID + Ecore_X_Rectangle rect; + Ecore_X_XRegion *tmpr; + + if (!ee->engine.x.damages) ee->engine.x.damages = ecore_x_xregion_new(); + tmpr = ecore_x_xregion_new(); + rect.x = e->x; + rect.y = e->y; + rect.width = e->w; + rect.height = e->h; + ecore_x_xregion_union_rect(tmpr, ee->engine.x.damages, &rect); + ecore_x_xregion_free(ee->engine.x.damages); + ee->engine.x.damages = tmpr; + */ + } + else + { + if (ee->rotation == 0) + evas_damage_rectangle_add(ee->evas, e->x, e->y, e->w, e->h); + else if (ee->rotation == 90) + evas_damage_rectangle_add(ee->evas, + ee->h - e->y - e->h, e->x, e->h, e->w); + else if (ee->rotation == 180) + evas_damage_rectangle_add(ee->evas, ee->w - e->x - e->w, + ee->h - e->y - e->h, e->w, e->h); + else if (ee->rotation == 270) + evas_damage_rectangle_add(ee->evas, e->y, ee->w - e->x - e->w, + e->h, e->w); + } + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_x_event_window_destroy(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_X_Event_Window_Destroy *e; + + e = event; + ee = ecore_event_window_match(e->win); + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (ee->func.fn_destroy) ee->func.fn_destroy(ee); + _ecore_evas_x_sync_clear(ee); + ecore_evas_free(ee); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_x_event_window_configure(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_X_Event_Window_Configure *e; + + e = event; + ee = ecore_event_window_match(e->win); + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (ee->engine.x.direct_resize) return ECORE_CALLBACK_PASS_ON; + + ee->engine.x.configure_coming = 0; + if ((e->from_wm) || (ee->prop.override)) + { + if ((ee->x != e->x) || (ee->y != e->y)) + { + ee->x = e->x; + ee->y = e->y; + ee->req.x = ee->x; + ee->req.y = ee->y; + if (ee->func.fn_move) ee->func.fn_move(ee); + } + } + if ((ee->w != e->w) || (ee->h != e->h)) + { + ee->w = e->w; + ee->h = e->h; + ee->req.w = ee->w; + ee->req.h = ee->h; + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + } + else + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } + if (ee->prop.avoid_damage) + { + int pdam; + + pdam = ecore_evas_avoid_damage_get(ee); + ecore_evas_avoid_damage_set(ee, 0); + ecore_evas_avoid_damage_set(ee, pdam); + } + if ((ee->shaped) || (ee->alpha)) + _ecore_evas_x_resize_shape(ee); + if ((ee->expecting_resize.w > 0) && (ee->expecting_resize.h > 0)) + { + if ((ee->expecting_resize.w == ee->w) && + (ee->expecting_resize.h == ee->h)) + _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, + ecore_x_current_time_get()); + ee->expecting_resize.w = 0; + ee->expecting_resize.h = 0; + } + if (ee->func.fn_resize) ee->func.fn_resize(ee); + } + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_x_event_window_delete_request(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_X_Event_Window_Delete_Request *e; + + e = event; + ee = ecore_event_window_match(e->win); + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (ee->func.fn_delete_request) ee->func.fn_delete_request(ee); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_x_event_window_show(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_X_Event_Window_Show *e; + static int first_map_bug = -1; + + e = event; + ee = ecore_event_window_match(e->win); + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (first_map_bug < 0) + { + char *bug = NULL; + + if ((bug = getenv("ECORE_EVAS_GL_FIRST_MAP_BUG"))) + first_map_bug = atoi(bug); + else + first_map_bug = 0; + } + if ((first_map_bug) && (!strcmp(ee->driver, "opengl_x11"))) + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + if (ee->visible) return ECORE_CALLBACK_PASS_ON; +// if (ee->visible) return ECORE_CALLBACK_DONE; +// printf("SHOW EVENT %p\n", ee); + ee->visible = 1; + if (ee->func.fn_show) ee->func.fn_show(ee); + return ECORE_CALLBACK_PASS_ON; +} + +static Eina_Bool +_ecore_evas_x_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Evas *ee; + Ecore_X_Event_Window_Hide *e; + + e = event; + ee = ecore_event_window_match(e->win); + if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */ + if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON; + if (!ee->visible) return ECORE_CALLBACK_PASS_ON; +// if (!ee->visible) return ECORE_CALLBACK_DONE; +// printf("HIDE EVENT %p\n", ee); + ee->visible = 0; + if (ee->func.fn_hide) ee->func.fn_hide(ee); + return ECORE_CALLBACK_PASS_ON; +} + +/* FIXME, should be in idler */ +/* FIXME, round trip */ +static void +_ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee) +{ + ecore_x_icccm_size_pos_hints_set(ee->prop.window, + ee->prop.request_pos /*request_pos */, + ECORE_X_GRAVITY_NW /* gravity */, + ee->prop.min.w /* min_w */, + ee->prop.min.h /* min_h */, + ee->prop.max.w /* max_w */, + ee->prop.max.h /* max_h */, + ee->prop.base.w /* base_w */, + ee->prop.base.h /* base_h */, + ee->prop.step.w /* step_x */, + ee->prop.step.h /* step_y */, + 0 /* min_aspect */, + 0 /* max_aspect */); +} + +/* FIXME, should be in idler */ +static void +_ecore_evas_x_state_update(Ecore_Evas *ee) +{ + Ecore_X_Window_State state[10]; + int num = 0; + + /* + if (bd->client.netwm.state.modal) + state[num++] = ECORE_X_WINDOW_STATE_MODAL; + */ + if (ee->engine.x.state.sticky) + state[num++] = ECORE_X_WINDOW_STATE_STICKY; + /* + if (bd->client.netwm.state.maximized_v) + state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_VERT; + if (bd->client.netwm.state.maximized_h) + state[num++] = ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ; + if (bd->client.netwm.state.shaded) + state[num++] = ECORE_X_WINDOW_STATE_SHADED; + if (bd->client.netwm.state.skip_taskbar) + state[num++] = ECORE_X_WINDOW_STATE_SKIP_TASKBAR; + if (bd->client.netwm.state.skip_pager) + state[num++] = ECORE_X_WINDOW_STATE_SKIP_PAGER; + if (bd->client.netwm.state.hidden) + state[num++] = ECORE_X_WINDOW_STATE_HIDDEN; + */ + if (ee->engine.x.state.fullscreen) + state[num++] = ECORE_X_WINDOW_STATE_FULLSCREEN; + if (ee->engine.x.state.above) + state[num++] = ECORE_X_WINDOW_STATE_ABOVE; + if (ee->engine.x.state.below) + state[num++] = ECORE_X_WINDOW_STATE_BELOW; + + ecore_x_netwm_window_state_set(ee->prop.window, state, num); +} + +static void +_ecore_evas_x_layer_update(Ecore_Evas *ee) +{ + if (ee->should_be_visible) + { + /* We need to send a netwm request to the wm */ + /* FIXME: Do we have to remove old state before adding new? */ + if (ee->prop.layer < 3) + { + if (ee->engine.x.state.above) + { + ee->engine.x.state.above = 0; + ecore_x_netwm_state_request_send(ee->prop.window, + ee->engine.x.win_root, + ECORE_X_WINDOW_STATE_ABOVE, -1, 0); + } + if (!ee->engine.x.state.below) + { + ee->engine.x.state.below = 1; + ecore_x_netwm_state_request_send(ee->prop.window, + ee->engine.x.win_root, + ECORE_X_WINDOW_STATE_BELOW, -1, 1); + } + } + else if (ee->prop.layer > 5) + { + if (ee->engine.x.state.below) + { + ee->engine.x.state.below = 0; + ecore_x_netwm_state_request_send(ee->prop.window, + ee->engine.x.win_root, + ECORE_X_WINDOW_STATE_BELOW, -1, 0); + } + if (!ee->engine.x.state.above) + { + ee->engine.x.state.above = 1; + ecore_x_netwm_state_request_send(ee->prop.window, + ee->engine.x.win_root, + ECORE_X_WINDOW_STATE_ABOVE, -1, 1); + } + } + else + { + if (ee->engine.x.state.below) + { + ee->engine.x.state.below = 0; + ecore_x_netwm_state_request_send(ee->prop.window, + ee->engine.x.win_root, + ECORE_X_WINDOW_STATE_BELOW, -1, 0); + } + if (ee->engine.x.state.above) + { + ee->engine.x.state.above = 0; + ecore_x_netwm_state_request_send(ee->prop.window, + ee->engine.x.win_root, + ECORE_X_WINDOW_STATE_ABOVE, -1, 0); + } + } + } + else + { + /* Just set the state */ + if (ee->prop.layer < 3) + { + if ((ee->engine.x.state.above) || (!ee->engine.x.state.below)) + { + ee->engine.x.state.above = 0; + ee->engine.x.state.below = 1; + _ecore_evas_x_state_update(ee); + } + } + else if (ee->prop.layer > 5) + { + if ((!ee->engine.x.state.above) || (ee->engine.x.state.below)) + { + ee->engine.x.state.above = 1; + ee->engine.x.state.below = 0; + _ecore_evas_x_state_update(ee); + } + } + else + { + if ((ee->engine.x.state.above) || (ee->engine.x.state.below)) + { + ee->engine.x.state.above = 0; + ee->engine.x.state.below = 0; + _ecore_evas_x_state_update(ee); + } + } + } + /* FIXME: Set gnome layer */ +} + +static int +_ecore_evas_x_init(void) +{ + _ecore_evas_init_count++; + if (_ecore_evas_init_count > 1) return _ecore_evas_init_count; + ecore_evas_event_handlers[0] = + ecore_event_handler_add(ECORE_X_EVENT_MOUSE_IN, + _ecore_evas_x_event_mouse_in, NULL); + ecore_evas_event_handlers[1] = + ecore_event_handler_add(ECORE_X_EVENT_MOUSE_OUT, + _ecore_evas_x_event_mouse_out, NULL); + ecore_evas_event_handlers[2] = + ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, + _ecore_evas_x_event_window_focus_in, NULL); + ecore_evas_event_handlers[3] = + ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, + _ecore_evas_x_event_window_focus_out, NULL); + ecore_evas_event_handlers[4] = + ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DAMAGE, + _ecore_evas_x_event_window_damage, NULL); + ecore_evas_event_handlers[5] = + ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, + _ecore_evas_x_event_window_destroy, NULL); + ecore_evas_event_handlers[6] = + ecore_event_handler_add(ECORE_X_EVENT_WINDOW_CONFIGURE, + _ecore_evas_x_event_window_configure, NULL); + ecore_evas_event_handlers[7] = + ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, + _ecore_evas_x_event_window_delete_request, NULL); + ecore_evas_event_handlers[8] = + ecore_event_handler_add(ECORE_X_EVENT_WINDOW_SHOW, + _ecore_evas_x_event_window_show, NULL); + ecore_evas_event_handlers[9] = + ecore_event_handler_add(ECORE_X_EVENT_WINDOW_HIDE, + _ecore_evas_x_event_window_hide, NULL); + ecore_evas_event_handlers[10] = + ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, + _ecore_evas_x_event_property_change, NULL); + ecore_evas_event_handlers[11] = + ecore_event_handler_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, + _ecore_evas_x_event_visibility_change, NULL); + ecore_evas_event_handlers[12] = + ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, + _ecore_evas_x_event_client_message, NULL); + ecore_event_evas_init(); + return _ecore_evas_init_count; +} + +static void +_ecore_evas_x_free(Ecore_Evas *ee) +{ + _ecore_evas_x_group_leader_unset(ee); + _ecore_evas_x_sync_set(ee); + if (ee->engine.x.win_shaped_input) + ecore_x_window_free(ee->engine.x.win_shaped_input); + ecore_x_window_free(ee->prop.window); + if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); + if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); + if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); + if (ee->engine.x.damages) ecore_x_xregion_free(ee->engine.x.damages); + ee->engine.x.pmap = 0; + ee->engine.x.mask = 0; + ee->engine.x.gc = 0; + ee->engine.x.damages = NULL; + ecore_event_window_unregister(ee->prop.window); + while (ee->engine.x.win_extra) + { + Ecore_X_Window *winp; + + winp = ee->engine.x.win_extra->data; + ee->engine.x.win_extra = + eina_list_remove_list(ee->engine.x.win_extra, ee->engine.x.win_extra); + ecore_event_window_unregister(*winp); + free(winp); + } + _ecore_evas_x_shutdown(); + ecore_x_shutdown(); +} + +static void +_ecore_evas_x_callback_delete_request_set(Ecore_Evas *ee, void (*func) (Ecore_Evas *ee)) +{ + ee->func.fn_delete_request = func; + _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_sync_set(ee); +} + +static void +_ecore_evas_x_move(Ecore_Evas *ee, int x, int y) +{ + ee->req.x = x; + ee->req.y = y; + if (ee->engine.x.direct_resize) + { + if (!ee->engine.x.managed) + { + if ((x != ee->x) || (y != ee->y)) + { + ee->x = x; + ee->y = y; + ecore_x_window_move(ee->prop.window, x, y); + if (!ee->should_be_visible) + { + /* We need to request pos */ + ee->prop.request_pos = 1; + _ecore_evas_x_size_pos_hints_update(ee); + } + if (ee->func.fn_move) ee->func.fn_move(ee); + } + } + } + else + { + if (((ee->x != x) || (ee->y != y)) || + (ee->engine.x.configure_coming)) + { + ee->engine.x.configure_coming = 1; + if (!ee->engine.x.managed) + { + ee->x = x; + ee->y = y; + } + ecore_x_window_move(ee->prop.window, x, y); + } + if (!ee->should_be_visible) + { + /* We need to request pos */ + ee->prop.request_pos = 1; + _ecore_evas_x_size_pos_hints_update(ee); + } + } +} + +static void +_ecore_evas_x_managed_move(Ecore_Evas *ee, int x, int y) +{ + ee->req.x = x; + ee->req.y = y; + if (ee->engine.x.direct_resize) + { + ee->engine.x.managed = 1; + if ((x != ee->x) || (y != ee->y)) + { + ee->x = x; + ee->y = y; + if (ee->func.fn_move) ee->func.fn_move(ee); + } + } +} + +static void +_ecore_evas_x_resize(Ecore_Evas *ee, int w, int h) +{ + ee->req.w = w; + ee->req.h = h; + if (ee->engine.x.direct_resize) + { + if ((ee->w != w) || (ee->h != h)) + { + ee->w = w; + ee->h = h; + ecore_x_window_resize(ee->prop.window, w, h); + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + } + else + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } + if (ee->prop.avoid_damage) + { + int pdam; + + pdam = ecore_evas_avoid_damage_get(ee); + ecore_evas_avoid_damage_set(ee, 0); + ecore_evas_avoid_damage_set(ee, pdam); + } + if ((ee->shaped) || (ee->alpha)) + _ecore_evas_x_resize_shape(ee); + if (ee->func.fn_resize) ee->func.fn_resize(ee); + } + } + else if (((ee->w != w) || (ee->h != h)) || + (ee->engine.x.configure_coming)) + { + ee->engine.x.configure_coming = 1; + ecore_x_window_resize(ee->prop.window, w, h); + } +} + +static void +_ecore_evas_x_move_resize(Ecore_Evas *ee, int x, int y, int w, int h) +{ + ee->req.x = x; + ee->req.y = y; + ee->req.w = w; + ee->req.h = h; + if (ee->engine.x.direct_resize) + { + if ((ee->w != w) || (ee->h != h) || (x != ee->x) || (y != ee->y)) + { + int change_size = 0, change_pos = 0; + + if ((ee->w != w) || (ee->h != h)) change_size = 1; + if (!ee->engine.x.managed) + { + if ((x != ee->x) || (y != ee->y)) change_pos = 1; + } + ecore_x_window_move_resize(ee->prop.window, x, y, w, h); + if (!ee->engine.x.managed) + { + ee->x = x; + ee->y = y; + } + ee->w = w; + ee->h = h; + if ((ee->rotation == 90) || (ee->rotation == 270)) + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + } + else + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } + if (ee->prop.avoid_damage) + { + int pdam; + + pdam = ecore_evas_avoid_damage_get(ee); + ecore_evas_avoid_damage_set(ee, 0); + ecore_evas_avoid_damage_set(ee, pdam); + } + if ((ee->shaped) || (ee->alpha)) + _ecore_evas_x_resize_shape(ee); + if (change_pos) + { + if (ee->func.fn_move) ee->func.fn_move(ee); + } + if (change_size) + { + if (ee->func.fn_resize) ee->func.fn_resize(ee); + } + } + } + else if (((ee->w != w) || (ee->h != h) || (ee->x != x) || (ee->y != y)) || + (ee->engine.x.configure_coming)) + { + ee->engine.x.configure_coming = 1; + ecore_x_window_move_resize(ee->prop.window, x, y, w, h); + if (!ee->engine.x.managed) + { + ee->x = x; + ee->y = y; + } + } +} + +static void +_ecore_evas_x_rotation_set_internal(Ecore_Evas *ee, int rotation, int resize, + Evas_Engine_Info *einfo) +{ + int rot_dif; + + rot_dif = ee->rotation - rotation; + if (rot_dif < 0) rot_dif = -rot_dif; + + if (rot_dif != 180) + { + int minw, minh, maxw, maxh, basew, baseh, stepw, steph; + + if (!evas_engine_info_set(ee->evas, einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + + if (!resize) + { + ee->engine.x.configure_coming = 1; + if (!ee->prop.fullscreen) + { + ecore_x_window_resize(ee->prop.window, ee->req.h, ee->req.w); + ee->expecting_resize.w = ee->h; + ee->expecting_resize.h = ee->w; + } + else + { + int w, h; + + ecore_x_window_size_get(ee->prop.window, &w, &h); + ecore_x_window_resize(ee->prop.window, h, w); + if ((rotation == 0) || (rotation == 180)) + { + evas_output_size_set(ee->evas, ee->req.w, ee->req.h); + evas_output_viewport_set(ee->evas, 0, 0, ee->req.w, ee->req.h); + } + else + { + evas_output_size_set(ee->evas, ee->req.h, ee->req.w); + evas_output_viewport_set(ee->evas, 0, 0, ee->req.h, ee->req.w); + } + if (ee->func.fn_resize) ee->func.fn_resize(ee); + } + if ((ee->rotation == 90) || (ee->rotation == 270)) + evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.h, ee->req.w); + else + evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); + } + else + { + /* int w, h; */ + + /* ecore_x_window_size_get(ee->prop.window, &w, &h); */ + if ((rotation == 0) || (rotation == 180)) + { + evas_output_size_set(ee->evas, ee->w, ee->h); + evas_output_viewport_set(ee->evas, 0, 0, ee->w, ee->h); + } + else + { + evas_output_size_set(ee->evas, ee->h, ee->w); + evas_output_viewport_set(ee->evas, 0, 0, ee->h, ee->w); + } + if (ee->func.fn_resize) ee->func.fn_resize(ee); + if ((ee->rotation == 90) || (ee->rotation == 270)) + evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); + else + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } + ecore_evas_size_min_get(ee, &minw, &minh); + ecore_evas_size_max_get(ee, &maxw, &maxh); + ecore_evas_size_base_get(ee, &basew, &baseh); + ecore_evas_size_step_get(ee, &stepw, &steph); + ee->rotation = rotation; + ecore_evas_size_min_set(ee, minh, minw); + ecore_evas_size_max_set(ee, maxh, maxw); + ecore_evas_size_base_set(ee, baseh, basew); + ecore_evas_size_step_set(ee, steph, stepw); + _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, + ecore_x_current_time_get()); + } + else + { + if (!evas_engine_info_set(ee->evas, einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + ee->rotation = rotation; + _ecore_evas_mouse_move_process(ee, ee->mouse.x, ee->mouse.y, + ecore_x_current_time_get()); + if (ee->func.fn_resize) ee->func.fn_resize(ee); + + if ((ee->rotation == 90) || (ee->rotation == 270)) + evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); + else + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } +} + +static void +_ecore_evas_x_rotation_set(Ecore_Evas *ee, int rotation, int resize) +{ + if (ee->rotation == rotation) return; + if (!strcmp(ee->driver, "opengl_x11")) + { +#ifdef BUILD_ECORE_EVAS_OPENGL_X11 + Evas_Engine_Info_GL_X11 *einfo; + + einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); + if (!einfo) return; + einfo->info.rotation = rotation; + _ecore_evas_x_rotation_set_internal(ee, rotation, resize, + (Evas_Engine_Info *)einfo); +#endif /* BUILD_ECORE_EVAS_OPENGL_X11 */ + } + else if (!strcmp(ee->driver, "software_x11")) + { +#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 + Evas_Engine_Info_Software_X11 *einfo; + + einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); + if (!einfo) return; + einfo->info.rotation = rotation; + _ecore_evas_x_rotation_set_internal(ee, rotation, resize, + (Evas_Engine_Info *)einfo); +#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ + } + else if (!strcmp(ee->driver, "software_16_x11")) + { +#if BUILD_ECORE_EVAS_SOFTWARE_16_X11 + Evas_Engine_Info_Software_16_X11 *einfo; + + einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); + if (!einfo) return; + einfo->info.rotation = rotation; + _ecore_evas_x_rotation_set_internal(ee, rotation, resize, + (Evas_Engine_Info *)einfo); +#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ + } + else if (!strcmp(ee->driver, "software_8_x11")) + { +#if BUILD_ECORE_EVAS_SOFTWARE_8_X11 + Evas_Engine_Info_Software_8_X11 *einfo; + + einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); + if (!einfo) return; + einfo->info.rotation = rotation; + _ecore_evas_x_rotation_set_internal(ee, rotation, resize, + (Evas_Engine_Info *)einfo); +#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ + } +} + +static void +_ecore_evas_x_shaped_set(Ecore_Evas *ee, int shaped) +{ + if ((ee->shaped == shaped)) return; + if (!strcmp(ee->driver, "opengl_x11")) return; + if (!strcmp(ee->driver, "software_x11")) + { +#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 + Evas_Engine_Info_Software_X11 *einfo; + + einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); + ee->shaped = shaped; + if (einfo) + { + if (ee->shaped) + { + unsigned int foreground; + Ecore_X_GC gc; + + if (!ee->engine.x.mask) + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); + foreground = 0; + gc = ecore_x_gc_new(ee->engine.x.mask, + ECORE_X_GC_VALUE_MASK_FOREGROUND, + &foreground); + ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, + 0, 0, ee->w, ee->h); + ecore_x_gc_free(gc); + einfo->info.mask = ee->engine.x.mask; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); + } + else + { + if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); + ee->engine.x.mask = 0; + einfo->info.mask = 0; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + ecore_x_window_shape_mask_set(ee->prop.window, 0); + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); + } + } +#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ + } + else if (!strcmp(ee->driver, "software_16_x11")) + { +#if BUILD_ECORE_EVAS_SOFTWARE_16_X11 +# if 0 /* XXX no shaped window support for software_16_x11 */ + Evas_Engine_Info_Software_16_X11 *einfo; + + einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); + ee->shaped = shaped; + if (einfo) + { + if (ee->shaped) + { + ee->engine.x.mask = + ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); + einfo->info.mask = ee->engine.x.mask; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + } + else + { + if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); + ee->engine.x.mask = 0; + einfo->info.mask = 0; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + ecore_x_window_shape_mask_set(ee->prop.window, 0); + } + } +# endif /* XXX no shaped window support for software_16_x11 */ +#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ + } + if (!strcmp(ee->driver, "software_8_x11")) + { +#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) + Evas_Engine_Info_Software_8_X11 *einfo; + + einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); + ee->shaped = shaped; + if (einfo) + { + if (ee->shaped) + { + unsigned int foreground; + Ecore_X_GC gc; + + if (!ee->engine.x.mask) + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 1); + foreground = 0; + gc = ecore_x_gc_new(ee->engine.x.mask, + ECORE_X_GC_VALUE_MASK_FOREGROUND, + &foreground); + ecore_x_drawable_rectangle_fill(ee->engine.x.mask, gc, + 0, 0, ee->w, ee->h); + ecore_x_gc_free(gc); + einfo->info.mask = ee->engine.x.mask; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); + } + else + { + if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); + ee->engine.x.mask = 0; + einfo->info.mask = 0; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + ecore_x_window_shape_mask_set(ee->prop.window, 0); + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); + } + } +#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ + } +} + +/* FIXME, round trip */ +static void +_ecore_evas_x_alpha_set(Ecore_Evas *ee, int alpha) +{ + Ecore_X_Window_Attributes att; + char *id = NULL; + + if ((ee->alpha == alpha)) return; + + if (!strcmp(ee->driver, "software_x11")) + { +#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 + Evas_Engine_Info_Software_X11 *einfo; + + einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); + if (!einfo) return; + + if (!ecore_x_composite_query()) return; + + ee->shaped = 0; + ee->alpha = alpha; + ecore_x_window_free(ee->prop.window); + ecore_event_window_unregister(ee->prop.window); + if (ee->alpha) + { + if (ee->prop.override) + ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + else + ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + if (!ee->engine.x.mask) + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); + } + else + { + if (ee->prop.override) + ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + else + ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); + ee->engine.x.mask = 0; + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); + } + + einfo->info.destination_alpha = alpha; + + ecore_x_window_attributes_get(ee->prop.window, &att); + einfo->info.visual = att.visual; + einfo->info.colormap = att.colormap; + einfo->info.depth = att.depth; + +// if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); +// ee->engine.x.mask = 0; + einfo->info.mask = ee->engine.x.mask; + einfo->info.drawable = ee->prop.window; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); + ecore_x_window_shape_mask_set(ee->prop.window, 0); + ecore_x_input_multi_select(ee->prop.window); + ecore_event_window_register(ee->prop.window, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + if (ee->prop.borderless) + ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); + if (ee->visible) ecore_x_window_show(ee->prop.window); + if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); + if (ee->prop.title) + { + ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); + ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); + } + ecore_x_icccm_hints_set(ee->prop.window, + 1 /* accepts_focus */, + ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, + 0 /* icon_pixmap */, + 0 /* icon_mask */, + 0 /* icon_window */, + 0 /* window_group */, + 0 /* is_urgent */); + _ecore_evas_x_group_leader_update(ee); + ecore_x_window_defaults_set(ee->prop.window); + _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_sync_set(ee); +#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ + if ((id = getenv("DESKTOP_STARTUP_ID"))) + { + ecore_x_netwm_startup_id_set(ee->prop.window, id); + /* NB: on linux this may simply empty the env as opposed to completely + * unset it to being empty - unsure as solartis libc crashes looking + * for the '=' char */ + // putenv((char*)"DESKTOP_STARTUP_ID="); + } + } + else if (!strcmp(ee->driver, "opengl_x11")) + { +#ifdef BUILD_ECORE_EVAS_OPENGL_X11 + Evas_Engine_Info_GL_X11 *einfo; + + einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); + if (!einfo) return; + + if (!ecore_x_composite_query()) return; + + ee->shaped = 0; + ee->alpha = alpha; + ecore_x_window_free(ee->prop.window); + ecore_event_window_unregister(ee->prop.window); + ee->prop.window = 0; + + einfo->info.destination_alpha = alpha; + + if (ee->engine.x.win_root != 0) + { + /* FIXME: round trip in ecore_x_window_argb_get */ + if (ecore_x_window_argb_get(ee->engine.x.win_root)) + { + ee->prop.window = + _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root, + ee->req.x, ee->req.y, + ee->req.w, ee->req.h, + ee->prop.override, 1, NULL); + } + else + { + ee->prop.window = + _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root, + ee->req.x, ee->req.y, + ee->req.w, ee->req.h, + ee->prop.override, ee->alpha, + NULL); + } + } + else + { + ee->prop.window = + _ecore_evas_x_gl_window_new(ee, ee->engine.x.win_root, + ee->req.x, ee->req.y, + ee->req.w, ee->req.h, + ee->prop.override, ee->alpha, NULL); + } + + if (!ee->prop.window) return; +/* + if (ee->alpha) + { + if (ee->prop.override) + ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + else + ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + if (!ee->engine.x.mask) + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); + } + else + { + if (ee->prop.override) + ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + else + ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); + ee->engine.x.mask = 0; + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); + } + */ + + ecore_x_window_attributes_get(ee->prop.window, &att); + einfo->info.visual = att.visual; + einfo->info.colormap = att.colormap; + einfo->info.depth = att.depth; + +// if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); +// ee->engine.x.mask = 0; +// einfo->info.mask = ee->engine.x.mask; + einfo->info.drawable = ee->prop.window; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); +// ecore_x_window_shape_mask_set(ee->prop.window, 0); + ecore_x_input_multi_select(ee->prop.window); + ecore_event_window_register(ee->prop.window, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + if (ee->prop.borderless) + ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); + if (ee->visible) ecore_x_window_show(ee->prop.window); + if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); + if (ee->prop.title) + { + ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); + ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); + } + ecore_x_icccm_hints_set(ee->prop.window, + 1 /* accepts_focus */, + ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, + 0 /* icon_pixmap */, + 0 /* icon_mask */, + 0 /* icon_window */, + 0 /* window_group */, + 0 /* is_urgent */); + _ecore_evas_x_group_leader_update(ee); + ecore_x_window_defaults_set(ee->prop.window); + _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_sync_set(ee); +#endif /* BUILD_ECORE_EVAS_OPENGL_X11 */ + if ((id = getenv("DESKTOP_STARTUP_ID"))) + { + ecore_x_netwm_startup_id_set(ee->prop.window, id); + /* NB: on linux this may simply empty the env as opposed to completely + * unset it to being empty - unsure as solartis libc crashes looking + * for the '=' char */ + // putenv((char*)"DESKTOP_STARTUP_ID="); + } + } + else if (!strcmp(ee->driver, "software_16_x11")) + { +#if BUILD_ECORE_EVAS_SOFTWARE_16_X11 + Evas_Engine_Info_Software_16_X11 *einfo; + + einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); + if (!einfo) return; + + ee->shaped = 0; + ee->alpha = alpha; + ecore_x_window_free(ee->prop.window); + ecore_event_window_unregister(ee->prop.window); + if (ee->alpha) + { + if (ee->prop.override) + ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + else + ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + if (!ee->engine.x.mask) + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); + } + else + { + if (ee->prop.override) + ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + else + ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); + ee->engine.x.mask = 0; + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); + } + +# if 0 /* XXX no alpha window support for software_16_x11 */ + einfo->info.destination_alpha = alpha; +# endif /* XXX no alpha window support for software_16_x11 */ + +# if 0 /* XXX no shaped window support for software_16_x11 */ +// if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); +// ee->engine.x.mask = 0; + einfo->info.mask = ee->engine.x.mask; +# endif /* XXX no shaped window support for software_16_x11 */ + + einfo->info.drawable = ee->prop.window; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); + ecore_x_window_shape_mask_set(ee->prop.window, 0); + ecore_x_input_multi_select(ee->prop.window); + ecore_event_window_register(ee->prop.window, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + if (ee->prop.borderless) + ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); + if (ee->visible) ecore_x_window_show(ee->prop.window); + if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); + if (ee->prop.title) + { + ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); + ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); + } + ecore_x_icccm_hints_set(ee->prop.window, + 1 /* accepts_focus */, + ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, + 0 /* icon_pixmap */, + 0 /* icon_mask */, + 0 /* icon_window */, + 0 /* window_group */, + 0 /* is_urgent */); + _ecore_evas_x_group_leader_update(ee); + ecore_x_window_defaults_set(ee->prop.window); + _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_sync_set(ee); +#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ + if ((id = getenv("DESKTOP_STARTUP_ID"))) + { + ecore_x_netwm_startup_id_set(ee->prop.window, id); + /* NB: on linux this may simply empty the env as opposed to completely + * unset it to being empty - unsure as solartis libc crashes looking + * for the '=' char */ + // putenv((char*)"DESKTOP_STARTUP_ID="); + } + } + else if (!strcmp(ee->driver, "software_8_x11")) + { +#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) + Evas_Engine_Info_Software_8_X11 *einfo; + + einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); + if (!einfo) return; + + ee->shaped = 0; + ee->alpha = alpha; + ecore_x_window_free(ee->prop.window); + ecore_event_window_unregister(ee->prop.window); + if (ee->alpha) + { + if (ee->prop.override) + ee->prop.window = ecore_x_window_override_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + else + ee->prop.window = ecore_x_window_argb_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + if (!ee->engine.x.mask) + ee->engine.x.mask = ecore_x_pixmap_new(ee->prop.window, ee->req.w, ee->req.h, 1); + } + else + { + if (ee->prop.override) + ee->prop.window = ecore_x_window_override_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + else + ee->prop.window = ecore_x_window_new(ee->engine.x.win_root, ee->req.x, ee->req.y, ee->req.w, ee->req.h); + if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); + ee->engine.x.mask = 0; + ecore_x_window_shape_input_mask_set(ee->prop.window, 0); + } + + einfo->info.destination_alpha = alpha; + + ecore_x_window_attributes_get(ee->prop.window, &att); + einfo->info.visual = att.visual; + einfo->info.colormap = att.colormap; + einfo->info.depth = att.depth; + +// if (ee->engine.x.mask) ecore_x_pixmap_free(ee->engine.x.mask); +// ee->engine.x.mask = 0; + einfo->info.mask = ee->engine.x.mask; + einfo->info.drawable = ee->prop.window; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + evas_damage_rectangle_add(ee->evas, 0, 0, ee->req.w, ee->req.h); + ecore_x_window_shape_mask_set(ee->prop.window, 0); + ecore_x_input_multi_select(ee->prop.window); + ecore_event_window_register(ee->prop.window, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + if (ee->prop.borderless) + ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); + if (ee->visible) ecore_x_window_show(ee->prop.window); + if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); + if (ee->prop.title) + { + ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); + ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); + } + ecore_x_icccm_hints_set(ee->prop.window, + 1 /* accepts_focus */, + ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, + 0 /* icon_pixmap */, + 0 /* icon_mask */, + 0 /* icon_window */, + 0 /* window_group */, + 0 /* is_urgent */); + _ecore_evas_x_group_leader_update(ee); + ecore_x_window_defaults_set(ee->prop.window); + _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_sync_set(ee); + + if ((id = getenv("DESKTOP_STARTUP_ID"))) + { + ecore_x_netwm_startup_id_set(ee->prop.window, id); + /* NB: on linux this may simply empty the env as opposed to completely + * unset it to being empty - unsure as solartis libc crashes looking + * for the '=' char */ + // putenv((char*)"DESKTOP_STARTUP_ID="); + } +#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ + } +} + +static void +_ecore_evas_x_transparent_set(Ecore_Evas *ee, int transparent) +{ + if ((ee->transparent == transparent)) return; + + if (!strcmp(ee->driver, "software_x11")) + { +#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 + Evas_Engine_Info_Software_X11 *einfo; + + einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); + if (!einfo) return; + + ee->transparent = transparent; + einfo->info.destination_alpha = transparent; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); +#endif + } +} +#endif /* BUILD_ECORE_EVAS_X11 */ + +#ifdef BUILD_ECORE_EVAS_X11 +static void +_ecore_evas_x_show(Ecore_Evas *ee) +{ + ee->should_be_visible = 1; + if (ee->prop.avoid_damage) + _ecore_evas_x_render(ee); + _ecore_evas_x_sync_set(ee); + ecore_x_window_show(ee->prop.window); + if (ee->prop.fullscreen) + ecore_x_window_focus(ee->prop.window); +} + +static void +_ecore_evas_x_hide(Ecore_Evas *ee) +{ + ecore_x_window_hide(ee->prop.window); + ee->should_be_visible = 0; + _ecore_evas_x_sync_set(ee); +} + +static void +_ecore_evas_x_raise(Ecore_Evas *ee) +{ + ecore_x_window_raise(ee->prop.window); +} + +static void +_ecore_evas_x_lower(Ecore_Evas *ee) +{ + ecore_x_window_lower(ee->prop.window); +} + +static void +_ecore_evas_x_activate(Ecore_Evas *ee) +{ + ecore_x_netwm_client_active_request(ee->engine.x.win_root, + ee->prop.window, 2, 0); +} + +static void +_ecore_evas_x_title_set(Ecore_Evas *ee, const char *t) +{ + if (ee->prop.title) free(ee->prop.title); + ee->prop.title = NULL; + if (t) ee->prop.title = strdup(t); + ecore_x_icccm_title_set(ee->prop.window, ee->prop.title); + ecore_x_netwm_name_set(ee->prop.window, ee->prop.title); +} + +static void +_ecore_evas_x_name_class_set(Ecore_Evas *ee, const char *n, const char *c) +{ + if (ee->prop.name) free(ee->prop.name); + if (ee->prop.clas) free(ee->prop.clas); + ee->prop.name = NULL; + ee->prop.clas = NULL; + if (n) ee->prop.name = strdup(n); + if (c) ee->prop.clas = strdup(c); + ecore_x_icccm_name_class_set(ee->prop.window, ee->prop.name, ee->prop.clas); +} + +static void +_ecore_evas_x_size_min_set(Ecore_Evas *ee, int w, int h) +{ + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->prop.min.w == w) && (ee->prop.min.h == h)) return; + ee->prop.min.w = w; + ee->prop.min.h = h; + _ecore_evas_x_size_pos_hints_update(ee); +} + +static void +_ecore_evas_x_size_max_set(Ecore_Evas *ee, int w, int h) +{ + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->prop.max.w == w) && (ee->prop.max.h == h)) return; + ee->prop.max.w = w; + ee->prop.max.h = h; + _ecore_evas_x_size_pos_hints_update(ee); +} + +static void +_ecore_evas_x_size_base_set(Ecore_Evas *ee, int w, int h) +{ + if (w < 0) w = 0; + if (h < 0) h = 0; + if ((ee->prop.base.w == w) && (ee->prop.base.h == h)) return; + ee->prop.base.w = w; + ee->prop.base.h = h; + _ecore_evas_x_size_pos_hints_update(ee); +} + +static void +_ecore_evas_x_size_step_set(Ecore_Evas *ee, int w, int h) +{ + if (w < 1) w = 1; + if (h < 1) h = 1; + if ((ee->prop.step.w == w) && (ee->prop.step.h == h)) return; + ee->prop.step.w = w; + ee->prop.step.h = h; + _ecore_evas_x_size_pos_hints_update(ee); +} + +static void +_ecore_evas_object_cursor_del(void *data, Evas *e __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee; + + ee = data; + if (ee) ee->prop.cursor.object = NULL; +} + +static void +_ecore_evas_x_object_cursor_set(Ecore_Evas *ee, Evas_Object *obj, int layer, int hot_x, int hot_y) +{ + int x, y; + + if (ee->prop.cursor.object) evas_object_del(ee->prop.cursor.object); + + if (!obj) + { + ee->prop.cursor.object = NULL; + ee->prop.cursor.layer = 0; + ee->prop.cursor.hot.x = 0; + ee->prop.cursor.hot.y = 0; + ecore_x_window_cursor_show(ee->prop.window, 1); + return; + } + + ee->prop.cursor.object = obj; + ee->prop.cursor.layer = layer; + ee->prop.cursor.hot.x = hot_x; + ee->prop.cursor.hot.y = hot_y; + + ecore_x_window_cursor_show(ee->prop.window, 0); + + evas_pointer_output_xy_get(ee->evas, &x, &y); + evas_object_layer_set(ee->prop.cursor.object, ee->prop.cursor.layer); + evas_object_move(ee->prop.cursor.object, + x - ee->prop.cursor.hot.x, + y - ee->prop.cursor.hot.y); + evas_object_pass_events_set(ee->prop.cursor.object, 1); + if (evas_pointer_inside_get(ee->evas)) + evas_object_show(ee->prop.cursor.object); + + evas_object_event_callback_add(obj, EVAS_CALLBACK_DEL, _ecore_evas_object_cursor_del, ee); +} + +/* + * @param ee + * @param layer If < 3, @a ee will be put below all other windows. + * If > 5, @a ee will be "always-on-top" + * If = 4, @a ee will be put in the default layer. + * Acceptable values range from 1 to 255 (0 reserved for + * desktop windows) + */ +static void +_ecore_evas_x_layer_set(Ecore_Evas *ee, int layer) +{ + if (ee->prop.layer == layer) return; + + /* FIXME: Should this logic be here? */ + if (layer < 1) + layer = 1; + else if (layer > 255) + layer = 255; + + ee->prop.layer = layer; + _ecore_evas_x_layer_update(ee); +} + +static void +_ecore_evas_x_focus_set(Ecore_Evas *ee, int on __UNUSED__) +{ + ecore_x_window_focus(ee->prop.window); +} + +static void +_ecore_evas_x_iconified_set(Ecore_Evas *ee, int on) +{ + if (ee->prop.iconified == on) return; + ee->prop.iconified = on; + if (on) + { + ecore_x_icccm_hints_set(ee->prop.window, + 1 /* accepts_focus */, + ECORE_X_WINDOW_STATE_HINT_ICONIC /* initial_state */, + 0 /* icon_pixmap */, + 0 /* icon_mask */, + 0 /* icon_window */, + 0 /* window_group */, + 0 /* is_urgent */); + ecore_x_icccm_iconic_request_send(ee->prop.window, ee->engine.x.win_root); + } + else + { + ecore_x_icccm_hints_set(ee->prop.window, + 1 /* accepts_focus */, + ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, + 0 /* icon_pixmap */, + 0 /* icon_mask */, + 0 /* icon_window */, + 0 /* window_group */, + 0 /* is_urgent */); + ecore_evas_show(ee); + } +} + +static void +_ecore_evas_x_borderless_set(Ecore_Evas *ee, int on) +{ + if (ee->prop.borderless == on) return; + ee->prop.borderless = on; + ecore_x_mwm_borderless_set(ee->prop.window, ee->prop.borderless); +} + +/* FIXME: This function changes the initial state of the ee + * whilest the iconic function changes the current state! */ +static void +_ecore_evas_x_withdrawn_set(Ecore_Evas *ee, int withdrawn) +{ + Ecore_X_Window_State_Hint hint; + + if (ee->prop.withdrawn == withdrawn) return; + + ee->prop.withdrawn = withdrawn; + if (withdrawn) + hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; + else + hint = ECORE_X_WINDOW_STATE_HINT_NORMAL; + + ecore_x_icccm_hints_set(ee->prop.window, + 1 /* accepts_focus */, + hint /* initial_state */, + 0 /* icon_pixmap */, + 0 /* icon_mask */, + 0 /* icon_window */, + 0 /* window_group */, + 0 /* is_urgent */); +} + +static void +_ecore_evas_x_sticky_set(Ecore_Evas *ee, int sticky) +{ + if (ee->prop.sticky == sticky) return; + + /* We dont want to set prop.sticky here as it will cause + * the sticky callback not to get called. Its set on the + * property change event. + * ee->prop.sticky = sticky; + */ + ee->engine.x.state.sticky = sticky; + if (ee->should_be_visible) + ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, + ECORE_X_WINDOW_STATE_STICKY, -1, sticky); + else + _ecore_evas_x_state_update(ee); +} + +static void +_ecore_evas_x_ignore_events_set(Ecore_Evas *ee, int ignore) +{ + if (ee->ignore_events == ignore) return; + + ee->ignore_events = ignore; + if (ee->prop.window) + ecore_x_window_ignore_set(ee->prop.window, ignore); +} + +/* +static void +_ecore_evas_x_reinit_win(Ecore_Evas *ee) +{ + if (!strcmp(ee->driver, "software_x11")) + { +#ifdef BUILD_ECORE_EVAS_X11 + Evas_Engine_Info_Software_X11 *einfo; + + einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); + if (einfo) + { + einfo->info.drawable = ee->prop.window; + evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); + } +#endif + } + else if (!strcmp(ee->driver, "opengl_x11")) + { +#ifdef BUILD_ECORE_EVAS_OPENGL_X11 + Evas_Engine_Info_GL_X11 *einfo; + + einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); + if (einfo) + { + einfo->info.drawable = ee->prop.window; + evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo); + } +#endif + } +} +*/ + +static void +_ecore_evas_x_override_set(Ecore_Evas *ee, int on) +{ + if (ee->prop.override == on) return; + if (ee->should_be_visible) ecore_x_window_hide(ee->prop.window); + ecore_x_window_override_set(ee->prop.window, on); + if (ee->should_be_visible) ecore_x_window_show(ee->prop.window); + if (ee->prop.focused) ecore_x_window_focus(ee->prop.window); + ee->prop.override = on; +} + +static void +_ecore_evas_x_fullscreen_set(Ecore_Evas *ee, int on) +{ + if (ee->prop.fullscreen == on) return; + + /* FIXME: Detect if WM is EWMH compliant and handle properly if not, + * i.e. reposition, resize, and change borderless hint */ + ee->engine.x.state.fullscreen = on; + if (ee->should_be_visible) + ecore_x_netwm_state_request_send(ee->prop.window, ee->engine.x.win_root, + ECORE_X_WINDOW_STATE_FULLSCREEN, -1, on); + else + _ecore_evas_x_state_update(ee); +} + +static void +_ecore_evas_x_avoid_damage_set(Ecore_Evas *ee, int on) +{ + if (ee->prop.avoid_damage == on) return; + if (!strcmp(ee->driver, "opengl_x11")) return; + + if (!strcmp(ee->driver, "software_x11")) + { +#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 + Evas_Engine_Info_Software_X11 *einfo; + + ee->prop.avoid_damage = on; + einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); + if (einfo) + { + if (ee->prop.avoid_damage) + { + ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth); + ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL); + einfo->info.drawable = ee->engine.x.pmap; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + if ((ee->rotation == 90) || (ee->rotation == 270)) + evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); + else + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN) + { + ee->engine.x.using_bg_pixmap = 1; + ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); + ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); + } + if (ee->engine.x.direct_resize) + { + /* Turn this off for now + ee->engine.x.using_bg_pixmap = 1; + ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); + */ + } + } + else + { + if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); + if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); + if (ee->engine.x.using_bg_pixmap) + { + ecore_x_window_pixmap_set(ee->prop.window, 0); + ee->engine.x.using_bg_pixmap = 0; + ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); + } + ee->engine.x.pmap = 0; + ee->engine.x.gc = 0; + einfo->info.drawable = ee->prop.window; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + } + } +#endif /* BUILD_ECORE_EVAS_SOFTWARE_X11 */ + } + else if (!strcmp(ee->driver, "software_16_x11")) + { +#if BUILD_ECORE_EVAS_SOFTWARE_16_X11 + Evas_Engine_Info_Software_16_X11 *einfo; + + ee->prop.avoid_damage = on; + einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); + if (einfo) + { + if (ee->prop.avoid_damage) + { + ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, 16); + ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL); + einfo->info.drawable = ee->engine.x.pmap; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + if ((ee->rotation == 90) || (ee->rotation == 270)) + evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); + else + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + if (ee->engine.x.direct_resize) + { + /* Turn this off for now + ee->engine.x.using_bg_pixmap = 1; + ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); + */ + } + } + else + { + if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); + if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); + if (ee->engine.x.using_bg_pixmap) + { + ecore_x_window_pixmap_set(ee->prop.window, 0); + ee->engine.x.using_bg_pixmap = 0; + } + ee->engine.x.pmap = 0; + ee->engine.x.gc = 0; + einfo->info.drawable = ee->prop.window; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + } + } +#endif /* BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ + } + else if (!strcmp(ee->driver, "software_8_x11")) + { +#if BUILD_ECORE_EVAS_SOFTWARE_8_X11 + Evas_Engine_Info_Software_8_X11 *einfo; + + ee->prop.avoid_damage = on; + einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); + if (einfo) + { + if (ee->prop.avoid_damage) + { + ee->engine.x.pmap = ecore_x_pixmap_new(ee->prop.window, ee->w, ee->h, einfo->info.depth); + ee->engine.x.gc = ecore_x_gc_new(ee->engine.x.pmap, 0, NULL); + einfo->info.drawable = ee->engine.x.pmap; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + if ((ee->rotation == 90) || (ee->rotation == 270)) + evas_damage_rectangle_add(ee->evas, 0, 0, ee->h, ee->w); + else + evas_damage_rectangle_add(ee->evas, 0, 0, ee->w, ee->h); + if (ee->prop.avoid_damage == ECORE_EVAS_AVOID_DAMAGE_BUILT_IN) + { + ee->engine.x.using_bg_pixmap = 1; + ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); + ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); + } + if (ee->engine.x.direct_resize) + { + /* Turn this off for now + ee->engine.x.using_bg_pixmap = 1; + ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); + */ + } + } + else + { + if (ee->engine.x.pmap) ecore_x_pixmap_free(ee->engine.x.pmap); + if (ee->engine.x.gc) ecore_x_gc_free(ee->engine.x.gc); + if (ee->engine.x.using_bg_pixmap) + { + ecore_x_window_pixmap_set(ee->prop.window, 0); + ee->engine.x.using_bg_pixmap = 0; + ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); + } + ee->engine.x.pmap = 0; + ee->engine.x.gc = 0; + einfo->info.drawable = ee->prop.window; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + } + } +#endif /* BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ + } +} + +static void +_ecore_evas_x_screen_geometry_get(const Ecore_Evas *ee __UNUSED__, int *x, int *y, int *w, int *h) +{ + if (x) *x = 0; + if (y) *y = 0; + ecore_x_screen_size_get(ecore_x_default_screen_get(), w, h); +} + +int +_ecore_evas_x_shutdown(void) +{ + _ecore_evas_init_count--; + if (_ecore_evas_init_count == 0) + { + unsigned int i; + + for (i = 0; i < sizeof(ecore_evas_event_handlers) / sizeof(Ecore_Event_Handler*); i++) + { + if (ecore_evas_event_handlers[i]) + ecore_event_handler_del(ecore_evas_event_handlers[i]); + } + ecore_event_evas_shutdown(); + } + if (_ecore_evas_init_count < 0) _ecore_evas_init_count = 0; + return _ecore_evas_init_count; +} + +static Ecore_Evas_Engine_Func _ecore_x_engine_func = +{ + _ecore_evas_x_free, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_x_callback_delete_request_set, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + _ecore_evas_x_move, + _ecore_evas_x_managed_move, + _ecore_evas_x_resize, + _ecore_evas_x_move_resize, + _ecore_evas_x_rotation_set, + _ecore_evas_x_shaped_set, + _ecore_evas_x_show, + _ecore_evas_x_hide, + _ecore_evas_x_raise, + _ecore_evas_x_lower, + _ecore_evas_x_activate, + _ecore_evas_x_title_set, + _ecore_evas_x_name_class_set, + _ecore_evas_x_size_min_set, + _ecore_evas_x_size_max_set, + _ecore_evas_x_size_base_set, + _ecore_evas_x_size_step_set, + _ecore_evas_x_object_cursor_set, + _ecore_evas_x_layer_set, + _ecore_evas_x_focus_set, + _ecore_evas_x_iconified_set, + _ecore_evas_x_borderless_set, + _ecore_evas_x_override_set, + NULL, + _ecore_evas_x_fullscreen_set, + _ecore_evas_x_avoid_damage_set, + _ecore_evas_x_withdrawn_set, + _ecore_evas_x_sticky_set, + _ecore_evas_x_ignore_events_set, + _ecore_evas_x_alpha_set, + _ecore_evas_x_transparent_set, + + NULL, // render + _ecore_evas_x_screen_geometry_get +}; +#endif /* BUILD_ECORE_EVAS_X11 */ + +/* + * FIXME: there are some round trips. Especially, we can split + * ecore_x_init in 2 functions and suppress some round trips. + */ + +#if defined (BUILD_ECORE_EVAS_SOFTWARE_X11) || defined (BUILD_ECORE_EVAS_OPENGL_X11) || defined (BUILD_ECORE_EVAS_SOFTWARE_16_X11) || defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) +static void +_ecore_evas_x_flush_pre(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + + if (ee->no_comp_sync) return; + if (!_ecore_evas_app_comp_sync) return; + if (ee->engine.x.sync_counter) + { + if (ee->engine.x.sync_began) + { + ee->engine.x.sync_val++; + if (!ee->engine.x.sync_cancel) + { + if (!ee->semi_sync) + ecore_x_sync_counter_val_wait(ee->engine.x.sync_counter, + ee->engine.x.sync_val); + } + } + } +} + +static void +_ecore_evas_x_flush_post(void *data, Evas *e __UNUSED__, void *event_info __UNUSED__) +{ + Ecore_Evas *ee = data; + + if ((!ee->no_comp_sync) && (_ecore_evas_app_comp_sync)) + { + if (ee->engine.x.sync_counter) + { + if (ee->engine.x.sync_began) + { + if (!ee->engine.x.sync_cancel) + { + ecore_x_e_comp_sync_draw_size_done_send + (ee->engine.x.win_root, ee->prop.window, ee->w, ee->h); + } + } + } + } + if (ee->engine.x.netwm_sync_set) + { + ecore_x_sync_counter_2_set(ee->engine.x.netwm_sync_counter, + ee->engine.x.netwm_sync_val_hi, + ee->engine.x.netwm_sync_val_lo); + ee->engine.x.netwm_sync_set = 0; + } +} +#endif + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 +EAPI Ecore_Evas * +ecore_evas_software_x11_new(const char *disp_name, Ecore_X_Window parent, + int x, int y, int w, int h) +{ + Evas_Engine_Info_Software_X11 *einfo; + Ecore_Evas *ee; + int argb = 0, rmethod; + static int redraw_debug = -1; + char *id = NULL; + + rmethod = evas_render_method_lookup("software_x11"); + if (!rmethod) return NULL; + if (!ecore_x_init(disp_name)) return NULL; + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) return NULL; + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + _ecore_evas_x_init(); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; + + ee->driver = "software_x11"; + if (disp_name) ee->name = strdup(disp_name); + + if (w < 1) w = 1; + if (h < 1) h = 1; + ee->x = x; + ee->y = y; + ee->w = w; + ee->h = h; + ee->req.x = ee->x; + ee->req.y = ee->y; + ee->req.w = ee->w; + ee->req.h = ee->h; + + ee->prop.max.w = 32767; + ee->prop.max.h = 32767; + ee->prop.layer = 4; + ee->prop.request_pos = 0; + ee->prop.sticky = 0; + ee->engine.x.state.sticky = 0; + + /* init evas here */ + ee->evas = evas_new(); + evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, + _ecore_evas_x_flush_pre, ee); + evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, + _ecore_evas_x_flush_post, ee); + evas_data_attach_set(ee->evas, ee); + evas_output_method_set(ee->evas, rmethod); + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + + ee->engine.x.win_root = parent; + ee->engine.x.screen_num = 0; + + if (parent != 0) + { + ee->engine.x.screen_num = 1; /* FIXME: get real scren # */ + /* FIXME: round trip in ecore_x_window_argb_get */ + if (ecore_x_window_argb_get(parent)) + { + ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h); + argb = 1; + } + else + ee->prop.window = ecore_x_window_new(parent, x, y, w, h); + } + else + ee->prop.window = ecore_x_window_new(parent, x, y, w, h); + if ((id = getenv("DESKTOP_STARTUP_ID"))) + { + ecore_x_netwm_startup_id_set(ee->prop.window, id); + /* NB: on linux this may simply empty the env as opposed to completely + * unset it to being empty - unsure as solartis libc crashes looking + * for the '=' char */ +// putenv((char*)"DESKTOP_STARTUP_ID="); + } + einfo = (Evas_Engine_Info_Software_X11 *)evas_engine_info_get(ee->evas); + if (einfo) + { + Ecore_X_Screen *screen; + + /* FIXME: this is inefficient as its 1 or more round trips */ + screen = ecore_x_default_screen_get(); + if (ecore_x_screen_count_get() > 1) + { + Ecore_X_Window *roots; + int num, i; + + num = 0; + roots = ecore_x_window_root_list(&num); + if (roots) + { + Ecore_X_Window root; + + root = ecore_x_window_root_get(parent); + for (i = 0; i < num; i++) + { + if (root == roots[i]) + { + screen = ecore_x_screen_get(i); + break; + } + } + free(roots); + } + } + + einfo->info.destination_alpha = argb; + + if (redraw_debug < 0) + { + if (getenv("REDRAW_DEBUG")) + redraw_debug = atoi(getenv("REDRAW_DEBUG")); + else + redraw_debug = 0; + } + +# ifdef BUILD_ECORE_EVAS_SOFTWARE_XCB + einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XCB; + einfo->info.connection = ecore_x_connection_get(); + einfo->info.screen = screen; +# else + einfo->info.backend = EVAS_ENGINE_INFO_SOFTWARE_X11_BACKEND_XLIB; + einfo->info.connection = ecore_x_display_get(); + einfo->info.screen = NULL; +# endif + einfo->info.drawable = ee->prop.window; + +# ifdef EVAS_FRAME_QUEUING + { + char *render_mode; + + render_mode = getenv("EVAS_RENDER_MODE"); + if ((render_mode) && (!strcmp(render_mode, "non-blocking"))) + einfo->render_mode = EVAS_RENDER_MODE_NONBLOCKING; + } +# endif + + if (argb) + { + Ecore_X_Window_Attributes at; + + ecore_x_window_attributes_get(ee->prop.window, &at); + einfo->info.visual = at.visual; + einfo->info.colormap = at.colormap; + einfo->info.depth = at.depth; + einfo->info.destination_alpha = 1; + } + else + { + einfo->info.visual = + ecore_x_default_visual_get(einfo->info.connection, screen); + einfo->info.colormap = + ecore_x_default_colormap_get(einfo->info.connection, screen); + einfo->info.depth = + ecore_x_default_depth_get(einfo->info.connection, screen); + einfo->info.destination_alpha = 0; + } + + einfo->info.rotation = 0; + einfo->info.debug = redraw_debug; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + } + + ecore_x_icccm_hints_set(ee->prop.window, + 1 /* accepts_focus */, + ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, + 0 /* icon_pixmap */, + 0 /* icon_mask */, + 0 /* icon_window */, + 0 /* window_group */, + 0 /* is_urgent */); + _ecore_evas_x_group_leader_set(ee); + ecore_x_window_defaults_set(ee->prop.window); + _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_sync_set(ee); + + ee->engine.func->fn_render = _ecore_evas_x_render; + _ecore_evas_register(ee); + ecore_x_input_multi_select(ee->prop.window); + ecore_event_window_register(ee->prop.window, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + return ee; +} +#else +EAPI Ecore_Evas * +ecore_evas_software_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, + int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) +{ + return NULL; +} +#endif + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 +EAPI Ecore_X_Window +ecore_evas_software_x11_window_get(const Ecore_Evas *ee) +{ + return (Ecore_X_Window) ecore_evas_window_get(ee); +} +#else +EAPI Ecore_X_Window +ecore_evas_software_x11_window_get(const Ecore_Evas *ee __UNUSED__) +{ + return 0; +} +#endif + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 +EAPI void +ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) +{ + ee->engine.x.direct_resize = on; + if (ee->prop.avoid_damage) + { + if (ee->engine.x.direct_resize) + { +/* turn this off for now + ee->engine.x.using_bg_pixmap = 1; + ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); + */ + } + else + { +/* turn this off too- bg pixmap is controlled by avoid damage directly + ee->engine.x.using_bg_pixmap = 0; + ecore_x_window_pixmap_set(ee->prop.window, 0); + ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); + */ + } + } +} +#else +EAPI void +ecore_evas_software_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) +{ +} +#endif + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 +EAPI Eina_Bool +ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee) +{ + return ee->engine.x.direct_resize; +} +#else +EAPI Eina_Bool +ecore_evas_software_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__) +{ + return 0; +} +#endif + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#ifdef BUILD_ECORE_EVAS_SOFTWARE_X11 +EAPI void +ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) +{ + Ecore_X_Window *winp; + + winp = malloc(sizeof(Ecore_X_Window)); + if (winp) + { + *winp = win; + ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp); + ecore_x_input_multi_select(win); + ecore_event_window_register(win, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + } +} +#else +EAPI void +ecore_evas_software_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) +{ +} +#endif + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#ifdef BUILD_ECORE_EVAS_OPENGL_X11 +EAPI Ecore_Evas * +ecore_evas_gl_x11_new(const char *disp_name, Ecore_X_Window parent, + int x, int y, int w, int h) +{ + return ecore_evas_gl_x11_options_new(disp_name, parent, x, y, w, h, NULL); +} + +EAPI Ecore_Evas * +ecore_evas_gl_x11_options_new(const char *disp_name, Ecore_X_Window parent, + int x, int y, int w, int h, const int *opt) +{ + Ecore_Evas *ee; + int rmethod; + char *id = NULL; + + rmethod = evas_render_method_lookup("gl_x11"); + if (!rmethod) return NULL; + if (!ecore_x_init(disp_name)) return NULL; + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) return NULL; + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + _ecore_evas_x_init(); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; + + ee->driver = "opengl_x11"; + if (!getenv("ECORE_EVAS_COMP_NOSEMISYNC")) + ee->semi_sync = 1; // gl engine doesn't need to sync - its whole swaps +// ee->no_comp_sync = 1; // gl engine doesn't need to sync - its whole swaps + if (disp_name) ee->name = strdup(disp_name); + + if (w < 1) w = 1; + if (h < 1) h = 1; + ee->x = x; + ee->y = y; + ee->w = w; + ee->h = h; + ee->req.x = ee->x; + ee->req.y = ee->y; + ee->req.w = ee->w; + ee->req.h = ee->h; + + ee->prop.max.w = 32767; + ee->prop.max.h = 32767; + ee->prop.layer = 4; + ee->prop.request_pos = 0; + ee->prop.sticky = 0; + ee->engine.x.state.sticky = 0; + + /* init evas here */ + ee->evas = evas_new(); + evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee); + evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee); + evas_data_attach_set(ee->evas, ee); + evas_output_method_set(ee->evas, rmethod); + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + + if (parent == 0) parent = DefaultRootWindow(ecore_x_display_get()); + ee->engine.x.win_root = parent; + + if (ee->engine.x.win_root != 0) + { + ee->engine.x.screen_num = 1; /* FIXME: get real scren # */ + /* FIXME: round trip in ecore_x_window_argb_get */ + if (ecore_x_window_argb_get(ee->engine.x.win_root)) + { + ee->prop.window = _ecore_evas_x_gl_window_new + (ee, ee->engine.x.win_root, x, y, w, h, 0, 1, opt); + } + else + ee->prop.window = _ecore_evas_x_gl_window_new + (ee, ee->engine.x.win_root, x, y, w, h, 0, 0, opt); + } + else + ee->prop.window = _ecore_evas_x_gl_window_new + (ee, ee->engine.x.win_root, x, y, w, h, 0, 0, opt); + if (!ee->prop.window) + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + if ((id = getenv("DESKTOP_STARTUP_ID"))) + { + ecore_x_netwm_startup_id_set(ee->prop.window, id); + /* NB: on linux this may simply empty the env as opposed to completely + * unset it to being empty - unsure as solartis libc crashes looking + * for the '=' char */ +// putenv((char*)"DESKTOP_STARTUP_ID="); + } + + ecore_x_icccm_hints_set(ee->prop.window, + 1 /* accepts_focus */, + ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, + 0 /* icon_pixmap */, + 0 /* icon_mask */, + 0 /* icon_window */, + 0 /* window_group */, + 0 /* is_urgent */); + _ecore_evas_x_group_leader_set(ee); + ecore_x_window_defaults_set(ee->prop.window); + _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_sync_set(ee); + + ee->engine.func->fn_render = _ecore_evas_x_render; + _ecore_evas_register(ee); + ecore_x_input_multi_select(ee->prop.window); + ecore_event_window_register(ee->prop.window, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + + return ee; +} +#else +EAPI Ecore_Evas * +ecore_evas_gl_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, + int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) +{ + return NULL; +} +EAPI Ecore_Evas * +ecore_evas_gl_x11_options_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, + int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__, const int *opt __UNUSED__) +{ + return NULL; +} +#endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#ifdef BUILD_ECORE_EVAS_OPENGL_X11 +EAPI Ecore_X_Window +ecore_evas_gl_x11_window_get(const Ecore_Evas *ee) +{ + return (Ecore_X_Window) ecore_evas_window_get(ee); +} +#else +EAPI Ecore_X_Window +ecore_evas_gl_x11_window_get(const Ecore_Evas *ee __UNUSED__) +{ + return 0; +} +#endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#ifdef BUILD_ECORE_EVAS_OPENGL_X11 +EAPI void +ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) +{ + ee->engine.x.direct_resize = on; +} +#else +EAPI void +ecore_evas_gl_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) +{ +} +#endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#ifdef BUILD_ECORE_EVAS_OPENGL_X11 +EAPI Eina_Bool +ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee) +{ + return ee->engine.x.direct_resize; +} +#else +EAPI Eina_Bool +ecore_evas_gl_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__) +{ + return 0; +} +#endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#ifdef BUILD_ECORE_EVAS_OPENGL_X11 +EAPI void +ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) +{ + ecore_evas_software_x11_extra_event_window_add(ee, win); +} +#else +EAPI void +ecore_evas_gl_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) +{ +} +#endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#ifdef BUILD_ECORE_EVAS_OPENGL_X11 +EAPI void +ecore_evas_gl_x11_pre_post_swap_callback_set(const Ecore_Evas *ee, void *data, void (*pre_cb) (void *data, Evas *e), void (*post_cb) (void *data, Evas *e)) +{ + Evas_Engine_Info_GL_X11 *einfo; + + if (!(!strcmp(ee->driver, "opengl_x11"))) return; + + einfo = (Evas_Engine_Info_GL_X11 *)evas_engine_info_get(ee->evas); + if (einfo) + { + einfo->callback.pre_swap = pre_cb; + einfo->callback.post_swap = post_cb; + einfo->callback.data = data; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() for engine '%s' failed.", ee->driver); + } + } +} +#else +EAPI void +ecore_evas_gl_x11_pre_post_swap_callback_set(const Ecore_Evas *ee __UNUSED__, void *data __UNUSED__, void (*pre_cb) (void *data, Evas *e) __UNUSED__, void (*post_cb) (void *data, Evas *e) __UNUSED__) +{ + return; +} +#endif /* ! BUILD_ECORE_EVAS_OPENGL_X11 */ + +/** + * To be documented. + * + * FIXME: To be fixed or maybe removed rather? + */ +EAPI Ecore_Evas * +ecore_evas_xrender_x11_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, + int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) +{ + return NULL; +} + +/** + * To be documented. + * + * FIXME: To be fixed or maybe removed rather? + */ +EAPI Ecore_X_Window +ecore_evas_xrender_x11_window_get(const Ecore_Evas *ee __UNUSED__) +{ + return 0; +} + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI void +ecore_evas_xrender_x11_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) +{ +} + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI Eina_Bool +ecore_evas_xrender_x11_direct_resize_get(const Ecore_Evas *ee __UNUSED__) +{ + return 0; +} + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI void +ecore_evas_xrender_x11_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) +{ +} + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#if BUILD_ECORE_EVAS_SOFTWARE_16_X11 +EAPI Ecore_Evas * +ecore_evas_software_x11_16_new(const char *disp_name, Ecore_X_Window parent, + int x, int y, int w, int h) +{ + Evas_Engine_Info_Software_16_X11 *einfo; + Ecore_Evas *ee; + int rmethod; + static int redraw_debug = -1; + + rmethod = evas_render_method_lookup("software_16_x11"); + if (!rmethod) return NULL; + if (!ecore_x_init(disp_name)) return NULL; + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) return NULL; + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + _ecore_evas_x_init(); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; + + ee->driver = "software_16_x11"; + if (disp_name) ee->name = strdup(disp_name); + + if (w < 1) w = 1; + if (h < 1) h = 1; + ee->x = x; + ee->y = y; + ee->w = w; + ee->h = h; + ee->req.x = ee->x; + ee->req.y = ee->y; + ee->req.w = ee->w; + ee->req.h = ee->h; + + ee->prop.max.w = 32767; + ee->prop.max.h = 32767; + ee->prop.layer = 4; + ee->prop.request_pos = 0; + ee->prop.sticky = 0; + ee->engine.x.state.sticky = 0; + + /* init evas here */ + ee->evas = evas_new(); + evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee); + evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee); + evas_data_attach_set(ee->evas, ee); + evas_output_method_set(ee->evas, rmethod); + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + + ee->engine.x.win_root = parent; + if (parent != 0) + { + /* FIXME: round trip in ecore_x_window_argb_get */ + if (ecore_x_window_argb_get(parent)) + { + ee->prop.window = ecore_x_window_argb_new(parent, x, y, w, h); + } + else + ee->prop.window = ecore_x_window_new(parent, x, y, w, h); + } + else + ee->prop.window = ecore_x_window_new(parent, x, y, w, h); + if (getenv("DESKTOP_STARTUP_ID")) + { + ecore_x_netwm_startup_id_set(ee->prop.window, + getenv("DESKTOP_STARTUP_ID")); + /* NB: on linux this may simply empty the env as opposed to completely + * unset it to being empty - unsure as solartis libc crashes looking + * for the '=' char */ +// putenv((char*)"DESKTOP_STARTUP_ID="); + } + einfo = (Evas_Engine_Info_Software_16_X11 *)evas_engine_info_get(ee->evas); + + if (einfo) + { + if (ScreenCount(ecore_x_display_get()) > 1) + { + Ecore_X_Window *roots; + int num, i; + + num = 0; + roots = ecore_x_window_root_list(&num); + if (roots) + { + XWindowAttributes at; + + if (XGetWindowAttributes(ecore_x_display_get(), + parent, &at)) + { + for (i = 0; i < num; i++) + { + if (at.root == roots[i]) + break; + } + } + free(roots); + } + } + + if (redraw_debug < 0) + { + if (getenv("REDRAW_DEBUG")) + redraw_debug = atoi(getenv("REDRAW_DEBUG")); + else + redraw_debug = 0; + } + einfo->info.display = ecore_x_display_get(); + einfo->info.drawable = ee->prop.window; + + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + + ecore_x_icccm_hints_set(ee->prop.window, + 1 /* accepts_focus */, + ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, + 0 /* icon_pixmap */, + 0 /* icon_mask */, + 0 /* icon_window */, + 0 /* window_group */, + 0 /* is_urgent */); + _ecore_evas_x_group_leader_set(ee); + ecore_x_window_defaults_set(ee->prop.window); + _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_sync_set(ee); + + ee->engine.func->fn_render = _ecore_evas_x_render; + _ecore_evas_register(ee); + ecore_x_input_multi_select(ee->prop.window); + ecore_event_window_register(ee->prop.window, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + return ee; +} +#else +EAPI Ecore_Evas * +ecore_evas_software_x11_16_new(const char *disp_name __UNUSED__, Ecore_X_Window parent __UNUSED__, + int x __UNUSED__, int y __UNUSED__, int w __UNUSED__, int h __UNUSED__) +{ + return NULL; +} +#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#if BUILD_ECORE_EVAS_SOFTWARE_16_X11 +EAPI Ecore_X_Window +ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee) +{ + return (Ecore_X_Window) ecore_evas_window_get(ee); +} +#else +EAPI Ecore_X_Window +ecore_evas_software_x11_16_window_get(const Ecore_Evas *ee __UNUSED__) +{ + return 0; +} +#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#if BUILD_ECORE_EVAS_SOFTWARE_16_X11 +EAPI void +ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) +{ + ee->engine.x.direct_resize = on; + if (ee->prop.avoid_damage) + { + if (ee->engine.x.direct_resize) + { +/* turn this off for now + ee->engine.x.using_bg_pixmap = 1; + ecore_x_window_pixmap_set(ee->prop.window, ee->engine.x.pmap); + */ + } + else + { +/* turn this off too- bg pixmap is controlled by avoid damage directly + ee->engine.x.using_bg_pixmap = 0; + ecore_x_window_pixmap_set(ee->prop.window, 0); + ecore_x_window_area_expose(ee->prop.window, 0, 0, ee->w, ee->h); + */ + } + } +} +#else +EAPI void +ecore_evas_software_x11_16_direct_resize_set(Ecore_Evas *ee __UNUSED__, Eina_Bool on __UNUSED__) +{ +} +#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#if BUILD_ECORE_EVAS_SOFTWARE_16_X11 +EAPI Eina_Bool +ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee) +{ + return ee->engine.x.direct_resize; +} +#else +EAPI Eina_Bool +ecore_evas_software_x11_16_direct_resize_get(const Ecore_Evas *ee __UNUSED__) +{ + return 0; +} +#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +#if BUILD_ECORE_EVAS_SOFTWARE_16_X11 +EAPI void +ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) +{ + Ecore_X_Window *winp; + + winp = malloc(sizeof(Ecore_X_Window)); + if (winp) + { + *winp = win; + ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp); + ecore_x_input_multi_select(win); + ecore_event_window_register(win, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + } +} +#else +EAPI void +ecore_evas_software_x11_16_extra_event_window_add(Ecore_Evas *ee __UNUSED__, Ecore_X_Window win __UNUSED__) +{ +} +#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_16_X11 */ + + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI Ecore_Evas * +ecore_evas_software_x11_8_new(const char *disp_name, Ecore_X_Window parent, + int x, int y, int w, int h) +{ +#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) + Evas_Engine_Info_Software_8_X11 *einfo; + Ecore_Evas *ee; + int argb = 0; + int rmethod; + static int redraw_debug = -1; + + rmethod = evas_render_method_lookup("software_8_x11"); + if (!rmethod) return NULL; + if (!ecore_x_init(disp_name)) return NULL; + ee = calloc(1, sizeof(Ecore_Evas)); + if (!ee) return NULL; + + ECORE_MAGIC_SET(ee, ECORE_MAGIC_EVAS); + + _ecore_evas_x_init(); + + ee->engine.func = (Ecore_Evas_Engine_Func *)&_ecore_x_engine_func; + + ee->driver = "software_8_x11"; + if (disp_name) ee->name = strdup(disp_name); + + if (w < 1) w = 1; + if (h < 1) h = 1; + ee->x = x; + ee->y = y; + ee->w = w; + ee->h = h; + ee->req.x = ee->x; + ee->req.y = ee->y; + ee->req.w = ee->w; + ee->req.h = ee->h; + + ee->prop.max.w = 32767; + ee->prop.max.h = 32767; + ee->prop.layer = 4; + ee->prop.request_pos = 0; + ee->prop.sticky = 0; + ee->engine.x.state.sticky = 0; + + /* init evas here */ + ee->evas = evas_new(); + evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_PRE, _ecore_evas_x_flush_pre, ee); + evas_event_callback_add(ee->evas, EVAS_CALLBACK_RENDER_FLUSH_POST, _ecore_evas_x_flush_post, ee); + evas_data_attach_set(ee->evas, ee); + evas_output_method_set(ee->evas, rmethod); + evas_output_size_set(ee->evas, w, h); + evas_output_viewport_set(ee->evas, 0, 0, w, h); + + ee->engine.x.win_root = parent; + // if (parent != 0) + // { + // /* FIXME: round trip in ecore_x_window_argb_get */ + // if (ecore_x_window_argb_get(parent)) + // { + // ee->engine.x.win = ecore_x_window_argb_new(parent, x, y, w, h); + // argb = 1; + // } + // else + // ee->engine.x.win = ecore_x_window_new(parent, x, y, w, h); + // } + // else + ee->prop.window = ecore_x_window_new(parent, x, y, w, h); + if (getenv("DESKTOP_STARTUP_ID")) + { + ecore_x_netwm_startup_id_set(ee->prop.window, + getenv("DESKTOP_STARTUP_ID")); + /* NB: on linux this may simply empty the env as opposed to completely + * unset it to being empty - unsure as solartis libc crashes looking + * for the '=' char */ + // putenv((char*)"DESKTOP_STARTUP_ID="); + } + einfo = (Evas_Engine_Info_Software_8_X11 *)evas_engine_info_get(ee->evas); + if (einfo) + { + xcb_screen_iterator_t iter; + xcb_screen_t *screen; + + /* FIXME: this is inefficient as its a round trip */ + //einfo->info.backend = 1; + screen = ecore_x_default_screen_get(); + iter = xcb_setup_roots_iterator (xcb_get_setup (ecore_x_connection_get())); + if (iter.rem > 1) + { + xcb_get_geometry_cookie_t cookie; + xcb_get_geometry_reply_t *reply; + Ecore_X_Window *roots; + int num; + uint8_t i; + + num = 0; + cookie = xcb_get_geometry_unchecked(ecore_x_connection_get(), parent); + roots = ecore_x_window_root_list(&num); + if (roots) + { + reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL); + + if (reply) + { + for (i = 0; i < num; xcb_screen_next (&iter), i++) + { + if (reply->root == roots[i]) + { + screen = iter.data; + break; + } + } + free(reply); + } + free(roots); + } + else + { + reply = xcb_get_geometry_reply(ecore_x_connection_get(), cookie, NULL); + if (reply) free(reply); + } + } + + if (redraw_debug < 0) + { + if (getenv("REDRAW_DEBUG")) + redraw_debug = atoi(getenv("REDRAW_DEBUG")); + else + redraw_debug = 0; + } + einfo->info.connection = ecore_x_connection_get(); + einfo->info.screen = screen; + einfo->info.drawable = ee->prop.window; + if (argb) + { + /* FIXME: round trip */ + xcb_get_geometry_cookie_t cookie_geom; + xcb_get_window_attributes_cookie_t cookie_attr; + xcb_get_geometry_reply_t *reply_geom; + xcb_get_window_attributes_reply_t *reply_attr; + + cookie_geom = xcb_get_geometry_unchecked(ecore_x_connection_get(), ee->prop.window); + cookie_attr = xcb_get_window_attributes_unchecked(ecore_x_connection_get(), ee->prop.window); + + reply_geom = xcb_get_geometry_reply(ecore_x_connection_get(), cookie_geom, NULL); + reply_attr = xcb_get_window_attributes_reply(ecore_x_connection_get(), cookie_attr, NULL); + if (reply_attr && reply_geom) + { + einfo->info.visual = xcb_visualtype_get(ecore_x_default_screen_get(), reply_attr->visual); + einfo->info.colormap = reply_attr->colormap; + einfo->info.depth = reply_geom->depth; + einfo->info.destination_alpha = 1; + free(reply_geom); + free(reply_attr); + } + } + else + { + xcb_screen_t *screen; + + screen = ecore_x_default_screen_get(); + einfo->info.visual = xcb_visualtype_get(screen, screen->root_visual); + einfo->info.colormap = screen->default_colormap; + einfo->info.depth = screen->root_depth; + einfo->info.destination_alpha = 0; + } + einfo->info.rotation = 0; + einfo->info.debug = redraw_debug; + if (!evas_engine_info_set(ee->evas, (Evas_Engine_Info *)einfo)) + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + } + else + { + ERR("evas_engine_info_set() init engine '%s' failed.", ee->driver); + ecore_evas_free(ee); + return NULL; + } + + ecore_x_icccm_hints_set(ee->prop.window, + 1 /* accepts_focus */, + ECORE_X_WINDOW_STATE_HINT_NORMAL /* initial_state */, + 0 /* icon_pixmap */, + 0 /* icon_mask */, + 0 /* icon_window */, + 0 /* window_group */, + 0 /* is_urgent */); + _ecore_evas_x_group_leader_set(ee); + ecore_x_window_defaults_set(ee->prop.window); + _ecore_evas_x_protocols_set(ee); + _ecore_evas_x_sync_set(ee); + + ee->engine.func->fn_render = _ecore_evas_x_render; + _ecore_evas_register(ee); + ecore_x_input_multi_select(ee->prop.window); + ecore_event_window_register(ee->prop.window, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + + return ee; +#else + return NULL; + (void)(disp_name); + (void)(parent); + (void)(x); + (void)(y); + (void)(w); + (void)(h); +#endif /* ! BUILD_ECORE_EVAS_SOFTWARE_8_X11 */ +} + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI Ecore_X_Window +ecore_evas_software_x11_8_window_get(const Ecore_Evas *ee) +{ +#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) + return (Ecore_X_Window) ecore_evas_window_get(ee); +#else + return 0; + (void)(ee); +#endif +} + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI Ecore_X_Window +ecore_evas_software_x11_8_subwindow_get(const Ecore_Evas *ee) +{ +#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) + return (Ecore_X_Window) ecore_evas_window_get(ee); +#else + return 0; + (void)(ee); +#endif +} + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI void +ecore_evas_software_x11_8_direct_resize_set(Ecore_Evas *ee, Eina_Bool on) +{ +#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) + ee->engine.x.direct_resize = on; + if (ee->prop.avoid_damage) + { + if (ee->engine.x.direct_resize) + { + /* turn this off for now + ee->engine.x.using_bg_pixmap = 1; + ecore_x_window_pixmap_set(ee->engine.x.win, ee->engine.x.pmap); + */ + } + else + { + /* turn this off too- bg pixmap is controlled by avoid damage directly + ee->engine.x.using_bg_pixmap = 0; + ecore_x_window_pixmap_set(ee->engine.x.win, 0); + ecore_x_window_area_expose(ee->engine.x.win, 0, 0, ee->w, ee->h); + */ + } + } +#else + return; + (void)(ee); + (void)(on); +#endif +} + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI Eina_Bool +ecore_evas_software_x11_8_direct_resize_get(const Ecore_Evas *ee) +{ +#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) + return ee->engine.x.direct_resize; +#else + return 0; + (void)(ee); +#endif +} + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI void +ecore_evas_software_x11_8_extra_event_window_add(Ecore_Evas *ee, Ecore_X_Window win) +{ +#if defined (BUILD_ECORE_EVAS_SOFTWARE_8_X11) + Ecore_X_Window *winp; + + winp = malloc(sizeof(Ecore_X_Window)); + if (winp) + { + *winp = win; + ee->engine.x.win_extra = eina_list_append(ee->engine.x.win_extra, winp); + ecore_x_input_multi_select(win); + ecore_event_window_register(win, ee, ee->evas, + (Ecore_Event_Mouse_Move_Cb)_ecore_evas_mouse_move_process, + (Ecore_Event_Multi_Move_Cb)_ecore_evas_mouse_multi_move_process, + (Ecore_Event_Multi_Down_Cb)_ecore_evas_mouse_multi_down_process, + (Ecore_Event_Multi_Up_Cb)_ecore_evas_mouse_multi_up_process); + } +#else + return; + (void)(ee); + (void)(win); +#endif +} + +EAPI void +ecore_evas_x11_leader_set(Ecore_Evas *ee, Ecore_X_Window win) +{ +#ifdef BUILD_ECORE_EVAS_X11 + _ecore_evas_x_group_leader_unset(ee); + ee->engine.x.leader = win; + _ecore_evas_x_group_leader_update(ee); +#else + return; + ee = NULL; + win = 0; +#endif +} + +EAPI Ecore_X_Window +ecore_evas_x11_leader_get(Ecore_Evas *ee) +{ +#ifdef BUILD_ECORE_EVAS_X11 + return ee->engine.x.leader; +#else + return 0; + ee = NULL; +#endif +} + +EAPI void +ecore_evas_x11_leader_default_set(Ecore_Evas *ee) +{ +#ifdef BUILD_ECORE_EVAS_X11 + _ecore_evas_x_group_leader_unset(ee); + _ecore_evas_x_group_leader_set(ee); +#else + return; + ee = NULL; +#endif +} + +#ifdef BUILD_ECORE_EVAS_X11 +static Eina_Bool +_ecore_evas_x11_convert_rectangle_with_angle(Ecore_Evas *ee, Ecore_X_Rectangle *dst_rect, Ecore_X_Rectangle *src_rect) +{ + if ((!src_rect) || (!dst_rect)) return 0; + + if (ee->rotation == 0) + { + dst_rect->x = src_rect->x; + dst_rect->y = src_rect->y; + dst_rect->width = src_rect->width; + dst_rect->height = src_rect->height; + } + else if (ee->rotation == 90) + { + dst_rect->x = src_rect->y; + dst_rect->y = ee->req.h - src_rect->x - src_rect->width; + dst_rect->width = src_rect->height; + dst_rect->height = src_rect->width; + } + else if (ee->rotation == 180) + { + dst_rect->x = ee->req.w - src_rect->x - src_rect->width; + dst_rect->y = ee->req.h - src_rect->y - src_rect->height; + dst_rect->width = src_rect->width; + dst_rect->height = src_rect->height; + } + else if (ee->rotation == 270) + { + dst_rect->x = ee->req.w - src_rect->y - src_rect->height; + dst_rect->y = src_rect->x; + dst_rect->width = src_rect->height; + dst_rect->height = src_rect->width; + } + else + { + return 0; + } + + return 1; +} +#endif + +EAPI void +ecore_evas_x11_shape_input_rectangle_set(Ecore_Evas *ee, int x, int y, int w, int h) +{ +#ifdef BUILD_ECORE_EVAS_X11 + Eina_Bool ret; + Ecore_X_Rectangle src_rect; + Ecore_X_Rectangle dst_rect; + + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_x11_shape_input_rectangle_set"); + return; + } + + src_rect.x = x; + src_rect.y = y; + src_rect.width = w; + src_rect.height = h; + + dst_rect.x = 0; + dst_rect.y = 0; + dst_rect.width = 0; + dst_rect.height = 0; + + ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect); + + if (!ee->engine.x.win_shaped_input) + ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, + 0, 0, 1, 1); + + if (ret) + ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, + dst_rect.x, dst_rect.y, + dst_rect.width, dst_rect.height); +#else + return; + ee = NULL; + x = 0; + y = 0; + w = 0; + h = 0; +#endif +} + +EAPI void +ecore_evas_x11_shape_input_rectangle_add(Ecore_Evas *ee, int x, int y, int w, int h) +{ +#ifdef BUILD_ECORE_EVAS_X11 + Eina_Bool ret; + Ecore_X_Rectangle src_rect; + Ecore_X_Rectangle dst_rect; + + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_x11_shape_input_rectangle_add"); + return; + } + + src_rect.x = x; + src_rect.y = y; + src_rect.width = w; + src_rect.height = h; + + dst_rect.x = 0; + dst_rect.y = 0; + dst_rect.width = 0; + dst_rect.height = 0; + + ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect); + + if (!ee->engine.x.win_shaped_input) + ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, + 0, 0, 1, 1); + + if (ret) + ecore_x_window_shape_input_rectangle_add(ee->engine.x.win_shaped_input, + dst_rect.x, dst_rect.y, + dst_rect.width, dst_rect.height); +#else + return; + ee = NULL; + x = 0; + y = 0; + w = 0; + h = 0; +#endif +} + +EAPI void +ecore_evas_x11_shape_input_rectangle_subtract(Ecore_Evas *ee, int x, int y, int w, int h) +{ +#ifdef BUILD_ECORE_EVAS_X11 + Eina_Bool ret; + Ecore_X_Rectangle src_rect; + Ecore_X_Rectangle dst_rect; + + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_x11_shape_input_rectangle_subtract"); + return; + } + + src_rect.x = x; + src_rect.y = y; + src_rect.width = w; + src_rect.height = h; + + dst_rect.x = 0; + dst_rect.y = 0; + dst_rect.width = 0; + dst_rect.height = 0; + + ret = _ecore_evas_x11_convert_rectangle_with_angle(ee, &dst_rect, &src_rect); + + if (!ee->engine.x.win_shaped_input) + ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, + 0, 0, 1, 1); + + if (ret) + ecore_x_window_shape_input_rectangle_subtract(ee->engine.x.win_shaped_input, + dst_rect.x, dst_rect.y, + dst_rect.width, dst_rect.height); +#else + return; + ee = NULL; + x = 0; + y = 0; + w = 0; + h = 0; +#endif +} + +EAPI void +ecore_evas_x11_shape_input_empty(Ecore_Evas *ee) +{ +#ifdef BUILD_ECORE_EVAS_X11 + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_x11_shape_input_empty"); + return; + } + + if (!ee->engine.x.win_shaped_input) + ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, 0, 0, 1, 1); + + ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, 0, 0, 0, 0); +#else + return; + ee = NULL; +#endif +} + +EAPI void +ecore_evas_x11_shape_input_reset(Ecore_Evas *ee) +{ +#ifdef BUILD_ECORE_EVAS_X11 + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_x11_shape_input_reset"); + return; + } + + if (!ee->engine.x.win_shaped_input) + ee->engine.x.win_shaped_input = ecore_x_window_override_new(ee->engine.x.win_root, 0, 0, 1, 1); + + ecore_x_window_shape_input_rectangle_set(ee->engine.x.win_shaped_input, 0, 0, 65535, 65535); +#else + return; + ee = NULL; +#endif +} + +EAPI void +ecore_evas_x11_shape_input_apply(Ecore_Evas *ee) +{ +#ifdef BUILD_ECORE_EVAS_X11 + if (!ECORE_MAGIC_CHECK(ee, ECORE_MAGIC_EVAS)) + { + ECORE_MAGIC_FAIL(ee, ECORE_MAGIC_EVAS, + "ecore_evas_x11_shape_input_apply"); + return; + } + + if (!ee->engine.x.win_shaped_input) return; + + ecore_x_window_shape_input_window_set(ee->prop.window, ee->engine.x.win_shaped_input); +#else + return; + ee = NULL; +#endif +} diff --git a/libraries/ecore/src/lib/ecore_fb/Ecore_Fb.h b/libraries/ecore/src/lib/ecore_fb/Ecore_Fb.h new file mode 100644 index 0000000..069cccd --- /dev/null +++ b/libraries/ecore/src/lib/ecore_fb/Ecore_Fb.h @@ -0,0 +1,100 @@ +#ifndef _ECORE_FB_H +#define _ECORE_FB_H + +#include + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +#else +# define EAPI +#endif + +/* FIXME: + * maybe a new module? + * - code to get battery info + * - code to get thermal info + * ecore evas fb isn't good enough for weird things, like multiple fb's, same happens here. + * backlight support using new kernel interface + * absolute axis + * joystick + * ecore_fb_li_device_close_all ? or a shutdown of the subsystem? + * + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup Ecore_FB_Group Ecore_FB - Frame buffer convenience functions. + * + * Functions used to set up and shut down the Ecore_Framebuffer functions. + * + * @{ + */ + +/** + * @typedef Ecore_Fb_Input_Device + * Input device handler. + */ +typedef struct _Ecore_Fb_Input_Device Ecore_Fb_Input_Device; + +/** + * @enum _Ecore_Fb_Input_Device_Cap + * Device capabilities. + */ +enum _Ecore_Fb_Input_Device_Cap +{ + ECORE_FB_INPUT_DEVICE_CAP_NONE = 0x00000000, + ECORE_FB_INPUT_DEVICE_CAP_RELATIVE = 0x00000001, + ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE = 0x00000002, + ECORE_FB_INPUT_DEVICE_CAP_KEYS_OR_BUTTONS = 0x00000004 +}; + +/** + * @typedef Ecore_Fb_Input_Device_Cap + * Device capabilities. + */ +typedef enum _Ecore_Fb_Input_Device_Cap Ecore_Fb_Input_Device_Cap; + +/* ecore_fb_vt.c */ +EAPI void ecore_fb_callback_gain_set(void (*func) (void *data), void *data); +EAPI void ecore_fb_callback_lose_set(void (*func) (void *data), void *data); + +/* ecore_fb_li.c */ +EAPI Ecore_Fb_Input_Device *ecore_fb_input_device_open(const char *dev); +EAPI void ecore_fb_input_device_close(Ecore_Fb_Input_Device *dev); +EAPI void ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen); +EAPI const char *ecore_fb_input_device_name_get(Ecore_Fb_Input_Device *dev); +EAPI Ecore_Fb_Input_Device_Cap ecore_fb_input_device_cap_get(Ecore_Fb_Input_Device *dev); +EAPI void ecore_fb_input_device_axis_size_set(Ecore_Fb_Input_Device *dev, int w, int h); +EAPI void ecore_fb_input_threshold_click_set(Ecore_Fb_Input_Device *dev, double threshold); +EAPI double ecore_fb_input_threshold_click_get(Ecore_Fb_Input_Device *dev); +EAPI void ecore_fb_input_device_window_set(Ecore_Fb_Input_Device *dev, void *window); + +/* ecore_fb.c */ + +EAPI int ecore_fb_init(const char *name); +EAPI int ecore_fb_shutdown(void); +EAPI void ecore_fb_size_get(int *w, int *h); + +EAPI void ecore_fb_touch_screen_calibrate_set(int xscale, int xtrans, int yscale, int ytrans, int xyswap); +EAPI void ecore_fb_touch_screen_calibrate_get(int *xscale, int *xtrans, int *yscale, int *ytrans, int *xyswap); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/ecore/src/lib/ecore_fb/Makefile.am b/libraries/ecore/src/lib/ecore_fb/Makefile.am new file mode 100644 index 0000000..9129fec --- /dev/null +++ b/libraries/ecore/src/lib/ecore_fb/Makefile.am @@ -0,0 +1,34 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +@TSLIB_CFLAGS@ \ +@EINA_CFLAGS@ + + +lib_LTLIBRARIES = libecore_fb.la +includes_HEADERS = Ecore_Fb.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_fb_la_SOURCES = \ +ecore_fb.c \ +ecore_fb_vt.c \ +ecore_fb_li.c \ +ecore_fb_ts.c +# deprecated sources (might not compile): +# ecore_fb_kbd.c +# ecore_fb_ps2.c + +libecore_fb_la_LIBADD = \ +@TSLIB_LIBS@ \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@EINA_LIBS@ + +libecore_fb_la_LDFLAGS = -version-info @version_info@ @release_info@ + +EXTRA_DIST = \ +ecore_fb_private.h \ +ecore_fb_keytable.h diff --git a/libraries/ecore/src/lib/ecore_fb/Makefile.in b/libraries/ecore/src/lib/ecore_fb/Makefile.in new file mode 100644 index 0000000..b37120f --- /dev/null +++ b/libraries/ecore/src/lib/ecore_fb/Makefile.in @@ -0,0 +1,831 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_fb +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_fb_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore/libecore.la \ + $(top_builddir)/src/lib/ecore_input/libecore_input.la +am_libecore_fb_la_OBJECTS = ecore_fb.lo ecore_fb_vt.lo ecore_fb_li.lo \ + ecore_fb_ts.lo +libecore_fb_la_OBJECTS = $(am_libecore_fb_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_fb_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libecore_fb_la_LDFLAGS) $(LDFLAGS) -o \ + $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_fb_la_SOURCES) +DIST_SOURCES = $(libecore_fb_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +@TSLIB_CFLAGS@ \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_fb.la +includes_HEADERS = Ecore_Fb.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_fb_la_SOURCES = \ +ecore_fb.c \ +ecore_fb_vt.c \ +ecore_fb_li.c \ +ecore_fb_ts.c + +# deprecated sources (might not compile): +# ecore_fb_kbd.c +# ecore_fb_ps2.c +libecore_fb_la_LIBADD = \ +@TSLIB_LIBS@ \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@EINA_LIBS@ + +libecore_fb_la_LDFLAGS = -version-info @version_info@ @release_info@ +EXTRA_DIST = \ +ecore_fb_private.h \ +ecore_fb_keytable.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_fb/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_fb/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_fb.la: $(libecore_fb_la_OBJECTS) $(libecore_fb_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_fb_la_LINK) -rpath $(libdir) $(libecore_fb_la_OBJECTS) $(libecore_fb_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_fb.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_fb_li.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_fb_ts.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_fb_vt.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_fb/ecore_fb.c b/libraries/ecore/src/lib/ecore_fb/ecore_fb.c new file mode 100644 index 0000000..ca7d73d --- /dev/null +++ b/libraries/ecore/src/lib/ecore_fb/ecore_fb.c @@ -0,0 +1,114 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "Ecore_Fb.h" +#include "ecore_fb_private.h" + +static void _ecore_fb_size_get(int *w, int *h); + +static int _ecore_fb_init_count = 0; +static int _ecore_fb_console_w = 0; +static int _ecore_fb_console_h = 0; + +/** + * @addtogroup Ecore_FB_Group Ecore_FB - Frame buffer convenience functions. + * + * @{ + */ + +/** + * @brief Initialize the Ecore_Fb library. + * + * @param name Device target name. + * @return 1 or greater on success, 0 on error. + * + * This function sets up all the Ecore_Fb library. It returns 0 on + * failure, otherwise it returns the number of times it has already + * been called. + * + * When Ecore_Fb is not used anymore, call ecore_fb_shutdown() to shut down + * the Ecore_Fb library. + */ +EAPI int +ecore_fb_init(const char *name __UNUSED__) +{ + if (++_ecore_fb_init_count != 1) + return _ecore_fb_init_count; + + if (!ecore_fb_vt_init()) + return --_ecore_fb_init_count; + + _ecore_fb_size_get(&_ecore_fb_console_w, &_ecore_fb_console_h); + + return _ecore_fb_init_count; +} + +/** + * @brief Shut down the Ecore_Fb library. + * + * @return 0 when the library is completely shut down, 1 or + * greater otherwise. + * + * This function shuts down the Ecore_Fb library. It returns 0 when it has + * been called the same number of times than ecore_fb_init(). + */ +EAPI int +ecore_fb_shutdown(void) +{ + if (--_ecore_fb_init_count != 0) + return _ecore_fb_init_count; + + ecore_fb_vt_shutdown(); + + return _ecore_fb_init_count; +} + + +/** + * @brief Retrieve the width and height of the current frame buffer in + * pixels. + * + * @param w Pointer to an integer in which to store the width. + * @param h Pointer to an interge in which to store the height. + * + * This function retrieves the size of the current frame buffer in + * pixels. @p w and @p h can be buffers that will be filled with the + * corresponding values. If one of them is @c NULL, nothing will be + * done for that parameter. + */ +EAPI void +ecore_fb_size_get(int *w, int *h) +{ + if (w) *w = _ecore_fb_console_w; + if (h) *h = _ecore_fb_console_h; +} + +static void +_ecore_fb_size_get(int *w, int *h) +{ + struct fb_var_screeninfo fb_var; + int fb; + + fb = open("/dev/fb0", O_RDWR); + if (fb < 0) + { + if (w) *w = 0; + if (h) *h = 0; + return; + } + if (ioctl(fb, FBIOGET_VSCREENINFO, &fb_var) == -1) + { + if (w) *w = 0; + if (h) *h = 0; + close(fb); + return; + } + close(fb); + if (w) *w = fb_var.xres; + if (h) *h = fb_var.yres; +} + +/** + * @} + */ diff --git a/libraries/ecore/src/lib/ecore_fb/ecore_fb_keytable.h b/libraries/ecore/src/lib/ecore_fb/ecore_fb_keytable.h new file mode 100644 index 0000000..38de7bf --- /dev/null +++ b/libraries/ecore/src/lib/ecore_fb/ecore_fb_keytable.h @@ -0,0 +1,129 @@ +/* this table was taken from ecore_fb, is the default en layout */ + "0x00", "0x00", "0x00", /**/"", "", "",/***/ + "Escape", "Escape", "Escape", /**/"", "", "",/***/ + "1", "exclam", "1", /**/"1", "!", "1",/***/ + "2", "at", "2", /**/"2", "@", "2",/***/ + "3", "numbersign", "3", /**/"3", "#", "3",/***/ + "4", "dollar", "4", /**/"4", "$", "4",/***/ + "5", "percent", "5", /**/"5", "%", "5",/***/ + "6", "asciicircumm", "6", /**/"6", "^", "6",/***/ + "7", "ampersand", "7", /**/"7", "&", "7",/***/ + "8", "asterisk", "8", /**/"8", "*", "8",/***/ + "9", "parenleft", "9", /**/"9", "(", "9",/***/ + "0", "parenright", "0", /**/"0", ")", "0",/***/ + "minus", "underscore", "minus", /**/"-", "_", "-",/***/ + "equal", "plus", "equal", /**/"=", "+", "=",/***/ + "BackSpace", "BackSpace", "BackSpace", /**/"\010","\010","\010",/***/ + "Tab", "ISO_Left_Tab", "Tab", /**/"\011","", "\011",/***/ + "q", "Q", "Q", /**/"q", "Q", "Q",/***/ + "w", "W", "W", /**/"w", "W", "W",/***/ + "e", "E", "E", /**/"e", "E", "E",/***/ + "r", "R", "R", /**/"r", "R", "R",/***/ + "t", "T", "T", /**/"t", "T", "T",/***/ + "y", "Y", "Y", /**/"y", "Y", "Y",/***/ + "u", "U", "U", /**/"u", "U", "U",/***/ + "i", "I", "I", /**/"i", "I", "I",/***/ + "o", "O", "O", /**/"o", "O", "O",/***/ + "p", "P", "P", /**/"p", "P", "P",/***/ + "bracketleft", "braceleft", "bracketleft", /**/"[", "{", "[",/***/ + "bracketright", "braceright", "bracketright", /**/"]", "}", "]",/***/ + "Return", "Return", "Return", /**/"\015","\015","\015",/***/ + "Control_L", "Control_L", "Control_L", /**/"", "", "",/***/ + "a", "A", "A", /**/"a", "A", "A",/***/ + "s", "S", "S", /**/"s", "S", "S",/***/ + "d", "D", "D", /**/"d", "D", "D",/***/ + "f", "F", "F", /**/"f", "F", "F",/***/ + "g", "G", "G", /**/"g", "G", "G",/***/ + "h", "h", "H", /**/"h", "H", "H",/***/ + "j", "J", "J", /**/"j", "J", "J",/***/ + "k", "K", "K", /**/"k", "K", "K",/***/ + "l", "L", "L", /**/"l", "L", "L",/***/ + "semicolon", "colon", "semicolon", /**/";", ":", ";",/***/ + "apostrophe", "quotedbl", "apostrophe", /**/"'", "\"", "'",/***/ + "grave", "asciitilde", "grave", /**/"`", "~", "`",/***/ + "Shift_L", "Shift_L", "Shift_L", /**/"", "", "",/***/ + "backslash", "bar", "backslash", /**/"\\", "|", "\\",/***/ + "z", "Z", "Z", /**/"z", "Z", "Z",/***/ + "x", "X", "X", /**/"x", "X", "X",/***/ + "c", "C", "C", /**/"c", "C", "C",/***/ + "v", "V", "V", /**/"v", "V", "V",/***/ + "b", "B", "B", /**/"b", "B", "B",/***/ + "n", "N", "N", /**/"n", "N", "N",/***/ + "m", "M", "M", /**/"m", "M", "M",/***/ + "comma", "less", "comma", /**/",", "<", ",",/***/ + "period", "greater", "period", /**/".", ">", ".",/***/ + "slash", "question", "slash", /**/"/", "?", "/",/***/ + "Shift_R", "Shift_R", "Shift_R", /**/"", "", "",/***/ + "KP_Multiply", "KP_Multiply", "KP_Multiply", /**/"", "*", "",/***/ + "Alt_L", "Alt_L", "Alt_L", /**/"", "", "",/***/ + "space", "space", "space", /**/" ", " ", " ",/***/ + "Caps_Lock", "Caps_Lock", "Caps_Lock", /**/"", "", "",/***/ + "F1", "F1", "F1", /**/"", "", "",/***/ + "F2", "F2", "F2", /**/"", "", "",/***/ + "F3", "F3", "F3", /**/"", "", "",/***/ + "F4", "F4", "F4", /**/"", "", "",/***/ + "F5", "F5", "F5", /**/"", "", "",/***/ + "F6", "F6", "F6", /**/"", "", "",/***/ + "F7", "F7", "F7", /**/"", "", "",/***/ + "F8", "F8", "F8", /**/"", "", "",/***/ + "F9", "F9", "F9", /**/"", "", "",/***/ + "F10", "F10", "F10", /**/"", "", "",/***/ + "Num_Lock", "Num_Lock", "Num_Lock", /**/"", "", "",/***/ + "Scroll_Lock", "Scroll_Lock", "Scroll_Lock", /**/"", "", "",/***/ + "KP_Home", "KP_7", "KP_Home", /**/"", "7", "",/***/ + "KP_Up", "KP_8", "KP_Up", /**/"", "8", "",/***/ + "KP_Prior", "KP_9", "KP_Prior", /**/"", "9", "",/***/ + "KP_Subtract", "KP_Subtract", "KP_Subtract", /**/"", "", "",/***/ + "KP_Left", "KP_4", "KP_Left", /**/"", "4", "",/***/ + "KP_Begin", "KP_5", "KP_Begin", /**/"", "5", "",/***/ + "KP_Right", "KP_6", "KP_Right", /**/"", "6", "",/***/ + "KP_Add", "KP_Add", "KP_Add", /**/"", "", "",/***/ + "KP_End", "KP_1", "KP_End", /**/"", "1", "",/***/ + "KP_Down", "KP_2", "KP_Down", /**/"", "2", "",/***/ + "KP_Next", "KP_3", "KP_Next", /**/"", "3", "",/***/ + "KP_Insert", "KP_0", "KP_Insert", /**/"", "0", "",/***/ + "KP_Delete", "KP_Decimal", "KP_Delete", /**/"", ".", "",/***/ + "0x54", "0x54", "0x54", /**/"", "", "",/***/ + "0x55", "0x55", "0x55", /**/"", "", "",/***/ + "0x56", "0x56", "0x56", /**/"", "", "",/***/ + "F11", "F11", "F11", /**/"", "", "",/***/ + "F12", "F12", "F12", /**/"", "", "",/***/ + "0x59", "0x59", "0x59", /**/"", "", "",/***/ + "0x5a", "0x5a", "0x5a", /**/"", "", "",/***/ + "0x5b", "0x5b", "0x5b", /**/"", "", "",/***/ + "0x5c", "0x5c", "0x5c", /**/"", "", "",/***/ + "0x5d", "0x5d", "0x5d", /**/"", "", "",/***/ + "0x5e", "0x5e", "0x5e", /**/"", "", "",/***/ + "0x5f", "0x5f", "0x5f", /**/"", "", "",/***/ + "KP_Enter", "KP_Enter", "KP_Enter", /**/"", "", "",/***/ + "Control_R", "Control_R", "Control_R", /**/"", "", "",/***/ + "KP_Divide", "KP_Divide", "KP_Divide", /**/"", "", "",/***/ + "Print", "Print", "Print", /**/"", "", "",/***/ + "Alt_R", "Alt_R", "Alt_R", /**/"", "", "",/***/ + "0x65", "0x65", "0x65", /**/"", "", "",/***/ + "Home", "Home", "Home", /**/"", "", "",/***/ + "Up", "Up", "Up", /**/"", "", "",/***/ + "Prior", "Prior", "Prior", /**/"", "", "",/***/ + "Left", "Left", "Left", /**/"", "", "",/***/ + "Right", "Right", "Right", /**/"", "", "",/***/ + "End", "End", "End", /**/"", "", "",/***/ + "Down", "Down", "Down", /**/"", "", "",/***/ + "Next", "Next", "Next", /**/"", "", "",/***/ + "Insert", "Insert", "Insert", /**/"", "", "",/***/ + "Delete", "Delete", "Delete", /**/"\177","\177","\177",/***/ + "0x70", "0x70", "0x70", /**/"", "", "",/***/ + "0x71", "0x71", "0x71", /**/"", "", "",/***/ + "0x72", "0x72", "0x72", /**/"", "", "",/***/ + "0x73", "0x73", "0x73", /**/"", "", "",/***/ + "0x74", "0x74", "0x74", /**/"", "", "",/***/ + "0x75", "0x75", "0x75", /**/"", "", "",/***/ + "0x76", "0x76", "0x76", /**/"", "", "",/***/ + "Pause", "Pause", "Pause", /**/"", "", "",/***/ + "0x78", "0x78", "0x78", /**/"", "", "",/***/ + "0x79", "0x79", "0x79", /**/"", "", "",/***/ + "0x7a", "0x7a", "0x7a", /**/"", "", "",/***/ + "0x7b", "0x7b", "0x7b", /**/"", "", "",/***/ + "0x7c", "0x7c", "0x7c", /**/"", "", "",/***/ + "Super_L", "Super_L", "Super_L", /**/"", "", "",/***/ + "Super_R", "Super_R", "Super_R", /**/"", "", "",/***/ + "0x7f", "0x7f", "0x7f", /**/"", "", "" /***/ diff --git a/libraries/ecore/src/lib/ecore_fb/ecore_fb_li.c b/libraries/ecore/src/lib/ecore_fb/ecore_fb_li.c new file mode 100644 index 0000000..4a196dd --- /dev/null +++ b/libraries/ecore/src/lib/ecore_fb/ecore_fb_li.c @@ -0,0 +1,706 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "Ecore_Fb.h" +#include "ecore_fb_private.h" + +#define CLICK_THRESHOLD_DEFAULT 0.25 + +static Eina_List *_ecore_fb_li_devices = NULL; + +static const char *_ecore_fb_li_kbd_syms[128 * 6] = +{ +#include "ecore_fb_keytable.h" +}; + +/* Initial Copyright (C) Brad Hards (1999-2002), + * this function is used to tell if "bit" is set in "array" + * it selects a byte from the array, and does a boolean AND + * operation with a byte that only has the relevant bit set. + * eg. to check for the 12th bit, we do (array[1] & 1<<4). + * Moved to static inline in order to force compiler to otimized + * the unsued part away or force a link error if long has an unexpected + * size. + * - bigeasy + */ +extern int long_has_neither_32_nor_64_bits(void); +static inline int +test_bit(int bit, unsigned long *array) +{ + if (sizeof(long) == 4) + return array[bit / 32] & (1 << (bit % 32)); + else if (sizeof(long) == 8) + return array[bit / 64] & (1 << (bit % 64)); + else long_has_neither_32_nor_64_bits(); +} + +static void +_ecore_fb_li_device_event_key(Ecore_Fb_Input_Device *dev, struct input_event *iev) +{ + if (!dev->listen) return; + + /* check for basic keyboard keys */ + if ((iev->code >= KEY_ESC) && (iev->code <= KEY_COMPOSE)) + { + int offset = 0; + const char *keyname = _ecore_fb_li_kbd_syms[iev->code * 6]; + /* check the key table */ + if (iev->value) + { + /* its a repeated key, dont increment */ + if (iev->value == 2) + return; + if (!strcmp(keyname, "Control_L")) + dev->keyboard.ctrl++; + else if (!strcmp(keyname, "Control_R")) + dev->keyboard.ctrl++; + else if (!strcmp(keyname, "Alt_L")) + dev->keyboard.alt++; + else if (!strcmp(keyname, "Alt_R")) + dev->keyboard.alt++; + else if (!strcmp(keyname, "Shift_L")) + dev->keyboard.shift++; + else if (!strcmp(keyname, "Shift_R")) + dev->keyboard.shift++; + else if (!strcmp(keyname, "Caps_Lock")) + dev->keyboard.lock = !dev->keyboard.lock; + if (dev->keyboard.ctrl > 2) dev->keyboard.ctrl = 2; + if (dev->keyboard.alt > 2) dev->keyboard.alt = 2; + if (dev->keyboard.shift > 2) dev->keyboard.shift = 2; + if (dev->keyboard.lock > 1) dev->keyboard.lock = 1; + } + else + { + if (!strcmp(keyname, "Control_L")) + dev->keyboard.ctrl--; + else if (!strcmp(keyname, "Control_R")) + dev->keyboard.ctrl--; + else if (!strcmp(keyname, "Alt_L")) + dev->keyboard.alt--; + else if (!strcmp(keyname, "Alt_R")) + dev->keyboard.alt--; + else if (!strcmp(keyname, "Shift_L")) + dev->keyboard.shift--; + else if (!strcmp(keyname, "Shift_R")) + dev->keyboard.shift--; + if (dev->keyboard.ctrl < 0) dev->keyboard.ctrl = 0; + if (dev->keyboard.alt < 0) dev->keyboard.alt = 0; + if (dev->keyboard.shift < 0) dev->keyboard.shift = 0; + if (dev->keyboard.lock < 0) dev->keyboard.lock = 0; + } + + /* sending ecore_input_evas events */ + Ecore_Event_Key *e; + + if (dev->keyboard.shift) offset = 1; + else if (dev->keyboard.lock) offset = 2; + + const char *key = _ecore_fb_li_kbd_syms[(iev->code * 6) + offset]; + const char *compose = _ecore_fb_li_kbd_syms[(iev->code * 6) + 3 + offset]; + + e = calloc(1, sizeof(Ecore_Event_Key) + strlen(key) + + strlen(keyname) + (compose ? strlen(compose) : 0) + 3); + e->keyname = (char *)(e + 1); + e->key = e->keyname + strlen(keyname) + 1; + e->compose = (compose) ? e->key + strlen(key) + 1 : NULL; + e->string = e->compose; + + strcpy((char *)e->keyname, keyname); + strcpy((char *)e->key, key); + if (compose) + strcpy((char *)e->compose, compose); + + e->modifiers = 0; + if (dev->keyboard.shift) + e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL; + if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS; + + e->timestamp = ecore_time_get(); + e->window = (Ecore_Window)dev->window; + e->event_window = (Ecore_Window)dev->window; + e->root_window = (Ecore_Window)dev->window; + e->same_screen = 1; + + if (iev->value) + ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL); + else + ecore_event_add(ECORE_EVENT_KEY_UP, e, NULL, NULL); + } + /* check for mouse button events */ + else if ((iev->code >= BTN_MOUSE) && (iev->code < BTN_JOYSTICK)) + { + int button; + Ecore_Event_Mouse_Button *e; + double current = ecore_time_get(); + + button = ((iev->code & 0x00F) + 1); + if (iev->value) + { + dev->mouse.did_double = EINA_FALSE; + dev->mouse.did_triple = EINA_FALSE; + + if (((current - dev->mouse.prev) <= dev->mouse.threshold) && + (button == dev->mouse.prev_button)) + { + dev->mouse.did_double = EINA_TRUE; + if (((current - dev->mouse.last) <= (2 * dev->mouse.threshold)) && + (button == dev->mouse.last_button)) + { + dev->mouse.did_triple = EINA_TRUE; + /* reset */ + dev->mouse.prev = 0; + dev->mouse.last = 0; + current = 0; + } + } + dev->mouse.last = dev->mouse.prev; + dev->mouse.prev = current; + dev->mouse.last_button = dev->mouse.prev_button; + dev->mouse.prev_button = button; + } + + e = calloc(1, sizeof(Ecore_Event_Mouse_Button)); + if (!e) + return; + + e->timestamp = current; + e->window = (Ecore_Window)dev->window; + e->event_window = (Ecore_Window)dev->window; + e->root_window = (Ecore_Window)dev->window; + e->same_screen = 1; + + e->modifiers = 0; + if (dev->keyboard.shift) + e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL; + if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS; + + e->x = dev->mouse.x; + e->y = dev->mouse.y; + e->root.x = e->x; + e->root.y = e->y; + e->buttons = button; + + if (dev->mouse.did_double) + e->double_click = 1; + if (dev->mouse.did_triple) + e->triple_click = 1; + + if (iev->value) + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL); + else + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL); + } +} + +static void +_ecore_fb_li_device_event_rel(Ecore_Fb_Input_Device *dev, struct input_event *iev) +{ + if (!dev->listen) return; + /* dispatch the button events if they are queued */ + switch (iev->code) + { + case REL_X: + case REL_Y: + { + Ecore_Event_Mouse_Move *e; + if(iev->code == REL_X) + { + dev->mouse.x += iev->value; + if(dev->mouse.x > dev->mouse.w - 1) + dev->mouse.x = dev->mouse.w; + else if(dev->mouse.x < 0) + dev->mouse.x = 0; + } + else + { + dev->mouse.y += iev->value; + if(dev->mouse.y > dev->mouse.h - 1) + dev->mouse.y = dev->mouse.h; + else if(dev->mouse.y < 0) + dev->mouse.y = 0; + } + + e = calloc(1, sizeof(Ecore_Event_Mouse_Move)); + if (!e) + return; + + e->window = (Ecore_Window)dev->window; + e->event_window = (Ecore_Window)dev->window; + e->root_window = (Ecore_Window)dev->window; + e->same_screen = 1; + + e->modifiers = 0; + if (dev->keyboard.shift) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL; + if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS; + + e->x = dev->mouse.x; + e->y = dev->mouse.y; + e->root.x = e->x; + e->root.y = e->y; + + e->timestamp = ecore_time_get(); + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); + + break; + } + case REL_WHEEL: + case REL_HWHEEL: + { + Ecore_Event_Mouse_Wheel *e; + + e = calloc(1, sizeof(Ecore_Event_Mouse_Wheel)); + if (!e) + return; + + e->x = dev->mouse.x; + e->y = dev->mouse.y; + if (iev->code == REL_HWHEEL) e->direction = 1; + e->z = iev->value; + e->root.x = dev->mouse.x; + e->root.y = dev->mouse.y; + + e->window = (Ecore_Window)dev->window; + e->event_window = (Ecore_Window)dev->window; + e->root_window = (Ecore_Window)dev->window; + e->same_screen = 1; + + e->modifiers = 0; + if (dev->keyboard.shift) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if (dev->keyboard.ctrl) e->modifiers |= ECORE_EVENT_MODIFIER_CTRL; + if (dev->keyboard.alt) e->modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if (dev->keyboard.lock) e->modifiers |= ECORE_EVENT_LOCK_CAPS; + + e->timestamp = ecore_time_get(); + + ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL); + + break; + } + default: + break; + } +} + +static void +_ecore_fb_li_device_event_abs(Ecore_Fb_Input_Device *dev, struct input_event *iev) +{ + static int prev_pressure = 0; + int pressure; + + if (!dev->listen) return; + switch (iev->code) + { + case ABS_X: + if (dev->mouse.w != 0) + { + int tmp; + + tmp = (int)((double)(iev->value - dev->mouse.min_w) / dev->mouse.rel_w); + if (tmp < 0) dev->mouse.x = 0; + else if (tmp > dev->mouse.w) dev->mouse.x = dev->mouse.w; + else dev->mouse.x = tmp; + dev->mouse.event = ECORE_EVENT_MOUSE_MOVE; + } + break; + + case ABS_Y: + if(dev->mouse.h != 0) + { + int tmp; + + tmp = (int)((double)(iev->value - dev->mouse.min_h) / dev->mouse.rel_h); + if (tmp < 0) dev->mouse.y = 0; + else if (tmp > dev->mouse.h) dev->mouse.y = dev->mouse.h; + else dev->mouse.y = tmp; + dev->mouse.event = ECORE_EVENT_MOUSE_MOVE; + } + break; + + case ABS_PRESSURE: + pressure = iev->value; + if ((pressure) && (!prev_pressure)) + { + /* DOWN: mouse is down, but was not before */ + dev->mouse.event = ECORE_EVENT_MOUSE_BUTTON_DOWN; + } + else if ((!pressure) && (prev_pressure)) + { + /* UP: mouse was down, but is not now */ + dev->mouse.event = ECORE_EVENT_MOUSE_BUTTON_UP; + } + prev_pressure = pressure; + break; + } +} + +static void +_ecore_fb_li_device_event_syn(Ecore_Fb_Input_Device *dev, struct input_event *iev __UNUSED__) +{ + if (!dev->listen) return; + + if (dev->mouse.event == ECORE_EVENT_MOUSE_MOVE) + { + Ecore_Event_Mouse_Move *ev; + ev = calloc(1,sizeof(Ecore_Event_Mouse_Move)); + ev->x = dev->mouse.x; + ev->y = dev->mouse.y; + ev->root.x = ev->x; + ev->root.y = ev->y; + ev->timestamp = ecore_time_get(); + } + else if (dev->mouse.event == ECORE_EVENT_MOUSE_BUTTON_DOWN) + { + Ecore_Event_Mouse_Button *ev; + ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)); + ev->x = dev->mouse.x; + ev->y = dev->mouse.y; + ev->root.x = ev->x; + ev->root.y = ev->y; + ev->buttons = 1; + ev->timestamp = ecore_time_get(); + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL); + } + else if (dev->mouse.event == ECORE_EVENT_MOUSE_BUTTON_UP) + { + Ecore_Event_Mouse_Button *ev; + ev = calloc(1, sizeof(Ecore_Event_Mouse_Button)); + ev->x = dev->mouse.x; + ev->y = dev->mouse.y; + ev->root.x = ev->x; + ev->root.y = ev->y; + ev->buttons = 1; + ev->timestamp = ecore_time_get(); + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL); + } +} + +static Eina_Bool +_ecore_fb_li_device_fd_callback(void *data, Ecore_Fd_Handler *fdh __UNUSED__) +{ + Ecore_Fb_Input_Device *dev; + struct input_event ev[64]; + int len; + int i; + + dev = (Ecore_Fb_Input_Device*)data; + /* read up to 64 events at once */ + len = read(dev->fd, &ev, sizeof(ev)); + for(i = 0; i < (int)(len / sizeof(ev[0])); i++) + { + switch(ev[i].type) + { + case EV_SYN: + _ecore_fb_li_device_event_syn(dev, &ev[i]); + break; + case EV_ABS: + _ecore_fb_li_device_event_abs(dev, &ev[i]); + break; + case EV_REL: + _ecore_fb_li_device_event_rel(dev, &ev[i]); + break; + case EV_KEY: + _ecore_fb_li_device_event_key(dev, &ev[i]); + break; + default: + break; + } + } + return EINA_TRUE; +} + +/** + * @addtogroup Ecore_FB_Group Ecore_FB - Frame buffer convenience functions. + * + * @{ + */ + +/** + * @brief Set the listen mode for an input device . + * + * @param dev The device to set the mode of. + * @param listen EINA_FALSE to disable listening mode, EINA_TRUE to enable it. + * + * This function enables or disables listening on the input device @p + * dev. If @p listen is #EINA_FALSE, listening mode is disabled, if it + * is #EINA_TRUE, it is enabled. + */ +EAPI void +ecore_fb_input_device_listen(Ecore_Fb_Input_Device *dev, Eina_Bool listen) +{ + if (!dev) return; + if ((listen && dev->listen) || (!listen && !dev->listen)) return; + if (listen) + { + /* if the device already had a handler */ + if (!dev->handler) + dev->handler = ecore_main_fd_handler_add(dev->fd, ECORE_FD_READ, _ecore_fb_li_device_fd_callback, dev, NULL, NULL); + + } + dev->listen = listen; +} + +#ifndef EV_CNT +# define EV_CNT (EV_MAX+1) +#endif + +/** + * @brief Associates an input device with the given @ref Ecore_Evas. + * + * @param dev The input being associated with an @ref Ecore_Evas (not @c NULL). + * @param window The window which this input is being associated to. + * @c NULL will remove any previous association. + * + * Events generated by this device will have a pointer to @p window. If this @p + * window is registered with ecore_event_window_register() or + * ecore_evas_input_event_register(), respective evas events will be delivered + * by the ecore_input_evas system. An example can be seen in the following code: + * + * @code + * Ecore_Evas *ee = ecore_evas_new(NULL, 0, 0, 800, 600, NULL); + * + * ecore_evas_input_event_register(ee); + * + * device = ecore_fb_input_device_open(device_path); + * if (device) + * ecore_fb_input_device_window_set(device, ee); + * + * @endcode + * + * On the previous code, all input captured on the mentioned device will be + * delivered to the @Ecore_Evas @c ee. + * + * @since 1.1 + */ +EAPI void +ecore_fb_input_device_window_set(Ecore_Fb_Input_Device *dev, void *window) +{ + if (!dev) return; + + dev->window = window; +} + +/** + * @brief Open an input device. + * + * @param dev The device to open. + * @return The @ref Ecore_Fb_Input_Device object that has been opened. + * + * This function opens the input device named @p dev and returns the + * object for it, or returns @c NULL on failure. + */ +EAPI Ecore_Fb_Input_Device * +ecore_fb_input_device_open(const char *dev) +{ + Ecore_Fb_Input_Device *device; + unsigned long event_type_bitmask[EV_CNT / 32 + 1]; + int event_type; + int fd; + + if (!dev) return NULL; + device = calloc(1, sizeof(Ecore_Fb_Input_Device)); + if (!device) return NULL; + + if ((fd = open(dev, O_RDONLY, O_NONBLOCK)) < 0) + { + fprintf(stderr, "[ecore_fb_li:device_open] %s %s", dev, strerror(errno)); + goto error_open; + } + /* query capabilities */ + if (ioctl(fd, EVIOCGBIT(0, EV_MAX), event_type_bitmask) < 0) + { + fprintf(stderr,"[ecore_fb_li:device_open] query capabilities %s %s", dev, strerror(errno)); + goto error_caps; + } + /* query name */ + device->info.name = calloc(256, sizeof(char)); + if (ioctl(fd, EVIOCGNAME(sizeof(char) * 256), device->info.name) < 0) + { + fprintf(stderr, "[ecore_fb_li:device_open] get name %s %s", dev, strerror(errno)); + strcpy(device->info.name, "Unknown"); + } + device->fd = fd; + device->info.dev = strdup(dev); + /* common */ + device->mouse.threshold = CLICK_THRESHOLD_DEFAULT; + + /* set info */ + for (event_type = 0; event_type < EV_MAX; event_type++) + { + if(!test_bit(event_type, event_type_bitmask)) + continue; + switch (event_type) + { + case EV_SYN: + break; + case EV_KEY: + device->info.cap |= ECORE_FB_INPUT_DEVICE_CAP_KEYS_OR_BUTTONS; + break; + case EV_REL: + device->info.cap |= ECORE_FB_INPUT_DEVICE_CAP_RELATIVE; + break; + case EV_ABS: + device->info.cap |= ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE; + break; + case EV_MSC: + case EV_LED: + case EV_SND: + case EV_REP: + case EV_FF : + case EV_FF_STATUS: + case EV_PWR: + default: + break; + } + } + + _ecore_fb_li_devices = eina_list_append(_ecore_fb_li_devices, device); + return device; + +error_caps: + close(fd); +error_open: + free(device); + return NULL; +} + +/** + * @brief Close the given device. + * + * @param dev The device to close + * + * This function closes the device @p dev. If @p dev is @c NULL, this + * function does nothing. + */ +EAPI void +ecore_fb_input_device_close(Ecore_Fb_Input_Device *dev) +{ + if (!dev || dev->fd < 0) return; + /* close the fd */ + close(dev->fd); + /* remove the element from the list */ + _ecore_fb_li_devices = eina_list_remove(_ecore_fb_li_devices, dev); + free(dev); +} + + +/** + * @brief Set the axis size of the given device. + * + * @param dev The device to set the axis size to. + * @param w The width of the axis. + * @param h The height of the axis. + * + * This function sets set the width @p w and height @p h of the axis + * of device @p dev. If @p dev is a relative input device, a width and + * height must set for it. If its absolute set the ioctl correctly, if + * not, unsupported device. + */ +EAPI void +ecore_fb_input_device_axis_size_set(Ecore_Fb_Input_Device *dev, int w, int h) +{ + if (!dev) return; + if ((w < 0) || (h < 0)) return; + /* FIXME + * this code is for a touchscreen device, + * make it configurable (ABSOLUTE | RELATIVE) + */ + if (dev->info.cap & ECORE_FB_INPUT_DEVICE_CAP_ABSOLUTE) + { + /* FIXME looks like some kernels dont include this struct */ + struct input_absinfo abs_features; + + ioctl(dev->fd, EVIOCGABS(ABS_X), &abs_features); + dev->mouse.min_w = abs_features.minimum; + dev->mouse.rel_w = (double)(abs_features.maximum - abs_features.minimum)/(double)(w); + + ioctl(dev->fd, EVIOCGABS(ABS_Y), &abs_features); + dev->mouse.min_h = abs_features.minimum; + dev->mouse.rel_h = (double)(abs_features.maximum - abs_features.minimum)/(double)(h); + } + else if (!(dev->info.cap & ECORE_FB_INPUT_DEVICE_CAP_RELATIVE)) + return; + + /* update the local values */ + if (dev->mouse.x > w - 1) dev->mouse.x = w -1; + if (dev->mouse.y > h - 1) dev->mouse.y = h -1; + dev->mouse.w = w; + dev->mouse.h = h; +} + +/** + * @brief Retrieve the name of the given device. + * + * @param dev The device to get the name from. + * @return The name of the device. + * + * This function returns the name of the device @p dev. If @p dev is + * @c NULL, this function returns @c NULL. + */ +EAPI const char * +ecore_fb_input_device_name_get(Ecore_Fb_Input_Device *dev) +{ + if (!dev) return NULL; + return dev->info.name; +} + +/** + * @brief Retrieve the capability of the given device. + * + * @param dev The device to get the name from. + * @return The capability of the device. + * + * This function returns the capability of the device @p dev. If @p dev is + * @c NULL, this function returns #ECORE_FB_INPUT_DEVICE_CAP_NONE. + */ +EAPI Ecore_Fb_Input_Device_Cap +ecore_fb_input_device_cap_get(Ecore_Fb_Input_Device *dev) +{ + if (!dev) return ECORE_FB_INPUT_DEVICE_CAP_NONE; + return dev->info.cap; +} + +/** + * @brief Set the threshold of mouse clicks of the given device. + * + * @param dev The device to set the threshodl mouse click to. + * @param threshold The threshold value. + * + * This function sets the threshold of mouse clicks of the device + * @p dev to @p threshold. If @p dev is @c NULL, this function does + * nothing. + */ +EAPI void +ecore_fb_input_device_threshold_click_set(Ecore_Fb_Input_Device *dev, double threshold) +{ + if (!dev) return; + if ((threshold == dev->mouse.threshold) || (threshold == 0)) return; + dev->mouse.threshold = threshold; +} + +/** + * @brief Get the threshold of mouse clicks of the given device. + * + * @param dev The device to set the threshodl mouse click from. + * @return The threshold value. + * + * This function returns the threshold of mouse clicks of the device + * @p dev. If @p dev is @c NULL, this function returns 0.0. + */ +EAPI double +ecore_fb_input_device_threshold_click_get(Ecore_Fb_Input_Device *dev) +{ + if (!dev) return 0; + return dev->mouse.threshold; +} + +/** + * @} + */ diff --git a/libraries/ecore/src/lib/ecore_fb/ecore_fb_private.h b/libraries/ecore/src/lib/ecore_fb/ecore_fb_private.h new file mode 100644 index 0000000..3e908a0 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_fb/ecore_fb_private.h @@ -0,0 +1,91 @@ +#ifndef _ECORE_FB_PRIVATE_H +#define _ECORE_FB_PRIVATE_H + +#include "Ecore.h" +#include "ecore_private.h" +#include "Ecore_Input.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15)) && (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)) + #define kernel_ulong_t unsigned long + #define BITS_PER_LONG 32 + #include + #undef kernel_ulong_t + #undef BITS_PER_LONG +#else + #include +#endif + +#include +#include +#include + +/* ecore_fb_li.c */ +struct _Ecore_Fb_Input_Device +{ + int fd; + Ecore_Fd_Handler *handler; + int listen; + struct { + Ecore_Fb_Input_Device_Cap cap; + char *name; + char *dev; + } info; + struct + { + /* common mouse */ + int x,y; + int w,h; + + double last; + double prev; + double threshold; + Eina_Bool did_double; + Eina_Bool did_triple; + /* absolute axis */ + int min_w, min_h; + double rel_w, rel_h; + int event; + int prev_button; + int last_button; + } mouse; + struct + { + int shift; + int ctrl; + int alt; + int lock; + } keyboard; + void *window; +}; + +/* ecore_fb_ts.c */ +EAPI int ecore_fb_ts_init(void); +EAPI void ecore_fb_ts_shutdown(void); +EAPI void ecore_fb_ts_events_window_set(void *window); +EAPI void *ecore_fb_ts_events_window_get(void); +EAPI void ecore_fb_ts_event_window_set(void *window); + +/* ecore_fb_vt.c */ +int ecore_fb_vt_init(void); +void ecore_fb_vt_shutdown(void); + +/* hacks to stop people NEEDING #include */ +#ifndef TS_SET_CAL +#define TS_SET_CAL 0x4014660b +#endif +#ifndef TS_GET_CAL +#define TS_GET_CAL 0x8014660a +#endif + +#endif diff --git a/libraries/ecore/src/lib/ecore_fb/ecore_fb_ts.c b/libraries/ecore/src/lib/ecore_fb/ecore_fb_ts.c new file mode 100644 index 0000000..395e768 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_fb/ecore_fb_ts.c @@ -0,0 +1,355 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef HAVE_TSLIB +# include +# include +#endif + +#include "Ecore_Fb.h" +#include "ecore_fb_private.h" + +typedef struct _Ecore_Fb_Ts_Event Ecore_Fb_Ts_Event; +typedef struct _Ecore_Fb_Ts_Calibrate Ecore_Fb_Ts_Calibrate; +typedef struct _Ecore_Fb_Ts_Backlight Ecore_Fb_Ts_Backlight; +typedef struct _Ecore_Fb_Ts_Contrast Ecore_Fb_Ts_Contrast; +typedef struct _Ecore_Fb_Ts_Led Ecore_Fb_Ts_Led; +typedef struct _Ecore_Fb_Ts_Flite Ecore_Fb_Ts_Flite; + +struct _Ecore_Fb_Ts_Event +{ + unsigned short pressure; + unsigned short x; + unsigned short y; + unsigned short _unused; +}; + +struct _Ecore_Fb_Ts_Calibrate +{ + int xscale; + int xtrans; + int yscale; + int ytrans; + int xyswap; +}; + +struct _Ecore_Fb_Ts_Backlight +{ + int on; + unsigned char brightness; +}; + +struct _Ecore_Fb_Ts_Contrast +{ + unsigned char contrast; +}; + +struct _Ecore_Fb_Ts_Led +{ + unsigned char on; + unsigned char blink_time; + unsigned char on_time; + unsigned char off_time; +}; + +struct _Ecore_Fb_Ts_Flite +{ + unsigned char mode; + unsigned char pwr; + unsigned char brightness; +}; + +static Eina_Bool _ecore_fb_ts_fd_handler(void *data, Ecore_Fd_Handler *fd_handler); +static int _ecore_fb_ts_fd = -1; +static int _ecore_fb_ts_event_byte_count = 0; +static int _ecore_fb_ts_apply_cal = 0; +static Ecore_Fb_Ts_Event _ecore_fb_ts_event; +static Ecore_Fb_Ts_Calibrate _ecore_fb_ts_cal = {1,1,0,0,0}; +static Ecore_Fd_Handler *_ecore_fb_ts_fd_handler_handle = NULL; + +#ifdef HAVE_TSLIB +struct tsdev *_ecore_fb_tslib_tsdev = NULL; +struct ts_sample _ecore_fb_tslib_event; +#endif + +static double _ecore_fb_double_click_time = 0.25; +static void *_ecore_fb_ts_event_window = NULL; + +EAPI int +ecore_fb_ts_init(void) +{ +#ifdef HAVE_TSLIB + char *tslib_tsdevice = NULL; + if ( (tslib_tsdevice = getenv("TSLIB_TSDEVICE")) ) + { + printf( "ECORE_FB: TSLIB_TSDEVICE = '%s'\n", tslib_tsdevice ); + _ecore_fb_tslib_tsdev = ts_open( tslib_tsdevice, 1 ); /* 1 = nonblocking, 0 = blocking */ + + if ( !_ecore_fb_tslib_tsdev ) + { + printf( "ECORE_FB: Can't ts_open (%s)\n", strerror( errno ) ); + return 0; + } + + if ( ts_config( _ecore_fb_tslib_tsdev ) ) + { + printf( "ECORE_FB: Can't ts_config (%s)\n", strerror( errno ) ); + return 0; + } + _ecore_fb_ts_fd = ts_fd( _ecore_fb_tslib_tsdev ); + if ( _ecore_fb_ts_fd < 0 ) + { + printf( "ECORE_FB: Can't open touchscreen (%s)\n", strerror( errno ) ); + return 0; + } + } +#else + _ecore_fb_ts_fd = open("/dev/touchscreen/0", O_RDONLY); +#endif + if (_ecore_fb_ts_fd >= 0) + { + _ecore_fb_ts_fd_handler_handle = ecore_main_fd_handler_add(_ecore_fb_ts_fd, + ECORE_FD_READ, + _ecore_fb_ts_fd_handler, NULL, + NULL, NULL); + if (!_ecore_fb_ts_fd_handler_handle) + { + close(_ecore_fb_ts_fd); + return 0; + } + // FIXME _ecore_fb_kbd_fd = open("/dev/touchscreen/key", O_RDONLY); + return 1; + } + return 0; +} + +EAPI void +ecore_fb_ts_shutdown(void) +{ + if (_ecore_fb_ts_fd_handler_handle) + ecore_main_fd_handler_del(_ecore_fb_ts_fd_handler_handle); + if (_ecore_fb_ts_fd >= 0) close(_ecore_fb_ts_fd); + _ecore_fb_ts_fd = -1; + _ecore_fb_ts_fd_handler_handle = NULL; + _ecore_fb_ts_event_window = NULL; +} + +EAPI void +ecore_fb_ts_event_window_set(void *window) +{ + _ecore_fb_ts_event_window = window; +} + +EAPI void * +ecore_fb_ts_event_window_get(void) +{ + return _ecore_fb_ts_event_window; +} + +/** + * @defgroup Ecore_FB_Calibrate_Group Framebuffer Calibration Functions + * + * Functions that calibrate the screen. + */ + + +/** + * Calibrates the touschreen using the given parameters. + * @param xscale X scaling, where 256 = 1.0 + * @param xtrans X translation. + * @param yscale Y scaling. + * @param ytrans Y translation. + * @param xyswap Swap X & Y flag. + * @ingroup Ecore_FB_Calibrate_Group + */ +EAPI void +ecore_fb_touch_screen_calibrate_set(int xscale, int xtrans, int yscale, int ytrans, int xyswap) +{ + Ecore_Fb_Ts_Calibrate cal; + + if (_ecore_fb_ts_fd < 0) return; + cal.xscale = xscale; + cal.xtrans = xtrans; + cal.yscale = yscale; + cal.ytrans = ytrans; + cal.xyswap = xyswap; + if (ioctl(_ecore_fb_ts_fd, TS_SET_CAL, (void *)&cal)) + { + _ecore_fb_ts_cal = cal; + _ecore_fb_ts_apply_cal = 1; + } +} + +/** + * Retrieves the calibration parameters of the touchscreen. + * @param xscale Pointer to an integer in which to store the X scaling. + * Note that 256 = 1.0. + * @param xtrans Pointer to an integer in which to store the X translation. + * @param yscale Pointer to an integer in which to store the Y scaling. + * @param ytrans Pointer to an integer in which to store the Y translation. + * @param xyswap Pointer to an integer in which to store the Swap X & Y flag. + * @ingroup Ecore_FB_Calibrate_Group + */ +EAPI void +ecore_fb_touch_screen_calibrate_get(int *xscale, int *xtrans, int *yscale, int *ytrans, int *xyswap) +{ + Ecore_Fb_Ts_Calibrate cal; + + if (_ecore_fb_ts_fd < 0) return; + if (!_ecore_fb_ts_apply_cal) + { + if (ioctl(_ecore_fb_ts_fd, TS_GET_CAL, (void *)&cal)) + _ecore_fb_ts_cal = cal; + } + else + cal = _ecore_fb_ts_cal; + if (xscale) *xscale = cal.xscale; + if (xtrans) *xtrans = cal.xtrans; + if (yscale) *yscale = cal.yscale; + if (ytrans) *ytrans = cal.ytrans; + if (xyswap) *xyswap = cal.xyswap; +} + +static Eina_Bool +_ecore_fb_ts_fd_handler(void *data __UNUSED__, Ecore_Fd_Handler *fd_handler __UNUSED__) +{ + static int prev_x = 0, prev_y = 0, prev_pressure = 0; + static double last_time = 0; + static double last_last_time = 0; + int v = 0; + + do + { + int x, y, pressure; + int num; + char *ptr; + double t = 0.0; + static int did_double = 0; + static int did_triple = 0; + +#ifdef HAVE_TSLIB + if (_ecore_fb_ts_apply_cal) + num = ts_read_raw(_ecore_fb_tslib_tsdev, &_ecore_fb_tslib_event, 1); + else + num = ts_read(_ecore_fb_tslib_tsdev, &_ecore_fb_tslib_event, 1); + if (num != 1) return 1; /* no more samples at this time */ + x = _ecore_fb_tslib_event.x; + y = _ecore_fb_tslib_event.y; + pressure = _ecore_fb_tslib_event.pressure; + v = 1; /* loop, there might be more samples */ + t = ecore_time_get(); +#else + ptr = (char *)&(_ecore_fb_ts_event); + ptr += _ecore_fb_ts_event_byte_count; + num = sizeof(Ecore_Fb_Ts_Event) - _ecore_fb_ts_event_byte_count; + v = read(_ecore_fb_ts_fd, ptr, num); + if (v < 0) return 1; + _ecore_fb_ts_event_byte_count += v; + if (v < num) return 1; + _ecore_fb_ts_event_byte_count = 0; + if (_ecore_fb_ts_apply_cal) + { + x = ((_ecore_fb_ts_cal.xscale * _ecore_fb_ts_event.x) >> 8) + _ecore_fb_ts_cal.xtrans; + y = ((_ecore_fb_ts_cal.yscale * _ecore_fb_ts_event.y) >> 8) + _ecore_fb_ts_cal.ytrans; + } + else + { + x = _ecore_fb_ts_event.x; + y = _ecore_fb_ts_event.y; + } + pressure = _ecore_fb_ts_event.pressure; +#endif + /* add event to queue */ + /* always add a move event */ + if ((pressure) || (prev_pressure)) + { + /* MOVE: mouse is down and was */ + Ecore_Event_Mouse_Move *e; + + e = calloc(1, sizeof(Ecore_Event_Mouse_Move)); + if (!e) goto retry; + e->x = x; + e->y = y; + e->root.x = x; + e->root.y = y; + e->window = (Ecore_Window)_ecore_fb_ts_event_window; + e->event_window = e->window; + e->root_window = e->window; + e->same_screen = 1; + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); + } + if ((pressure) && (!prev_pressure)) + { + /* DOWN: mouse is down, but was not now */ + Ecore_Event_Mouse_Button *e; + + e = calloc(1, sizeof(Ecore_Event_Mouse_Button)); + if (!e) goto retry; + e->x = x; + e->y = y; + e->buttons = 1; + if ((t - last_time) <= _ecore_fb_double_click_time) + { + e->double_click = 1; + did_double = 1; + } + else + { + did_double = 0; + did_triple = 0; + } + if ((t - last_last_time) <= (2 * _ecore_fb_double_click_time)) + { + did_triple = 1; + e->triple_click = 1; + } + else + { + did_triple = 0; + } + e->window = (Ecore_Window)_ecore_fb_ts_event_window; + e->event_window = e->window; + e->root_window = e->window; + e->same_screen = 1; + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL); + } + else if ((!pressure) && (prev_pressure)) + { + /* UP: mouse was down, but is not now */ + Ecore_Event_Mouse_Button *e; + + e = calloc(1, sizeof(Ecore_Event_Mouse_Button)); + if (!e) goto retry; + e->x = prev_x; + e->y = prev_y; + e->buttons = 1; + if (did_double) + e->double_click = 1; + if (did_triple) + e->triple_click = 1; + e->window = (Ecore_Window)_ecore_fb_ts_event_window; + e->event_window = e->window; + e->root_window = e->window; + e->same_screen = 1; + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL); + } + if (did_triple) + { + last_time = 0; + last_last_time = 0; + } + else + { + last_last_time = last_time; + last_time = t; + } +retry: + prev_x = x; + prev_y = y; + prev_pressure = pressure; + } + while (v > 0); + return 1; +} + diff --git a/libraries/ecore/src/lib/ecore_fb/ecore_fb_vt.c b/libraries/ecore/src/lib/ecore_fb/ecore_fb_vt.c new file mode 100644 index 0000000..09e3f37 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_fb/ecore_fb_vt.c @@ -0,0 +1,322 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "Ecore_Fb.h" +#include "ecore_fb_private.h" + +static int _ecore_fb_vt_do_switch = 0; + +static int _ecore_fb_vt_tty0_fd = -1; +static int _ecore_fb_vt_tty_fd = -1; +static int _ecore_fb_vt_current_vt = 0; +static int _ecore_fb_vt_prev_vt = 0; + +static struct termios _ecore_fb_tty_prev_tio_mode; +static struct vt_mode _ecore_fb_vt_prev_mode; + +static Eina_Bool _ecore_fb_signal_usr_handler(void *data, int type, void *ev); +static Ecore_Event_Handler *_ecore_fb_user_handler = NULL; +static int _ecore_fb_tty_prev_mode = 0; +static int _ecore_fb_tty_prev_kd_mode = 0; + +/* callbacks for an attach/release of a vt */ +static void (*_ecore_fb_func_fb_lost) (void *data) = NULL; +static void *_ecore_fb_func_fb_lost_data = NULL; +static void (*_ecore_fb_func_fb_gain) (void *data) = NULL; +static void *_ecore_fb_func_fb_gain_data = NULL; + +/* FIXME what is the filter for? */ +static Ecore_Event_Filter *_ecore_fb_filter_handler = NULL; + +/* prototypes */ +/* XXX: unused +static void _ecore_fb_vt_switch(int vt); +static void *_ecore_fb_event_filter_start(void *data); +static Eina_Bool _ecore_fb_event_filter_filter(void *data, void *loop_data, int type, void *event); +static void _ecore_fb_event_filter_end(void *data, void *loop_data); +*/ + +static Eina_Bool +_ecore_fb_signal_usr_handler(void *data __UNUSED__, int type __UNUSED__, void *ev) +{ + Ecore_Event_Signal_User *e; + + e = (Ecore_Event_Signal_User *)ev; + if (e->number == 1) + { + /* release vt */ + if (_ecore_fb_func_fb_lost) _ecore_fb_func_fb_lost(_ecore_fb_func_fb_lost_data); + /* TODO stop listening from the devices? let the callback do it? */ + ioctl(_ecore_fb_vt_tty_fd, VT_RELDISP, 1); + } + else if (e->number == 2) + { + /* attach vt */ + if (_ecore_fb_func_fb_gain) _ecore_fb_func_fb_gain(_ecore_fb_func_fb_gain_data); + /* TODO reattach all devices */ + } + return 1; +} + +/* XXX: unused +static void +_ecore_fb_vt_switch(int vt) +{ + vt++; + if (_ecore_fb_vt_tty_fd != 0) + { + if (vt != _ecore_fb_vt_current_vt) + { + tcsetattr(_ecore_fb_vt_tty_fd, TCSAFLUSH, &_ecore_fb_tty_prev_tio_mode); + ioctl(_ecore_fb_vt_tty_fd, KDSETMODE, _ecore_fb_tty_prev_kd_mode); + ioctl(_ecore_fb_vt_tty_fd, KDSKBMODE, _ecore_fb_tty_prev_mode); + } + } + ioctl(_ecore_fb_vt_tty_fd, VT_ACTIVATE, vt); +} +*/ + +static int +_ecore_fb_vt_setup(void) +{ + char buf[64]; +// XXX: unused +// struct termios tio; + struct vt_mode new_vtmode; + + if (_ecore_fb_vt_current_vt != _ecore_fb_vt_prev_vt) + { + snprintf(buf, sizeof(buf), "/dev/tty%i", _ecore_fb_vt_current_vt); + if ((_ecore_fb_vt_tty_fd = open(buf, O_RDWR)) < 0) + { + printf("[ecore_fb:vt_setup] can't open tty %d\n", _ecore_fb_vt_current_vt); + return 0; + } + close(_ecore_fb_vt_tty0_fd); + _ecore_fb_vt_tty0_fd = -1; + /* FIXME detach the process from current tty ? */ + } + else + _ecore_fb_vt_tty_fd = _ecore_fb_vt_tty0_fd; + /* for backup */ + tcgetattr(_ecore_fb_vt_tty_fd, &_ecore_fb_tty_prev_tio_mode); + ioctl(_ecore_fb_vt_tty_fd, KDGETMODE, &_ecore_fb_tty_prev_kd_mode); + ioctl(_ecore_fb_vt_tty_fd, VT_GETMODE, &_ecore_fb_vt_prev_mode); + + if (ioctl(_ecore_fb_vt_tty_fd, KDSETMODE, KD_GRAPHICS) < 0) + { + perror("[ecore_fb:vt_setup] can't set the mode to KD_GRAPHICS"); + close(_ecore_fb_vt_tty_fd); + _ecore_fb_vt_tty_fd = -1; + return 0; + } + ioctl(_ecore_fb_vt_tty_fd, KDGKBMODE, &_ecore_fb_tty_prev_mode); + + /* support of switching */ + new_vtmode.mode = VT_PROCESS; + new_vtmode.waitv = 0; + new_vtmode.relsig = SIGUSR1; + new_vtmode.acqsig = SIGUSR2; + if (ioctl(_ecore_fb_vt_tty_fd, VT_SETMODE, &new_vtmode) < 0) + { + perror("[ecore_fb:vt_setup] can't set the tty mode"); + close(_ecore_fb_vt_tty_fd); + _ecore_fb_vt_tty_fd = -1; + return 0; + } + /* register signal handlers when alloc/detach of vt */ + _ecore_fb_user_handler = ecore_event_handler_add(ECORE_EVENT_SIGNAL_USER, + _ecore_fb_signal_usr_handler, + NULL); + /* What does this do? */ + /* + _ecore_fb_filter_handler = ecore_event_filter_add(_ecore_fb_event_filter_start, _ecore_fb_event_filter_filter, _ecore_fb_event_filter_end, NULL); + */ + + usleep(40000); + if (ioctl(_ecore_fb_vt_tty_fd, VT_ACTIVATE, _ecore_fb_vt_current_vt) < 0) + { + perror("[ecore_fb:vt_setup] error on VT_ACTIVATE"); + close(_ecore_fb_vt_tty_fd); + _ecore_fb_vt_tty_fd = -1; + return 0; + } + if(ioctl(_ecore_fb_vt_tty_fd, VT_WAITACTIVE, _ecore_fb_vt_current_vt) < 0) + { + perror("[ecore_fb:vt_setup] error on VT_WAITACTIVE"); + close(_ecore_fb_vt_tty_fd); + _ecore_fb_vt_tty_fd = -1; + return 0; + } + /* FIXME assign the fb to the tty in case isn't setup */ + return 1; +} + +int +ecore_fb_vt_init(void) +{ + struct vt_stat vtstat; + + /* as root you can allocate another tty */ + if (!geteuid()) + _ecore_fb_vt_do_switch = 1; + if ((_ecore_fb_vt_tty0_fd = open("/dev/tty0", O_RDONLY)) < 0) + { + printf("[ecore_fb:init] can't open /dev/tty0\n"); + return 0; + } + /* query current vt state */ + if ((ioctl(_ecore_fb_vt_tty0_fd, VT_GETSTATE, &vtstat)) < 0) + { + printf("[ecore_fb:init] can't get current tty state\n"); + return 0; + } + _ecore_fb_vt_prev_vt = vtstat.v_active; + /* switch to another tty */ + if (_ecore_fb_vt_do_switch) + { + int vtno; + + if ((ioctl(_ecore_fb_vt_tty0_fd, VT_OPENQRY, &vtno) < 0)) + { + printf("[ecore_fb:init] can't query for a vt\n"); + return 0; + } + _ecore_fb_vt_current_vt = vtno; + } + /* use current tty */ + else + _ecore_fb_vt_current_vt = _ecore_fb_vt_prev_vt; + if (!_ecore_fb_vt_setup()) + { + printf("[ecore_fb:init] can't setup the vt, restoring previous mode...\n"); + /* TODO finish this */ + if (_ecore_fb_vt_do_switch) + { + printf("[ecore_fb:init] switching back to vt %d\n", _ecore_fb_vt_prev_vt); + } + return 0; + } + return 1; +} + +void +ecore_fb_vt_shutdown(void) +{ + /* restore the previous mode */ + if (_ecore_fb_vt_tty_fd != -1) + { + tcsetattr(_ecore_fb_vt_tty_fd, TCSAFLUSH, &_ecore_fb_tty_prev_tio_mode); + ioctl(_ecore_fb_vt_tty_fd, KDSETMODE, _ecore_fb_tty_prev_kd_mode); + ioctl(_ecore_fb_vt_tty_fd, KDSKBMODE, _ecore_fb_tty_prev_mode); + ioctl(_ecore_fb_vt_tty_fd, VT_SETMODE, &_ecore_fb_vt_prev_mode); + /* go back to previous vt */ + close(_ecore_fb_vt_tty_fd); + _ecore_fb_vt_tty_fd = -1; + } + + if (_ecore_fb_user_handler) ecore_event_handler_del(_ecore_fb_user_handler); + _ecore_fb_user_handler = NULL; + + if (_ecore_fb_filter_handler) ecore_event_filter_del(_ecore_fb_filter_handler); + _ecore_fb_filter_handler = NULL; +} + +/** + * @addtogroup Ecore_FB_Group Ecore_FB - Frame buffer convenience functions. + * + * @{ + */ + +/** + * @brief Set a callback called when a virtual terminal is gained. + * + * @param func The callback called when vt is gained. + * @param data The data to pass to the callback. + * + * This function sets the callback @p func which will be called when a + * virtual terminal is gained (for example you press Ctrl-Alt-F1 to go + * to vt1 and your app was using vt1). @p data will be pass to @p func if + * the callback is called. + */ +EAPI void +ecore_fb_callback_gain_set(void (*func) (void *data), void *data) +{ + _ecore_fb_func_fb_gain = func; + _ecore_fb_func_fb_gain_data = data; +} + +/** + * @brief Set a callback called when a virtual terminal is lost. + * + * @param func The callback called when vt is lost. + * @param data The data to pass to the callback. + * + * This function sets the callback @p func which will be called when a + * virtual terminal is lost (someone wants the tv from you and you + * want to give up that vt). @p data will be pass to @p func if the + * callback is called. + */ +EAPI void +ecore_fb_callback_lose_set(void (*func) (void *data), void *data) +{ + _ecore_fb_func_fb_lost = func; + _ecore_fb_func_fb_lost_data = data; + +} + +/** + * @} + */ + +/* + * This filter should take into account that the MOUSE_MOVE event can be + * triggered by a mouse, not just a touchscreen device, so you can't discard + * them (only those generated by a device that sends events with absolute + * coordinates). + +typedef struct _Ecore_Fb_Filter_Data Ecore_Fb_Filter_Data; + +struct _Ecore_Fb_Filter_Data +{ + int last_event_type; +}; + +static void * +_ecore_fb_event_filter_start(void *data __UNUSED__) +{ + Ecore_Fb_Filter_Data *filter_data; + + filter_data = calloc(1, sizeof(Ecore_Fb_Filter_Data)); + return filter_data; +} + +static Eina_Bool +_ecore_fb_event_filter_filter(void *data __UNUSED__, void *loop_data,int type, void *event __UNUSED__) +{ + Ecore_Fb_Filter_Data *filter_data; + + filter_data = loop_data; + if (!filter_data) return EINA_TRUE; + if (type == ECORE_EVENT_MOUSE_MOVE) + { + if ((filter_data->last_event_type) == ECORE_EVENT_MOUSE_MOVE) + { + filter_data->last_event_type = type; + return EINA_FALSE; + } + } + filter_data->last_event_type = type; + return EINA_TRUE; +} + +static void +_ecore_fb_event_filter_end(void *data __UNUSED__, void *loop_data) +{ + Ecore_Fb_Filter_Data *filter_data; + + filter_data = loop_data; + if (filter_data) free(filter_data); +} +*/ diff --git a/libraries/ecore/src/lib/ecore_file/Ecore_File.h b/libraries/ecore/src/lib/ecore_file/Ecore_File.h new file mode 100644 index 0000000..e4b8851 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_file/Ecore_File.h @@ -0,0 +1,190 @@ +#ifndef ECORE_FILE_H +#define ECORE_FILE_H + +/* + * TODO: + * - More events, move/rename of directory file + */ + +#include + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_ECORE_FILE_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_ECORE_FILE_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif /* ! _WIN32 */ + +/** + * @file Ecore_File.h + * @brief Files utility functions + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup Ecore_File_Group Ecore_File - Files and directories convenience functions + * + * @{ + */ + +/** + * @typedef Ecore_File_Monitor + * Abstract type used when monitoring a directory. + */ +typedef struct _Ecore_File_Monitor Ecore_File_Monitor; + +/** + * @typedef Ecore_File_Download_Job + * Abstract type used when aborting a download. + */ +typedef struct _Ecore_File_Download_Job Ecore_File_Download_Job; + +/** + * @typedef Ecore_File_Event + * The event type returned when a file or directory is monitored. + */ +typedef enum _Ecore_File_Event +{ + ECORE_FILE_EVENT_NONE, /**< No event. */ + ECORE_FILE_EVENT_CREATED_FILE, /**< Created file event. */ + ECORE_FILE_EVENT_CREATED_DIRECTORY, /**< Created directory event. */ + ECORE_FILE_EVENT_DELETED_FILE, /**< Deleted file event. */ + ECORE_FILE_EVENT_DELETED_DIRECTORY, /**< Deleted directory event. */ + ECORE_FILE_EVENT_DELETED_SELF, /**< Deleted monitored directory event. */ + ECORE_FILE_EVENT_MODIFIED, /**< Modified file or directory event. */ + ECORE_FILE_EVENT_CLOSED /**< Closed file event */ +} Ecore_File_Event; + +/** + * @typedef Ecore_File_Monitor_Cb + * Callback type used when a monitored directory has changes. + */ +typedef void (*Ecore_File_Monitor_Cb)(void *data, Ecore_File_Monitor *em, Ecore_File_Event event, const char *path); + +/** + * @typedef Ecore_File_Download_Completion_Cb + * Callback type used when a download is finished. + */ +typedef void (*Ecore_File_Download_Completion_Cb)(void *data, const char *file, int status); + +/** + * @typedef Ecore_File_Progress_Return + * What to do with the download as a return from the + * Ecore_File_Download_Progress_Cb function, if provided. + */ +typedef enum _Ecore_File_Progress_Return +{ + ECORE_FILE_PROGRESS_CONTINUE = 0, /**< Continue the download. */ + ECORE_FILE_PROGRESS_ABORT = 1 /**< Abort the download. */ +} Ecore_File_Progress_Return; + +/** + * @typedef Ecore_File_Download_Progress_Cb + * Callback type used while a download is in progress. + */ +typedef int (*Ecore_File_Download_Progress_Cb)(void *data, + const char *file, + long int dltotal, + long int dlnow, + long int ultotal, + long int ulnow); + +/* File operations */ + +EAPI int ecore_file_init (void); +EAPI int ecore_file_shutdown (void); +EAPI long long ecore_file_mod_time (const char *file); +EAPI long long ecore_file_size (const char *file); +EAPI Eina_Bool ecore_file_exists (const char *file); +EAPI Eina_Bool ecore_file_is_dir (const char *file); +EAPI Eina_Bool ecore_file_mkdir (const char *dir); +EAPI int ecore_file_mkdirs (const char **dirs); +EAPI int ecore_file_mksubdirs (const char *base, const char **subdirs); +EAPI Eina_Bool ecore_file_rmdir (const char *dir); +EAPI Eina_Bool ecore_file_recursive_rm (const char *dir); +EAPI Eina_Bool ecore_file_mkpath (const char *path); +EAPI int ecore_file_mkpaths (const char **paths); +EAPI Eina_Bool ecore_file_cp (const char *src, const char *dst); +EAPI Eina_Bool ecore_file_mv (const char *src, const char *dst); +EAPI Eina_Bool ecore_file_symlink (const char *src, const char *dest); +EAPI char *ecore_file_realpath (const char *file); +EAPI Eina_Bool ecore_file_unlink (const char *file); +EAPI Eina_Bool ecore_file_remove (const char *file); +EAPI const char *ecore_file_file_get (const char *path); +EAPI char *ecore_file_dir_get (const char *path); +EAPI Eina_Bool ecore_file_can_read (const char *file); +EAPI Eina_Bool ecore_file_can_write (const char *file); +EAPI Eina_Bool ecore_file_can_exec (const char *file); +EAPI char *ecore_file_readlink (const char *link); +EAPI Eina_List *ecore_file_ls (const char *dir); +EAPI Eina_Iterator *ecore_file_ls_iterator (const char *dir); +EAPI char *ecore_file_app_exe_get (const char *app); +EAPI char *ecore_file_escape_name (const char *filename); +EAPI char *ecore_file_strip_ext (const char *file); +EAPI int ecore_file_dir_is_empty (const char *dir); + +/* Monitoring */ + +EAPI Ecore_File_Monitor *ecore_file_monitor_add(const char *path, + Ecore_File_Monitor_Cb func, + void *data); +EAPI void ecore_file_monitor_del(Ecore_File_Monitor *ecore_file_monitor); +EAPI const char *ecore_file_monitor_path_get(Ecore_File_Monitor *ecore_file_monitor); + +/* Path */ + +EAPI Eina_Bool ecore_file_path_dir_exists(const char *in_dir); +EAPI Eina_Bool ecore_file_app_installed(const char *exe); +EAPI Eina_List *ecore_file_app_list(void); + +/* Download */ + +EAPI Eina_Bool ecore_file_download(const char *url, + const char *dst, + Ecore_File_Download_Completion_Cb completion_cb, + Ecore_File_Download_Progress_Cb progress_cb, + void *data, + Ecore_File_Download_Job **job_ret); +EAPI Eina_Bool ecore_file_download_full(const char *url, + const char *dst, + Ecore_File_Download_Completion_Cb completion_cb, + Ecore_File_Download_Progress_Cb progress_cb, + void *data, + Ecore_File_Download_Job **job_ret, + Eina_Hash *headers); + +EAPI void ecore_file_download_abort_all(void); +EAPI void ecore_file_download_abort(Ecore_File_Download_Job *job); +EAPI Eina_Bool ecore_file_download_protocol_available(const char *protocol); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/ecore/src/lib/ecore_file/Makefile.am b/libraries/ecore/src/lib/ecore_file/Makefile.am new file mode 100644 index 0000000..ab23ace --- /dev/null +++ b/libraries/ecore/src/lib/ecore_file/Makefile.am @@ -0,0 +1,41 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_con \ +-I$(top_builddir)/src/lib/ecore \ +@EFL_ECORE_FILE_BUILD@ \ +@CURL_CFLAGS@ \ +@EVIL_CFLAGS@ \ +@EINA_CFLAGS@ \ +@WIN32_CPPFLAGS@ + +AM_CFLAGS = @WIN32_CFLAGS@ + +if BUILD_ECORE_CON +lib_ecore_con_la = $(top_builddir)/src/lib/ecore_con/libecore_con.la +endif + +lib_LTLIBRARIES = libecore_file.la +includes_HEADERS = Ecore_File.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_file_la_SOURCES = \ +ecore_file.c \ +ecore_file_monitor.c \ +ecore_file_monitor_inotify.c \ +ecore_file_monitor_win32.c \ +ecore_file_monitor_poll.c \ +ecore_file_path.c \ +ecore_file_download.c + +libecore_file_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(lib_ecore_con_la) \ +@EVIL_LIBS@ \ +@EINA_LIBS@ + +libecore_file_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ + +EXTRA_DIST = ecore_file_private.h + diff --git a/libraries/ecore/src/lib/ecore_file/Makefile.in b/libraries/ecore/src/lib/ecore_file/Makefile.in new file mode 100644 index 0000000..34945b3 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_file/Makefile.in @@ -0,0 +1,837 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_file +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_file_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore/libecore.la $(lib_ecore_con_la) +am_libecore_file_la_OBJECTS = ecore_file.lo ecore_file_monitor.lo \ + ecore_file_monitor_inotify.lo ecore_file_monitor_win32.lo \ + ecore_file_monitor_poll.lo ecore_file_path.lo \ + ecore_file_download.lo +libecore_file_la_OBJECTS = $(am_libecore_file_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_file_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libecore_file_la_LDFLAGS) $(LDFLAGS) \ + -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_file_la_SOURCES) +DIST_SOURCES = $(libecore_file_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_con \ +-I$(top_builddir)/src/lib/ecore \ +@EFL_ECORE_FILE_BUILD@ \ +@CURL_CFLAGS@ \ +@EVIL_CFLAGS@ \ +@EINA_CFLAGS@ \ +@WIN32_CPPFLAGS@ + +AM_CFLAGS = @WIN32_CFLAGS@ +@BUILD_ECORE_CON_TRUE@lib_ecore_con_la = $(top_builddir)/src/lib/ecore_con/libecore_con.la +lib_LTLIBRARIES = libecore_file.la +includes_HEADERS = Ecore_File.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_file_la_SOURCES = \ +ecore_file.c \ +ecore_file_monitor.c \ +ecore_file_monitor_inotify.c \ +ecore_file_monitor_win32.c \ +ecore_file_monitor_poll.c \ +ecore_file_path.c \ +ecore_file_download.c + +libecore_file_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(lib_ecore_con_la) \ +@EVIL_LIBS@ \ +@EINA_LIBS@ + +libecore_file_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ +EXTRA_DIST = ecore_file_private.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_file/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_file/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_file.la: $(libecore_file_la_OBJECTS) $(libecore_file_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_file_la_LINK) -rpath $(libdir) $(libecore_file_la_OBJECTS) $(libecore_file_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_file.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_file_download.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_file_monitor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_file_monitor_inotify.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_file_monitor_poll.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_file_monitor_win32.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_file_path.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file.c b/libraries/ecore/src/lib/ecore_file/ecore_file.c new file mode 100644 index 0000000..2546f2f --- /dev/null +++ b/libraries/ecore/src/lib/ecore_file/ecore_file.c @@ -0,0 +1,1110 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#ifndef _MSC_VER +# include +# include +#endif + +#ifdef _WIN32 +# include +#endif + +#ifdef HAVE_FEATURES_H +# include +#endif +#include +#include + +#ifdef HAVE_ATFILE_SOURCE +# include +#endif + +#include "ecore_file_private.h" + +int _ecore_file_log_dom = -1; +static int _ecore_file_init_count = 0; + +/* externally accessible functions */ + +/** + * @addtogroup Ecore_File_Group Ecore_File - Files and directories convenience functions + * + * @{ + */ + +/** + * @brief Initialize the Ecore_File library. + * + * @return 1 or greater on success, 0 on error. + * + * This function sets up Ecore_File and the services it will use + * (monitoring, downloading, PATH related feature). It returns 0 on + * failure, otherwise it returns the number of times it has already + * been called. + * + * When Ecore_File is not used anymore, call ecore_file_shutdown() + * to shut down the Ecore_File library. + */ +EAPI int +ecore_file_init() +{ + if (++_ecore_file_init_count != 1) + return _ecore_file_init_count; + + if (!ecore_init()) + return --_ecore_file_init_count; + + _ecore_file_log_dom = eina_log_domain_register + ("ecore_file", ECORE_FILE_DEFAULT_LOG_COLOR); + if(_ecore_file_log_dom < 0) + { + EINA_LOG_ERR("Impossible to create a log domain for the ecore file module."); + return --_ecore_file_init_count; + } + ecore_file_path_init(); + ecore_file_monitor_init(); + ecore_file_download_init(); + + /* FIXME: were the tests disabled for a good reason ? */ + + /* + if (!ecore_file_monitor_init()) + goto shutdown_ecore_file_path; + + if (!ecore_file_download_init()) + goto shutdown_ecore_file_monitor; + */ + + return _ecore_file_init_count; + + /* + shutdown_ecore_file_monitor: + ecore_file_monitor_shutdown(); + shutdown_ecore_file_path: + ecore_file_path_shutdown(); + + return --_ecore_file_init_count; + */ +} + +/** + * @brief Shut down the Ecore_File library. + * + * @return 0 when the library is completely shut down, 1 or + * greater otherwise. + * + * This function shuts down the Ecore_File library. It returns 0 when it has + * been called the same number of times than ecore_file_init(). In that case + * it shuts down all the services it uses. + */ +EAPI int +ecore_file_shutdown() +{ + if (--_ecore_file_init_count != 0) + return _ecore_file_init_count; + + ecore_file_download_shutdown(); + ecore_file_monitor_shutdown(); + ecore_file_path_shutdown(); + + eina_log_domain_unregister(_ecore_file_log_dom); + _ecore_file_log_dom = -1; + + ecore_shutdown(); + + return _ecore_file_init_count; +} + +/** + * @brief Get the time of the last modification to the given file. + * + * @param file The name of the file. + * @return Return the time of the last data modification, or 0 on + * failure. + * + * This function returns the time of the last modification of + * @p file. On failure, it returns 0. + */ +EAPI long long +ecore_file_mod_time(const char *file) +{ + struct stat st; + + if (stat(file, &st) < 0) return 0; + return st.st_mtime; +} + +/** + * @brief Get the size of the given file. + * + * @param file The name of the file. + * @return Return the size of the file in bytes, or 0 on failure. + * + * This function returns the size of @p file in bytes. On failure, it + * returns 0. + */ +EAPI long long +ecore_file_size(const char *file) +{ + struct stat st; + + if (stat(file, &st) < 0) return 0; + return st.st_size; +} + +/** + * @brief Check if the given file exists. + * + * @param file The name of the file. + * @return Return EINA_TRUE if the file exists, EINA_FALSE otherwise. + * + * This function returns EINA_TRUE if @p file exists on local filesystem, + * EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_file_exists(const char *file) +{ + struct stat st; + if (!file) return EINA_FALSE; + + /*Workaround so that "/" returns a true, otherwise we can't monitor "/" in ecore_file_monitor*/ + if (stat(file, &st) < 0 && strcmp(file, "/")) return EINA_FALSE; + return EINA_TRUE; +} + +/** + * @brief Check if the given file is a directory. + * + * @param file The name of the file. + * @return Return EINA_TRUE if the file exists and is a directory, + * EINA_FALSE otherwise. + * + * This function returns EINA_TRUE if @p file exists exists and is a + * directory on local filesystem, EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_file_is_dir(const char *file) +{ + struct stat st; + + if (stat(file, &st) < 0) return EINA_FALSE; + if (S_ISDIR(st.st_mode)) return EINA_TRUE; + return EINA_FALSE; +} + +static mode_t default_mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; + +/** + * @brief Create a new directory. + * + * @param dir The name of the directory to create + * @return EINA_TRUE on successful creation, EINA_FALSE otherwise. + * + * This function creates the directory @p dir with the mode S_IRUSR | + * S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH. On + * success, it returns EINA_TRUE, EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_file_mkdir(const char *dir) +{ + if (mkdir(dir, default_mode) < 0) return EINA_FALSE; + return EINA_TRUE; +} + +/** + * @brief Create complete directory in a batch. + * + * @param dirs The list of directories, null terminated. + * @return The number of successful directories created, -1 if dirs is + * @c NULL. + * + * This function creates all the directories that are in the null + * terminated array @p dirs. The function loops over the directories + * and call ecore_file_mkdir(). This function returns -1 if @p dirs is + * @c NULL, otherwise if returns the number of suceesfully created + * directories. + */ +EAPI int +ecore_file_mkdirs(const char **dirs) +{ + int i = 0; + + if (!dirs) return -1; + + for (; *dirs; dirs++) + if (ecore_file_mkdir(*dirs)) + i++; + return i; +} + +/** + * @brief Create complete list of sub-directories in a batch (optimized). + * + * @param base The base directory to act on. + * @param subdirs The list of directories, null terminated. + * @return number of successful directories created, -1 on failure. + * + * This function creates all the directories that are in the null + * terminated array @p dirs in the @p base directory. If @p base does + * not exist, it will be created. The function loops over the directories + * and call ecore_file_mkdir(). The whole path of the directories must + * exist. So if base/a/b/c wants to be created, @p subdirs must + * contain "a", "a/b" and "a/b/c", in that order. This function + * returns -1 if @p dirs or @p base are @c NULL, or if @p base is + * empty ("\0"). It returns 0 is @p base is not a directory or + * invalid, or if it can't be created. Otherwise if returns the number + * of suceesfully created directories. + */ +EAPI int +ecore_file_mksubdirs(const char *base, const char **subdirs) +{ +#ifndef HAVE_ATFILE_SOURCE + char buf[PATH_MAX]; + int baselen; +#else + int fd; + DIR *dir; +#endif + int i; + + if (!subdirs) return -1; + if ((!base) || (base[0] == '\0')) return -1; + + if ((!ecore_file_is_dir(base)) && (!ecore_file_mkpath(base))) + return 0; + +#ifndef HAVE_ATFILE_SOURCE + baselen = eina_strlcpy(buf, base, sizeof(buf)); + if ((baselen < 1) || (baselen + 1 >= (int)sizeof(buf))) + return 0; + + if (buf[baselen - 1] != '/') + { + buf[baselen] = '/'; + baselen++; + } +#else + dir = opendir(base); + if (!dir) + return 0; + fd = dirfd(dir); +#endif + + i = 0; + for (; *subdirs; subdirs++) + { + struct stat st; + +#ifndef HAVE_ATFILE_SOURCE + eina_strlcpy(buf + baselen, *subdirs, sizeof(buf) - baselen); + if (stat(buf, &st) == 0) +#else + if (fstatat(fd, *subdirs, &st, 0) == 0) +#endif + { + if (S_ISDIR(st.st_mode)) + { + i++; + continue; + } + } + else + { + if (errno == ENOENT) + { +#ifndef HAVE_ATFILE_SOURCE + if (mkdir(buf, default_mode) == 0) +#else + if (mkdirat(fd, *subdirs, default_mode) == 0) +#endif + { + i++; + continue; + } + } + } + } + +#ifdef HAVE_ATFILE_SOURCE + closedir(dir); +#endif + + return i; +} + +/** + * @brief Delete the given directory. + * + * @param dir The name of the directory to delete. + * @return EINA_TRUE on success, EINA_FALSE otherwise. + * + * This function deletes @p dir. It returns EINA_TRUE on success, + * EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_file_rmdir(const char *dir) +{ + if (rmdir(dir) < 0) return EINA_FALSE; + return EINA_TRUE; +} + +/** + * @brief Delete the given file. + * + * @param file The name of the file to delete. + * @return EINA_TRUE on success, EINA_FALSE otherwise. + * + * This function deletes @p file. It returns EINA_TRUE on success, + * EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_file_unlink(const char *file) +{ + if (unlink(file) < 0) return EINA_FALSE; + return EINA_TRUE; +} + +/** + * @brief Remove the given file or directory. + * + * @param file The name of the file or directory to delete. + * @return EINA_TRUE on success, EINA_FALSE otherwise. + * + * This function removes @p file. It returns EINA_TRUE on success, + * EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_file_remove(const char *file) +{ + if (remove(file) < 0) return EINA_FALSE; + return EINA_TRUE; +} + +/** + * @brief Delete the given directory and all its contents. + * + * @param dir The name of the directory to delete. + * @return EINA_TRUE on success, EINA_FALSE otherwise. + * + * This function delete @p dir and all its contents. If @p dir is a + * link only the link is removed. It returns EINA_TRUE on success, + * EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_file_recursive_rm(const char *dir) +{ + Eina_Iterator *it; + char buf[PATH_MAX]; + struct stat st; + int ret; + + if (readlink(dir, buf, sizeof(buf)) > 0) + return ecore_file_unlink(dir); + + ret = stat(dir, &st); + if ((ret == 0) && (S_ISDIR(st.st_mode))) + { + Eina_File_Direct_Info *info; + + ret = 1; + if (stat(dir, &st) == -1) return EINA_FALSE; /* WOOT: WHY ARE WE CALLING STAT TWO TIMES ??? */ + + it = eina_file_direct_ls(dir); + EINA_ITERATOR_FOREACH(it, info) + { + if (!ecore_file_recursive_rm(info->path)) + ret = 0; + } + eina_iterator_free(it); + + if (!ecore_file_rmdir(dir)) ret = 0; + if (ret) + return EINA_TRUE; + else + return EINA_FALSE; + } + else + { + if (ret == -1) return EINA_FALSE; + return ecore_file_unlink(dir); + } +} + +static inline Eina_Bool +_ecore_file_mkpath_if_not_exists(const char *path) +{ + struct stat st; + + /* Windows: path like C: or D: etc are valid, but stat() returns an error */ +#ifdef _WIN32 + if ((strlen(path) == 2) && + ((path[0] >= 'a' && path[0] <= 'z') || + (path[0] >= 'A' && path[0] <= 'Z')) && + (path[1] == ':')) + return EINA_TRUE; +#endif + + if (stat(path, &st) < 0) + return ecore_file_mkdir(path); + else if (!S_ISDIR(st.st_mode)) + return EINA_FALSE; + else + return EINA_TRUE; +} + +/** + * @brief Create a complete path. + * + * @param path The path to create + * @return EINA_TRUE on success, EINA_FALSE otherwise. + * + * This function creates @p path and all the subdirectories it + * contains. The separator is '/' or '\'. If @p path exists, this + * function returns EINA_TRUE immediately. It returns EINA_TRUE on + * success, EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_file_mkpath(const char *path) +{ + char ss[PATH_MAX]; + unsigned int i; + + if (ecore_file_is_dir(path)) + return EINA_TRUE; + + for (i = 0; path[i] != '\0'; ss[i] = path[i], i++) + { + if (i == sizeof(ss) - 1) return EINA_FALSE; + if (((path[i] == '/') || (path[i] == '\\')) && (i > 0)) + { + ss[i] = '\0'; + if (!_ecore_file_mkpath_if_not_exists(ss)) + return EINA_FALSE; + } + } + ss[i] = '\0'; + return _ecore_file_mkpath_if_not_exists(ss); +} + +/** + * @brief Create complete paths in a batch. + * + * @param paths list of paths, null terminated. + * @return number of successful paths created, -1 if paths is NULL. + * + * This function creates all the directories that are in the null + * terminated array @p paths. The function loops over the directories + * and call ecore_file_mkpath(), hence on Windows, '\' must be + * replaced by '/' before calling that function. This function + * returns -1 if @p paths is @c NULL. Otherwise if returns the number + * of suceesfully created directories. + */ +EAPI int +ecore_file_mkpaths(const char **paths) +{ + int i = 0; + + if (!paths) return -1; + + for (; *paths; paths++) + if (ecore_file_mkpath(*paths)) + i++; + return i; +} + +/** + * @brief Copy the given file to the given destination. + * + * @param src The name of the source file. + * @param dst The name of the destination file. + * @return EINA_TRUE on success, EINA_FALSE otherwise. + * + * This function copies @p src to @p dst. If the absolute path name of + * @p src and @p dst can not be computed, or if they are equal, or if + * the copy fails, the function returns EINA_FALSE, otherwise it + * returns EINA_TRUE. + */ +EAPI Eina_Bool +ecore_file_cp(const char *src, const char *dst) +{ + FILE *f1, *f2; + char buf[16384]; + char realpath1[PATH_MAX], realpath2[PATH_MAX]; + size_t num; + Eina_Bool ret = EINA_TRUE; + + if (!realpath(src, realpath1)) return EINA_FALSE; + if (realpath(dst, realpath2) && !strcmp(realpath1, realpath2)) return EINA_FALSE; + + f1 = fopen(src, "rb"); + if (!f1) return EINA_FALSE; + f2 = fopen(dst, "wb"); + if (!f2) + { + fclose(f1); + return EINA_FALSE; + } + while ((num = fread(buf, 1, sizeof(buf), f1)) > 0) + { + if (fwrite(buf, 1, num, f2) != num) ret = EINA_FALSE; + } + fclose(f1); + fclose(f2); + return ret; +} + +/** + * @brief Move the given file to the given destination. + * + * @param src The name of the source file. + * @param dst The name of the destination file. + * @return EINA_TRUE on success, EINA_FALSE otherwise. + * + * This function moves @p src to @p dst. It returns EINA_TRUE on + * success, EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_file_mv(const char *src, const char *dst) +{ + char buf[PATH_MAX]; + int fd; + + if (rename(src, dst)) + { + // File cannot be moved directly because + // it resides on a different mount point. + if (errno == EXDEV) + { + struct stat st; + + // Make sure this is a regular file before + // we do anything fancy. + stat(src, &st); + if (S_ISREG(st.st_mode)) + { + char *dir; + + dir = ecore_file_dir_get(dst); + // Since we can't directly rename, try to + // copy to temp file in the dst directory + // and then rename. + snprintf(buf, sizeof(buf), "%s/.%s.tmp.XXXXXX", + dir, ecore_file_file_get(dst)); + free(dir); + fd = mkstemp(buf); + if (fd < 0) + { + perror("mkstemp"); + goto FAIL; + } + close(fd); + + // Copy to temp file + if (!ecore_file_cp(src, buf)) + goto FAIL; + + // Set file permissions of temp file to match src + chmod(buf, st.st_mode); + + // Try to atomically move temp file to dst + if (rename(buf, dst)) + { + // If we still cannot atomically move + // do a normal copy and hope for the best. + if (!ecore_file_cp(buf, dst)) + goto FAIL; + } + + // Delete temporary file and src + ecore_file_unlink(buf); + ecore_file_unlink(src); + goto PASS; + } + } + goto FAIL; + } + +PASS: + return EINA_TRUE; + +FAIL: + return EINA_FALSE; +} + +/** + * @brief Create a symbolic link. + * + * @param src The name of the file to link. + * @param dest The name of link. + * @return EINA_TRUE on success, EINA_FALSE otherwise. + * + * This function create the symbolic link @p dest of @p src. This + * function does not work on Windows. It returns EINA_TRUE on success, + * EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_file_symlink(const char *src, const char *dest) +{ + if (!symlink(src, dest)) return EINA_TRUE; + + return EINA_FALSE; +} + +/** + * @brief Get the canonicalized absolute path name. + * + * @param file The file path. + * @return The canonicalized absolute pathname or an empty string on + * failure. + * + * This function returns the absolute path name of @p file as a newly + * allocated string. If @p file is @c NULL, or on error, this function + * returns an empty string. Otherwise, it returns the absolute path + * name. When not needed anymore, the returned value must be freed. + */ +EAPI char * +ecore_file_realpath(const char *file) +{ + char buf[PATH_MAX]; + + /* + * Some implementations of realpath do not conform to the SUS. + * And as a result we must prevent a null arg from being passed. + */ + if (!file) return strdup(""); + if (!realpath(file, buf)) return strdup(""); + + return strdup(buf); +} + +/** + * Get the filename from a given path. + * + * @param path The complete path. + * @return The file name. + * + * This function returns the file name of @p path. If @p path is + * @c NULL, the functions returns @c NULL. + */ +EAPI const char * +ecore_file_file_get(const char *path) +{ + char *result = NULL; + + if (!path) return NULL; + if ((result = strrchr(path, '/'))) result++; + else result = (char *)path; + return result; +} + +/** + * @brief Get the directory where the given file resides. + * + * @param file The name of the file. + * @return The directory name. + * + * This function returns the directory where @p file resides as anewly + * allocated string. If @p file is @c NULL or on error, this function + * returns @c NULL. When not needed anymore, the returned value must + * be freed. + */ +EAPI char * +ecore_file_dir_get(const char *file) +{ + char *p; + char buf[PATH_MAX]; + + if (!file) return NULL; + strncpy(buf, file, PATH_MAX); + buf[PATH_MAX - 1] = 0; + p = dirname(buf); + return strdup(p); +} + +/** + * @brief Check if the given file can be read. + * + * @param file The name of the file. + * @return EINA_TRUE if the file is readable, EINA_FALSE otherwise. + * + * This function returns EINA_TRUE if @p file can be read, EINA_FALSE + * otherwise. + */ +EAPI Eina_Bool +ecore_file_can_read(const char *file) +{ + if (!file) return EINA_FALSE; + if (!access(file, R_OK)) return EINA_TRUE; + return EINA_FALSE; +} + +/** + * @brief Check if the given file can be written. + * + * @param file The name of the file. + * @return EINA_TRUE if the file is writable, EINA_FALSE otherwise. + * + * This function returns EINA_TRUE if @p file can be written, EINA_FALSE + * otherwise. + */ +EAPI Eina_Bool +ecore_file_can_write(const char *file) +{ + if (!file) return EINA_FALSE; + if (!access(file, W_OK)) return EINA_TRUE; + return EINA_FALSE; +} + +/** + * @bbrief Check if the given file can be executed. + * + * @param file The name of the file. + * @return EINA_TRUE if the file can be executed, EINA_FALSE otherwise. + * + * This function returns EINA_TRUE if @p file can be executed, EINA_FALSE + * otherwise. + */ +EAPI Eina_Bool +ecore_file_can_exec(const char *file) +{ + if (!file) return EINA_FALSE; + if (!access(file, X_OK)) return EINA_TRUE; + return EINA_FALSE; +} + +/** + * @brief Get the path pointed by the given link. + * + * @param lnk The name of the link. + * @return The path pointed by link or NULL. + * + * This function returns the path pointed by @p link as a newly + * allocated string. This function does not work on Windows. On + * failure, the function returns @c NULL. When not needed anymore, the + * returned value must be freed. + */ +EAPI char * +ecore_file_readlink(const char *lnk) +{ + char buf[PATH_MAX]; + int count; + + if ((count = readlink(lnk, buf, sizeof(buf) - 1)) < 0) return NULL; + buf[count] = 0; + return strdup(buf); +} + +/** + * @brief Get the list of the files and directories in the given + * directory. + * + * @param dir The name of the directory to list + * @return Return an Eina_List containing all the files in the directory; + * on failure it returns NULL. + * + * This function returns a list of allocated strings of all the files + * and directories contained in @p dir. The list will be sorted with + * strcoll as compare function. That means that you may want to set + * the current locale for the category LC_COLLATE with + * setlocale(). For more information see the manual pages of strcoll + * and setlocale. The list will not contain the directory entries for + * '.' and '..'. On failure, @c NULL is returned. When not needed + * anymore, the list elements must be freed. + */ +EAPI Eina_List * +ecore_file_ls(const char *dir) +{ + Eina_File_Direct_Info *info; + Eina_Iterator *ls; + Eina_List *list = NULL; + + ls = eina_file_direct_ls(dir); + EINA_ITERATOR_FOREACH(ls, info) + { + char *f; + + f = strdup(info->path + info->name_start); + list = eina_list_append(list, f); + } + eina_iterator_free(ls); + + list = eina_list_sort(list, eina_list_count(list), EINA_COMPARE_CB(strcoll)); + + return list; +} + +/** + * @brief Return the executable from the given command. + * + * @param app The application command, with parameters. + * + * This function returns the executable from @p app as a newly + * allocated string. Arguments are removed and escae characters are + * handled. If @p app is @c NULL, or on failure, the function returns + * @c NULL. When not needed anymore, the returned value must be freed. + */ +EAPI char * +ecore_file_app_exe_get(const char *app) +{ + char *p, *pp, *exe1 = NULL, *exe2 = NULL; + char *exe = NULL; + int in_quot_dbl = 0, in_quot_sing = 0, restart = 0; + + if (!app) return NULL; + + p = (char *)app; +restart: + while ((*p) && (isspace(*p))) p++; + exe1 = p; + while (*p) + { + if (in_quot_sing) + { + if (*p == '\'') + in_quot_sing = 0; + } + else if (in_quot_dbl) + { + if (*p == '\"') + in_quot_dbl = 0; + } + else + { + if (*p == '\'') + in_quot_sing = 1; + else if (*p == '\"') + in_quot_dbl = 1; + if ((isspace(*p)) && (!((p > app) && (p[-1] != '\\')))) + break; + } + p++; + } + exe2 = p; + if (exe2 == exe1) return NULL; + if (*exe1 == '~') + { + char *homedir; + int len; + + /* Skip ~ */ + exe1++; + + homedir = getenv("HOME"); + if (!homedir) return NULL; + len = strlen(homedir); + if (exe) free(exe); + exe = malloc(len + exe2 - exe1 + 2); + if (!exe) return NULL; + pp = exe; + if (len) + { + strcpy(exe, homedir); + pp += len; + if (*(pp - 1) != '/') + { + *pp = '/'; + pp++; + } + } + } + else + { + if (exe) free(exe); + exe = malloc(exe2 - exe1 + 1); + if (!exe) return NULL; + pp = exe; + } + p = exe1; + restart = 0; + in_quot_dbl = 0; + in_quot_sing = 0; + while (*p) + { + if (in_quot_sing) + { + if (*p == '\'') + in_quot_sing = 0; + else + { + *pp = *p; + pp++; + } + } + else if (in_quot_dbl) + { + if (*p == '\"') + in_quot_dbl = 0; + else + { + /* technically this is wrong. double quotes also accept + * special chars: + * + * $, `, \ + */ + *pp = *p; + pp++; + } + } + else + { + /* technically we should handle special chars: + * + * $, `, \, etc. + */ + if ((p > exe1) && (p[-1] == '\\')) + { + if (*p != '\n') + { + *pp = *p; + pp++; + } + } + else if ((p > exe1) && (*p == '=')) + { + restart = 1; + *pp = *p; + pp++; + } + else if (*p == '\'') + in_quot_sing = 1; + else if (*p == '\"') + in_quot_dbl = 1; + else if (isspace(*p)) + { + if (restart) + goto restart; + else + break; + } + else + { + *pp = *p; + pp++; + } + } + p++; + } + *pp = 0; + return exe; +} + +/** + * @brief Add the escape sequence ('\\') to the given file name. + * + * @param filename The file name. + * @return The file name with special characters escaped. + * + * This function adds the escape sequence ('\\') to the given file + * name and returns the result as a newly allocated string. If the + * length of the returned string is longer than PATH_MAX, or on + * failure, @c NULL is returned. When not needed anymore, the returned + * value must be freed. + */ +EAPI char * +ecore_file_escape_name(const char *filename) +{ + const char *p; + char *q; + char buf[PATH_MAX]; + + p = filename; + q = buf; + while (*p) + { + if ((q - buf) > (PATH_MAX - 6)) return NULL; + if ( + (*p == ' ') || (*p == '\t') || (*p == '\n') || + (*p == '\\') || (*p == '\'') || (*p == '\"') || + (*p == ';') || (*p == '!') || (*p == '#') || + (*p == '$') || (*p == '%') || (*p == '&') || + (*p == '*') || (*p == '(') || (*p == ')') || + (*p == '[') || (*p == ']') || (*p == '{') || + (*p == '}') || (*p == '|') || (*p == '<') || + (*p == '>') || (*p == '?') + ) + { + *q = '\\'; + q++; + } + *q = *p; + q++; + p++; + } + *q = 0; + return strdup(buf); +} + +/** + * @bried Remove the extension from the given file name. + * + * @param path The name of the file. + * @return A newly allocated string with the extension stripped out or + * NULL on errors. + * + * This function removes the extension from @p path and returns the + * result as a newly allocated string. If @p path is @c NULL, or on + * failure, the function returns @c NULL. When not needed anymore, the + * returned value must be freed. + */ +EAPI char * +ecore_file_strip_ext(const char *path) +{ + char *p, *file = NULL; + + if (!path) + return NULL; + + p = strrchr(path, '.'); + if (!p) + file = strdup(path); + else if (p != path) + { + file = malloc(((p - path) + 1) * sizeof(char)); + if (file) + { + memcpy(file, path, (p - path)); + file[p - path] = 0; + } + } + + return file; +} + +/** + * @brief Check if the given directory is empty. + * + * @param dir The name of the directory to check. + * @return 1 if directory is empty, 0 if it has at least one file or + * -1 in case of errors. + * + * This functions checks if @p dir is empty. The '.' and '..' files + * will be ignored. If @p dir is empty, 1 is returned, if it contains + * at least 1 file, 0 is returned. On failure, -1 is returned. + */ +EAPI int +ecore_file_dir_is_empty(const char *dir) +{ + Eina_File_Direct_Info *info; + Eina_Iterator *it; + + it = eina_file_direct_ls(dir); + if (!it) return -1; + + EINA_ITERATOR_FOREACH(it, info) + { + eina_iterator_free(it); + return 0; + } + + eina_iterator_free(it); + return 1; +} + +/** + * @} + */ diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file_download.c b/libraries/ecore/src/lib/ecore_file/ecore_file_download.c new file mode 100644 index 0000000..c7efc4d --- /dev/null +++ b/libraries/ecore/src/lib/ecore_file/ecore_file_download.c @@ -0,0 +1,440 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#ifdef BUILD_ECORE_CON +# include "Ecore_Con.h" +#endif + +#include "ecore_file_private.h" + +#ifdef BUILD_ECORE_CON + +#define ECORE_MAGIC_FILE_DOWNLOAD_JOB 0xf7427cb8 + +struct _Ecore_File_Download_Job +{ + ECORE_MAGIC; + + Ecore_Con_Url *url_con; + FILE *file; + + char *dst; + + Ecore_File_Download_Completion_Cb completion_cb; + Ecore_File_Download_Progress_Cb progress_cb; +}; + +#ifdef HAVE_CURL +Ecore_File_Download_Job *_ecore_file_download_curl(const char *url, const char *dst, + Ecore_File_Download_Completion_Cb completion_cb, + Ecore_File_Download_Progress_Cb progress_cb, + void *data, + Eina_Hash *headers); + +static Eina_Bool _ecore_file_download_url_complete_cb(void *data, int type, void *event); +static Eina_Bool _ecore_file_download_url_progress_cb(void *data, int type, void *event); +#endif + +static Ecore_Event_Handler *_url_complete_handler = NULL; +static Ecore_Event_Handler *_url_progress_download = NULL; +static Eina_List *_job_list; + +#endif /* BUILD_ECORE_CON */ + +int +ecore_file_download_init(void) +{ +#ifdef BUILD_ECORE_CON + if (!ecore_con_url_init()) + return 0; + +# ifdef HAVE_CURL + _url_complete_handler = ecore_event_handler_add(ECORE_CON_EVENT_URL_COMPLETE, _ecore_file_download_url_complete_cb, NULL); + _url_progress_download = ecore_event_handler_add(ECORE_CON_EVENT_URL_PROGRESS, _ecore_file_download_url_progress_cb, NULL); +# endif + +#endif /* BUILD_ECORE_CON */ + + return 1; +} + +void +ecore_file_download_shutdown(void) +{ +#ifdef BUILD_ECORE_CON + if (_url_complete_handler) + ecore_event_handler_del(_url_complete_handler); + if (_url_progress_download) + ecore_event_handler_del(_url_progress_download); + _url_complete_handler = NULL; + _url_progress_download = NULL; + ecore_file_download_abort_all(); + + ecore_con_url_shutdown(); +#endif /* BUILD_ECORE_CON */ +} + +#ifdef BUILD_ECORE_CON +# ifdef HAVE_CURL +static Eina_Bool +_ecore_file_download_headers_foreach_cb(const Eina_Hash *hash __UNUSED__, const void *key, void *data, void *fdata) +{ + Ecore_File_Download_Job *job = fdata; + ecore_con_url_additional_header_add(job->url_con, key, data); + + return EINA_TRUE; +} +# endif +#endif + +static Eina_Bool +_ecore_file_download(const char *url, + const char *dst, + Ecore_File_Download_Completion_Cb completion_cb, + Ecore_File_Download_Progress_Cb progress_cb, + void *data, + Ecore_File_Download_Job **job_ret, + Eina_Hash *headers) +{ +#ifdef BUILD_ECORE_CON + char *dir = ecore_file_dir_get(dst); + + if (!ecore_file_is_dir(dir)) + { + ERR("%s is not a directory", dir); + free(dir); + return EINA_FALSE; + } + free(dir); + if (ecore_file_exists(dst)) + { + WRN("%s already exists", dst); + return EINA_FALSE; + } + + if (!strncmp(url, "file://", 7)) + { + /* FIXME: Maybe fork? Might take a while to copy. + * Check filesize? */ + /* Just copy it */ + + url += 7; + /* skip hostname */ + url = strchr(url, '/'); + return ecore_file_cp(url, dst); + } +# ifdef HAVE_CURL + else if ((!strncmp(url, "http://", 7)) || (!strncmp(url, "https://", 8)) || + (!strncmp(url, "ftp://", 6))) + { + /* download */ + Ecore_File_Download_Job *job; + + job = _ecore_file_download_curl(url, dst, completion_cb, progress_cb, data, headers); + if(job_ret) *job_ret = job; + if(job) + return EINA_TRUE; + else + { + ERR("no job returned\n"); + return EINA_FALSE; + } + return job ? EINA_TRUE : EINA_FALSE; + } +# else + else if ((!strncmp(url, "http://", 7)) || (!strncmp(url, "https://", 8)) || + (!strncmp(url, "ftp://", 6))) + { + (void)completion_cb; + (void)progress_cb; + (void)data; + (void)job_ret; + (void)headers; + return EINA_FALSE; + } +# endif + else + { + return EINA_FALSE; + } +#else + (void)url; + (void)dst; + (void)completion_cb; + (void)progress_cb; + (void)data; + (void)job_ret; + (void)headers; + return EINA_FALSE; +#endif /* BUILD_ECORE_CON */ +} + +/** + * @addtogroup Ecore_File_Group Ecore_File - Files and directories convenience functions + * + * @{ + */ + +/** + * @brief Download the given url to the given destination. + * + * @param url The complete url to download. + * @param dst The local file to save the downloaded to. + * @param completion_cb A callback called on download complete. + * @param progress_cb A callback called during the download operation. + * @param data User data passed to both callbacks. + * @param job_ret Job used to abort the download. + * @return EINA_TRUE if the download start or EINA_FALSE on failure + * + * This function starts the download of the URL @p url and saves it to + * @p dst. @p url must provide the protocol, including 'http://', + * 'ftp://' or 'file://'. Ecore_File must be compiled with CURL to + * download using http and ftp protocols. If @p dst is ill-formed, or + * if it already exists, the function returns EINA_FALSE. When the + * download is complete, the callback @p completion_cb is called and + * @p data is passed to it. The @p status parameter of @p completion_cb + * will be filled with the status of the download (200, 404,...). The + * @p progress_cb is called during the download operation, each time a + * packet is received or when CURL wants. It can be used to display the + * percentage of the downloaded file. Return 0 from this callback, if provided, + * to continue the operation or anything else to abort the download. The only + * operations that can be aborted are those with protocol 'http' or 'ftp'. In + * that case @p job_ret can be filled. It can be used with + * ecore_file_download_abort() or ecore_file_download_abort_all() to + * respectively abort one or all download operations. This function returns + * EINA_TRUE if the download starts, EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_file_download(const char *url, + const char *dst, + Ecore_File_Download_Completion_Cb completion_cb, + Ecore_File_Download_Progress_Cb progress_cb, + void *data, + Ecore_File_Download_Job **job_ret) +{ + return _ecore_file_download(url, dst, completion_cb, progress_cb, data, job_ret, NULL); +} + +/** + * @brief Download the given url to the given destination with additional headers. + * + * @param url The complete url to download. + * @param dst The local file to save the downloaded to. + * @param completion_cb A callback called on download complete. + * @param progress_cb A callback called during the download operation. + * @param data User data passed to both callbacks. + * @param job_ret Job used to abort the download. + * @param headers pointer of header lists. + * @return EINA_TRUE if the download start or EINA_FALSE on failure + */ +EAPI Eina_Bool +ecore_file_download_full(const char *url, + const char *dst, + Ecore_File_Download_Completion_Cb completion_cb, + Ecore_File_Download_Progress_Cb progress_cb, + void *data, + Ecore_File_Download_Job **job_ret, + Eina_Hash *headers) +{ + return _ecore_file_download(url, dst, completion_cb, progress_cb, data, job_ret, headers); +} + +/** + * @brief Check if the given protocol is available. + * + * @param protocol The protocol to check. + * @return EINA_TRUE if protocol is handled, EINA_FALSE otherwise. + * + * This function returns EINA_TRUE if @p protocol is supported, + * EINA_FALSE otherwise. @p protocol can be 'http://', 'ftp://' or + * 'file://'. Ecore_FILE must be compiled with CURL to handle http and + * ftp protocols. + */ +EAPI Eina_Bool +ecore_file_download_protocol_available(const char *protocol) +{ +#ifdef BUILD_ECORE_CON + if (!strncmp(protocol, "file://", 7)) return EINA_TRUE; +# ifdef HAVE_CURL + else if (!strncmp(protocol, "http://", 7)) return EINA_TRUE; + else if (!strncmp(protocol, "ftp://", 6)) return EINA_TRUE; +# endif +#else + (void)protocol; +#endif /* BUILD_ECORE_CON */ + + return EINA_FALSE; +} + +#ifdef BUILD_ECORE_CON + +# ifdef HAVE_CURL +static int +_ecore_file_download_url_compare_job(const void *data1, const void *data2) +{ + const Ecore_File_Download_Job *job = data1; + const Ecore_Con_Url *url = data2; + + if (job->url_con == url) return 0; + return -1; +} + +static Eina_Bool +_ecore_file_download_url_complete_cb(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Con_Event_Url_Complete *ev = event; + Ecore_File_Download_Job *job; + + job = eina_list_search_unsorted(_job_list, _ecore_file_download_url_compare_job, ev->url_con); + if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) return ECORE_CALLBACK_PASS_ON; + + fclose(job->file); + if (job->completion_cb) + job->completion_cb(ecore_con_url_data_get(job->url_con), job->dst, ev->status); + + _job_list = eina_list_remove(_job_list, job); + free(job->dst); + ecore_con_url_free(job->url_con); + free(job); + + return ECORE_CALLBACK_DONE; +} + +static Eina_Bool +_ecore_file_download_url_progress_cb(void *data __UNUSED__, int type __UNUSED__, void *event) +{ +/* this reports the downloads progress. if we return 0, then download + * continues, if we return anything else, then the download stops */ + Ecore_Con_Event_Url_Progress *ev = event; + Ecore_File_Download_Job *job; + + job = eina_list_search_unsorted(_job_list, _ecore_file_download_url_compare_job, ev->url_con); + if (!ECORE_MAGIC_CHECK(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB)) return ECORE_CALLBACK_PASS_ON; + + if (job->progress_cb) + if (job->progress_cb(ecore_con_url_data_get(job->url_con), job->dst, + (long int) ev->down.total, (long int) ev->down.now, + (long int) ev->up.total, (long int) ev->up.now) != 0) + { + _job_list = eina_list_remove(_job_list, job); + fclose(job->file); + free(job->dst); + free(job); + + return ECORE_CALLBACK_PASS_ON; + } + + return ECORE_CALLBACK_DONE; +} + +Ecore_File_Download_Job * +_ecore_file_download_curl(const char *url, const char *dst, + Ecore_File_Download_Completion_Cb completion_cb, + Ecore_File_Download_Progress_Cb progress_cb, + void *data, + Eina_Hash *headers) +{ + Ecore_File_Download_Job *job; + + job = calloc(1, sizeof(Ecore_File_Download_Job)); + if (!job) return NULL; + + ECORE_MAGIC_SET(job, ECORE_MAGIC_FILE_DOWNLOAD_JOB); + + job->file = fopen(dst, "wb"); + if (!job->file) + { + free(job); + return NULL; + } + job->url_con = ecore_con_url_new(url); + if (!job->url_con) + { + fclose(job->file); + free(job); + return NULL; + } + + if (headers) eina_hash_foreach(headers, _ecore_file_download_headers_foreach_cb, job); + ecore_con_url_fd_set(job->url_con, fileno(job->file)); + ecore_con_url_data_set(job->url_con, data); + + job->dst = strdup(dst); + + job->completion_cb = completion_cb; + job->progress_cb = progress_cb; + _job_list = eina_list_append(_job_list, job); + + if (!ecore_con_url_get(job->url_con)) + { + ecore_con_url_free(job->url_con); + _job_list = eina_list_remove(_job_list, job); + fclose(job->file); + ecore_file_remove(job->dst); + free(job->dst); + free(job); + return NULL; + } + + return job; +} +# endif +#endif + +/** + * @brief Abort the given download job and call the completion_cb + * callbck with a status of 1 (error). + * + * @param job The download job to abort. + * + * This function aborts a download operation started by + * ecore_file_download(). @p job is the #Ecore_File_Download_Job + * structure filled by ecore_file_download(). If it is @c NULL, this + * function does nothing. To abort all the currently downloading + * operations, call ecore_file_download_abort_all(). + */ +EAPI void +ecore_file_download_abort(Ecore_File_Download_Job *job) +{ + if (!job) + return; + +#ifdef BUILD_ECORE_CON + if (job->completion_cb) + job->completion_cb(ecore_con_url_data_get(job->url_con), job->dst, 1); +# ifdef HAVE_CURL + ecore_con_url_free(job->url_con); +# endif + _job_list = eina_list_remove(_job_list, job); + fclose(job->file); + free(job->dst); + free(job); +#endif /* BUILD_ECORE_CON */ +} + +/** + * @brief Abort all downloads. + * + * This function aborts all the downloads that have been started by + * ecore_file_download(). It loops over the started downloads and call + * ecore_file_download_abort() for each of them. To abort only one + * specific download operation, call ecore_file_download_abort(). + */ +EAPI void +ecore_file_download_abort_all(void) +{ +#ifdef BUILD_ECORE_CON + Ecore_File_Download_Job *job; + + EINA_LIST_FREE(_job_list, job) + ecore_file_download_abort(job); +#endif /* BUILD_ECORE_CON */ +} + +/** + * @} + */ diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file_monitor.c b/libraries/ecore/src/lib/ecore_file/ecore_file_monitor.c new file mode 100644 index 0000000..7c334c0 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_file/ecore_file_monitor.c @@ -0,0 +1,180 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "ecore_file_private.h" + +typedef enum { + ECORE_FILE_MONITOR_TYPE_NONE, +#ifdef HAVE_INOTIFY + ECORE_FILE_MONITOR_TYPE_INOTIFY, +#endif +#ifdef HAVE_NOTIFY_WIN32 + ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32, +#endif +#ifdef HAVE_POLL + ECORE_FILE_MONITOR_TYPE_POLL +#endif +} Ecore_File_Monitor_Type; + +static Ecore_File_Monitor_Type monitor_type = ECORE_FILE_MONITOR_TYPE_NONE; + +int +ecore_file_monitor_init(void) +{ +#ifdef HAVE_INOTIFY + monitor_type = ECORE_FILE_MONITOR_TYPE_INOTIFY; + if (ecore_file_monitor_inotify_init()) + return 1; +#endif +#ifdef HAVE_NOTIFY_WIN32 + monitor_type = ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32; + if (ecore_file_monitor_win32_init()) + return 1; +#endif +#ifdef HAVE_POLL + monitor_type = ECORE_FILE_MONITOR_TYPE_POLL; + if (ecore_file_monitor_poll_init()) + return 1; +#endif + monitor_type = ECORE_FILE_MONITOR_TYPE_NONE; + return 0; +} + +void +ecore_file_monitor_shutdown(void) +{ + switch (monitor_type) + { + case ECORE_FILE_MONITOR_TYPE_NONE: + break; +#ifdef HAVE_INOTIFY + case ECORE_FILE_MONITOR_TYPE_INOTIFY: + ecore_file_monitor_inotify_shutdown(); + break; +#endif +#ifdef HAVE_NOTIFY_WIN32 + case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32: + ecore_file_monitor_win32_shutdown(); + break; +#endif +#ifdef HAVE_POLL + case ECORE_FILE_MONITOR_TYPE_POLL: + ecore_file_monitor_poll_shutdown(); + break; +#endif + } +} + +/** + * @addtogroup Ecore_File_Group Ecore_File - Files and directories convenience functions + * + * @{ + */ + +/** + * @brief Monitor the given path using inotify, Windows notification, or polling. + * + * @param path The path to monitor. + * @param func The function to call on changes. + * @param data The data passed to func. + * @return An Ecore_File_Monitor pointer or NULL on failure. + * + * This function monitors @p path. If @p path is @c NULL, or is an + * empty string, or none of the notify methods (Inotify, Windows + * notification or polling) is available, or if @p path is not a file, + * the function returns @c NULL. Otherwise, it returns a newly + * allocated Ecore_File_Monitor object and the monitoring begins. When + * one of the #Ecore_File_Event event is notified, @p func is called + * and @p data is passed to @p func. Call ecore_file_monitor_del() to + * stop the monitoring. + */ +EAPI Ecore_File_Monitor * +ecore_file_monitor_add(const char *path, + Ecore_File_Monitor_Cb func, + void *data) +{ + if (!path || !*path) + return NULL; + + switch (monitor_type) + { + case ECORE_FILE_MONITOR_TYPE_NONE: + return NULL; +#ifdef HAVE_INOTIFY + case ECORE_FILE_MONITOR_TYPE_INOTIFY: + return ecore_file_monitor_inotify_add(path, func, data); +#endif +#ifdef HAVE_NOTIFY_WIN32 + case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32: + return ecore_file_monitor_win32_add(path, func, data); +#endif +#ifdef HAVE_POLL + case ECORE_FILE_MONITOR_TYPE_POLL: + return ecore_file_monitor_poll_add(path, func, data); +#endif + } + return NULL; +} + +/** + * @brief Stop the monitoring of the given path. + * + * @param em The Ecore_File_Monitor to stop. + * + * This function stops the the monitoring of the path that has been + * monitored by ecore_file_monitor_add(). @p em must be the value + * returned by ecore_file_monitor_add(). If @p em is @c NULL, or none + * of the notify methods (Inotify, Windows notification or polling) is + * availablethis function does nothing. + */ +EAPI void +ecore_file_monitor_del(Ecore_File_Monitor *em) +{ + if (!em) + return; + + switch (monitor_type) + { + case ECORE_FILE_MONITOR_TYPE_NONE: + break; +#ifdef HAVE_INOTIFY + case ECORE_FILE_MONITOR_TYPE_INOTIFY: + ecore_file_monitor_inotify_del(em); + break; +#endif +#ifdef HAVE_NOTIFY_WIN32 + case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32: + ecore_file_monitor_win32_del(em); + break; +#endif +#ifdef HAVE_POLL + case ECORE_FILE_MONITOR_TYPE_POLL: + ecore_file_monitor_poll_del(em); + break; +#endif + } +} + +/** + * @brief Get the monitored path. + * + * @param em The Ecore_File_Monitor to query. + * @return The path that is monitored by @p em. + * + * This function returns the monitored path that has been + * monitored by ecore_file_monitor_add(). @p em must be the value + * returned by ecore_file_monitor_add(). If @p em is @c NULL, the + * function returns @c NULL. + */ +EAPI const char * +ecore_file_monitor_path_get(Ecore_File_Monitor *em) +{ + if (!em) + return NULL; + return em->path; +} + +/** + * @} + */ diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_inotify.c b/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_inotify.c new file mode 100644 index 0000000..c3533ad --- /dev/null +++ b/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_inotify.c @@ -0,0 +1,369 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#include "ecore_file_private.h" + +/* + * TODO: + * + * - Listen to these events: + * IN_ACCESS, IN_ATTRIB, IN_CLOSE_WRITE, IN_CLOSE_NOWRITE, IN_OPEN + * - Read all events first, then call the callbacks. This will prevent several + * callbacks with the typic save cycle (delete file, new file) + * - Listen to IN_IGNORED, emitted when the watch is removed + */ + +#ifdef HAVE_INOTIFY + +#ifdef HAVE_SYS_INOTIFY +# include +#else +# include +# include +#endif + +#ifndef HAVE_SYS_INOTIFY +static inline int inotify_init(void); +static inline int inotify_add_watch(int fd, const char *name, __u32 mask); +static inline int inotify_rm_watch(int fd, __u32 wd); +#endif + + +typedef struct _Ecore_File_Monitor_Inotify Ecore_File_Monitor_Inotify; + +#define ECORE_FILE_MONITOR_INOTIFY(x) ((Ecore_File_Monitor_Inotify *)(x)) + +struct _Ecore_File_Monitor_Inotify +{ + Ecore_File_Monitor monitor; + int wd; +}; + +static Ecore_Fd_Handler *_fdh = NULL; +static Ecore_File_Monitor *_monitors = NULL; +static pid_t _inotify_fd_pid = -1; + +static Eina_Bool _ecore_file_monitor_inotify_handler(void *data, Ecore_Fd_Handler *fdh); +static Ecore_File_Monitor *_ecore_file_monitor_inotify_monitor_find(int wd); +static void _ecore_file_monitor_inotify_events(Ecore_File_Monitor *em, char *file, int mask); +static int _ecore_file_monitor_inotify_monitor(Ecore_File_Monitor *em, const char *path); +#if 0 +static void _ecore_file_monitor_inotify_print(char *file, int mask); +#endif + +int +ecore_file_monitor_inotify_init(void) +{ + int fd; + + fd = inotify_init(); + if (fd < 0) + return 0; + + _fdh = ecore_main_fd_handler_add(fd, ECORE_FD_READ, _ecore_file_monitor_inotify_handler, + NULL, NULL, NULL); + if (!_fdh) + { + close(fd); + return 0; + } + + _inotify_fd_pid = getpid(); + return 1; +} + +int +ecore_file_monitor_inotify_shutdown(void) +{ + int fd; + + while(_monitors) + ecore_file_monitor_inotify_del(_monitors); + + if (_fdh) + { + fd = ecore_main_fd_handler_fd_get(_fdh); + ecore_main_fd_handler_del(_fdh); + close(fd); + } + _inotify_fd_pid = -1; + return 1; +} + +Ecore_File_Monitor * +ecore_file_monitor_inotify_add(const char *path, + void (*func) (void *data, Ecore_File_Monitor *em, + Ecore_File_Event event, + const char *path), + void *data) +{ + Ecore_File_Monitor *em; + int len; + + if (_inotify_fd_pid == -1) return NULL; + + if (_inotify_fd_pid != getpid()) + { + ecore_file_monitor_inotify_shutdown(); + ecore_file_monitor_inotify_init(); + } + + em = calloc(1, sizeof(Ecore_File_Monitor_Inotify)); + if (!em) return NULL; + + em->func = func; + em->data = data; + + em->path = strdup(path); + len = strlen(em->path); + if (em->path[len - 1] == '/' && strcmp(em->path, "/")) + em->path[len - 1] = 0; + + _monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em))); + + if (ecore_file_exists(em->path)) + { + if (!_ecore_file_monitor_inotify_monitor(em, em->path)) + return NULL; + } + else + { + ecore_file_monitor_inotify_del(em); + return NULL; + } + + return em; +} + +void +ecore_file_monitor_inotify_del(Ecore_File_Monitor *em) +{ + int fd; + + if (_monitors) + _monitors = ECORE_FILE_MONITOR(eina_inlist_remove(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em))); + + fd = ecore_main_fd_handler_fd_get(_fdh); + if (ECORE_FILE_MONITOR_INOTIFY(em)->wd) + inotify_rm_watch(fd, ECORE_FILE_MONITOR_INOTIFY(em)->wd); + free(em->path); + free(em); +} + +static Eina_Bool +_ecore_file_monitor_inotify_handler(void *data __UNUSED__, Ecore_Fd_Handler *fdh) +{ + Ecore_File_Monitor *em; + char buffer[16384]; + struct inotify_event *event; + int i = 0; + int event_size; + ssize_t size; + + size = read(ecore_main_fd_handler_fd_get(fdh), buffer, sizeof(buffer)); + while (i < size) + { + event = (struct inotify_event *)&buffer[i]; + event_size = sizeof(struct inotify_event) + event->len; + i += event_size; + + em = _ecore_file_monitor_inotify_monitor_find(event->wd); + if (!em) continue; + + _ecore_file_monitor_inotify_events(em, (event->len ? event->name : NULL), event->mask); + } + + return ECORE_CALLBACK_RENEW; +} + +static Ecore_File_Monitor * +_ecore_file_monitor_inotify_monitor_find(int wd) +{ + Ecore_File_Monitor *l; + + EINA_INLIST_FOREACH(_monitors, l) + { + if (ECORE_FILE_MONITOR_INOTIFY(l)->wd == wd) + return l; + } + return NULL; +} + +static void +_ecore_file_monitor_inotify_events(Ecore_File_Monitor *em, char *file, int mask) +{ + char buf[PATH_MAX]; + int isdir; + + if ((file) && (file[0])) + snprintf(buf, sizeof(buf), "%s/%s", em->path, file); + else + strcpy(buf, em->path); + isdir = mask & IN_ISDIR; + +#if 0 + _ecore_file_monitor_inotify_print(buf, mask); +#endif + + if (mask & IN_ATTRIB) + { + em->func(em->data, em, ECORE_FILE_EVENT_MODIFIED, buf); + } + if (mask & IN_CLOSE_WRITE) + { + if (!isdir) + em->func(em->data, em, ECORE_FILE_EVENT_CLOSED, buf); + } + if (mask & IN_MODIFY) + { + if (!isdir) + em->func(em->data, em, ECORE_FILE_EVENT_MODIFIED, buf); + } + if (mask & IN_MOVED_FROM) + { + if (isdir) + em->func(em->data, em, ECORE_FILE_EVENT_DELETED_DIRECTORY, buf); + else + em->func(em->data, em, ECORE_FILE_EVENT_DELETED_FILE, buf); + } + if (mask & IN_MOVED_TO) + { + if (isdir) + em->func(em->data, em, ECORE_FILE_EVENT_CREATED_DIRECTORY, buf); + else + em->func(em->data, em, ECORE_FILE_EVENT_CREATED_FILE, buf); + } + if (mask & IN_DELETE) + { + if (isdir) + em->func(em->data, em, ECORE_FILE_EVENT_DELETED_DIRECTORY, buf); + else + em->func(em->data, em, ECORE_FILE_EVENT_DELETED_FILE, buf); + } + if (mask & IN_CREATE) + { + if (isdir) + em->func(em->data, em, ECORE_FILE_EVENT_CREATED_DIRECTORY, buf); + else + em->func(em->data, em, ECORE_FILE_EVENT_CREATED_FILE, buf); + } + if (mask & IN_DELETE_SELF) + { + em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path); + } + if (mask & IN_MOVE_SELF) + { + /* We just call delete. The dir is gone... */ + em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path); + } + if (mask & IN_UNMOUNT) + { + /* We just call delete. The dir is gone... */ + em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path); + } + if (mask & IN_IGNORED) + { + /* The watch is removed. If the file name still exists monitor the new one, + * else delete it */ + if (ecore_file_exists(em->path)) + { + if (!_ecore_file_monitor_inotify_monitor(em, em->path)) + em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path); + } + else + em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path); + } +} + +static int +_ecore_file_monitor_inotify_monitor(Ecore_File_Monitor *em, const char *path) +{ + int mask = + IN_ATTRIB | + IN_CLOSE_WRITE | + IN_MOVED_FROM | + IN_MOVED_TO | + IN_DELETE | + IN_CREATE | + IN_MODIFY | + IN_DELETE_SELF | + IN_MOVE_SELF | + IN_UNMOUNT; + + ECORE_FILE_MONITOR_INOTIFY(em)->wd = + inotify_add_watch(ecore_main_fd_handler_fd_get(_fdh), path, mask); + if (ECORE_FILE_MONITOR_INOTIFY(em)->wd < 0) + { + ERR("inotify_add_watch error"); + ecore_file_monitor_inotify_del(em); + return 0; + } + return 1; +} + +#ifndef HAVE_SYS_INOTIFY +static inline int +inotify_init(void) +{ + return syscall(__NR_inotify_init); +} + +static inline int +inotify_add_watch(int fd, const char *name, __u32 mask) +{ + return syscall(__NR_inotify_add_watch, fd, name, mask); +} + +static inline int +inotify_rm_watch(int fd, __u32 wd) +{ + return syscall(__NR_inotify_rm_watch, fd, wd); +} +#endif + +#if 0 +static void +_ecore_file_monitor_inotify_print(char *file, int mask) +{ + const char *type; + + if (mask & IN_ISDIR) + type = "dir"; + else + type = "file"; + + if (mask & IN_ACCESS) + INF("Inotify accessed %s: %s", type, file); + if (mask & IN_MODIFY) + INF("Inotify modified %s: %s", type, file); + if (mask & IN_ATTRIB) + INF("Inotify attributes %s: %s", type, file); + if (mask & IN_CLOSE_WRITE) + INF("Inotify close write %s: %s", type, file); + if (mask & IN_CLOSE_NOWRITE) + INF("Inotify close write %s: %s", type, file); + if (mask & IN_OPEN) + INF("Inotify open %s: %s", type, file); + if (mask & IN_MOVED_FROM) + INF("Inotify moved from %s: %s", type, file); + if (mask & IN_MOVED_TO) + INF("Inotify moved to %s: %s", type, file); + if (mask & IN_DELETE) + INF("Inotify delete %s: %s", type, file); + if (mask & IN_CREATE) + INF("Inotify create %s: %s", type, file); + if (mask & IN_DELETE_SELF) + INF("Inotify delete self %s: %s", type, file); + if (mask & IN_MOVE_SELF) + INF("Inotify move self %s: %s", type, file); + if (mask & IN_UNMOUNT) + INF("Inotify unmount %s: %s", type, file); +} +#endif +#endif /* HAVE_INOTIFY */ diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_poll.c b/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_poll.c new file mode 100644 index 0000000..1f71b55 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_poll.c @@ -0,0 +1,339 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include "ecore_file_private.h" + +#ifdef HAVE_POLL + +/* + * TODO: + * - Implement recursive as an option! + * - Keep whole path or just name of file? (Memory or CPU...) + * - Remove requests without files? + * - Change poll time + */ + +typedef struct _Ecore_File_Monitor_Poll Ecore_File_Monitor_Poll; + +#define ECORE_FILE_MONITOR_POLL(x) ((Ecore_File_Monitor_Poll *)(x)) + +struct _Ecore_File_Monitor_Poll +{ + Ecore_File_Monitor monitor; + int mtime; + unsigned char deleted; +}; + +#define ECORE_FILE_INTERVAL_MIN 1.0 +#define ECORE_FILE_INTERVAL_STEP 0.5 +#define ECORE_FILE_INTERVAL_MAX 5.0 + +static double _interval = ECORE_FILE_INTERVAL_MIN; +static Ecore_Timer *_timer = NULL; +static Ecore_File_Monitor *_monitors = NULL; +static int _lock = 0; + +static Eina_Bool _ecore_file_monitor_poll_handler(void *data); +static void _ecore_file_monitor_poll_check(Ecore_File_Monitor *em); +static int _ecore_file_monitor_poll_checking(Ecore_File_Monitor *em, char *name); + +int +ecore_file_monitor_poll_init(void) +{ + return 1; +} + +int +ecore_file_monitor_poll_shutdown(void) +{ + while(_monitors) + ecore_file_monitor_poll_del(_monitors); + + if (_timer) + { + ecore_timer_del(_timer); + _timer = NULL; + } + return 1; +} + +Ecore_File_Monitor * +ecore_file_monitor_poll_add(const char *path, + void (*func) (void *data, Ecore_File_Monitor *em, + Ecore_File_Event event, + const char *path), + void *data) +{ + Ecore_File_Monitor *em; + size_t len; + + if (!path) return NULL; + if (!func) return NULL; + + em = calloc(1, sizeof(Ecore_File_Monitor_Poll)); + if (!em) return NULL; + + if (!_timer) + _timer = ecore_timer_add(_interval, _ecore_file_monitor_poll_handler, NULL); + else + ecore_timer_interval_set(_timer, ECORE_FILE_INTERVAL_MIN); + + em->path = strdup(path); + len = strlen(em->path); + if (em->path[len - 1] == '/' && strcmp(em->path, "/")) + em->path[len - 1] = 0; + + em->func = func; + em->data = data; + + ECORE_FILE_MONITOR_POLL(em)->mtime = ecore_file_mod_time(em->path); + _monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em))); + + if (ecore_file_exists(em->path)) + { + if (ecore_file_is_dir(em->path)) + { + /* Check for subdirs */ + Eina_List *files; + char *file; + + files = ecore_file_ls(em->path); + EINA_LIST_FREE(files, file) + { + Ecore_File *f; + char buf[PATH_MAX]; + + f = calloc(1, sizeof(Ecore_File)); + if (!f) + { + free(file); + continue; + } + + snprintf(buf, sizeof(buf), "%s/%s", em->path, file); + f->name = file; + f->mtime = ecore_file_mod_time(buf); + f->is_dir = ecore_file_is_dir(buf); + em->files = (Ecore_File *) eina_inlist_append(EINA_INLIST_GET(em->files), EINA_INLIST_GET(f)); + } + } + } + else + { + ecore_file_monitor_poll_del(em); + return NULL; + } + + return em; +} + +void +ecore_file_monitor_poll_del(Ecore_File_Monitor *em) +{ + Ecore_File *l; + + if (_lock) + { + ECORE_FILE_MONITOR_POLL(em)->deleted = 1; + return; + } + + /* Remove files */ + /*It's possible there weren't any files to monitor, so check if the list is init*/ + if (em->files) + { + for (l = em->files; l;) + { + Ecore_File *file = l; + + l = (Ecore_File *) EINA_INLIST_GET(l)->next; + free(file->name); + free(file); + } + } + + if (_monitors) + _monitors = ECORE_FILE_MONITOR(eina_inlist_remove(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em))); + + free(em->path); + free(em); + + if (_timer) + { + if (!_monitors) + { + ecore_timer_del(_timer); + _timer = NULL; + } + else + ecore_timer_interval_set(_timer, ECORE_FILE_INTERVAL_MIN); + } +} + +static Eina_Bool +_ecore_file_monitor_poll_handler(void *data __UNUSED__) +{ + Ecore_File_Monitor *l; + + _interval += ECORE_FILE_INTERVAL_STEP; + + _lock = 1; + EINA_INLIST_FOREACH(_monitors, l) + _ecore_file_monitor_poll_check(l); + _lock = 0; + + if (_interval > ECORE_FILE_INTERVAL_MAX) + _interval = ECORE_FILE_INTERVAL_MAX; + ecore_timer_interval_set(_timer, _interval); + + for (l = _monitors; l;) + { + Ecore_File_Monitor *em = l; + + l = ECORE_FILE_MONITOR(EINA_INLIST_GET(l)->next); + if (ECORE_FILE_MONITOR_POLL(em)->deleted) + ecore_file_monitor_del(em); + } + return ECORE_CALLBACK_RENEW; +} + +static void +_ecore_file_monitor_poll_check(Ecore_File_Monitor *em) +{ + int mtime; + + mtime = ecore_file_mod_time(em->path); + if (mtime < ECORE_FILE_MONITOR_POLL(em)->mtime) + { + Ecore_File *l; + Ecore_File_Event event; + + /* Notify all files deleted */ + for (l = em->files; l;) + { + Ecore_File *f = l; + char buf[PATH_MAX]; + + l = (Ecore_File *) EINA_INLIST_GET(l)->next; + + snprintf(buf, sizeof(buf), "%s/%s", em->path, f->name); + if (f->is_dir) + event = ECORE_FILE_EVENT_DELETED_DIRECTORY; + else + event = ECORE_FILE_EVENT_DELETED_FILE; + em->func(em->data, em, event, buf); + free(f->name); + free(f); + } + em->files = NULL; + em->func(em->data, em, ECORE_FILE_EVENT_DELETED_SELF, em->path); + _interval = ECORE_FILE_INTERVAL_MIN; + } + else + { + Ecore_File *l; + + /* Check for changed files */ + for (l = em->files; l;) + { + Ecore_File *f = l; + char buf[PATH_MAX]; + int mt; + Ecore_File_Event event; + + l = (Ecore_File *) EINA_INLIST_GET(l)->next; + + snprintf(buf, sizeof(buf), "%s/%s", em->path, f->name); + mt = ecore_file_mod_time(buf); + if (mt < f->mtime) + { + if (f->is_dir) + event = ECORE_FILE_EVENT_DELETED_DIRECTORY; + else + event = ECORE_FILE_EVENT_DELETED_FILE; + + em->func(em->data, em, event, buf); + em->files = (Ecore_File *) eina_inlist_remove(EINA_INLIST_GET(em->files), EINA_INLIST_GET(f)); + free(f->name); + free(f); + _interval = ECORE_FILE_INTERVAL_MIN; + } + else if ((mt > f->mtime) && !(f->is_dir)) + { + em->func(em->data, em, ECORE_FILE_EVENT_MODIFIED, buf); + _interval = ECORE_FILE_INTERVAL_MIN; + f->mtime = mt; + } + else + f->mtime = mt; + } + + /* Check for new files */ + if (ECORE_FILE_MONITOR_POLL(em)->mtime < mtime) + { + Eina_List *files; + Eina_List *fl; + char *file; + + /* Files have been added or removed */ + files = ecore_file_ls(em->path); + if (files) + { + /* Are we a directory? We should check first, rather than rely on null here*/ + EINA_LIST_FOREACH(files, fl, file) + { + Ecore_File *f; + char buf[PATH_MAX]; + Ecore_File_Event event; + + if (_ecore_file_monitor_poll_checking(em, file)) + continue; + + snprintf(buf, sizeof(buf), "%s/%s", em->path, file); + f = calloc(1, sizeof(Ecore_File)); + if (!f) + continue; + + f->name = strdup(file); + f->mtime = ecore_file_mod_time(buf); + f->is_dir = ecore_file_is_dir(buf); + if (f->is_dir) + event = ECORE_FILE_EVENT_CREATED_DIRECTORY; + else + event = ECORE_FILE_EVENT_CREATED_FILE; + em->func(em->data, em, event, buf); + em->files = (Ecore_File *) eina_inlist_append(EINA_INLIST_GET(em->files), EINA_INLIST_GET(f)); + } + while (files) + { + file = eina_list_data_get(files); + free(file); + files = eina_list_remove_list(files, files); + } + } + + if (!ecore_file_is_dir(em->path)) + em->func(em->data, em, ECORE_FILE_EVENT_MODIFIED, em->path); + _interval = ECORE_FILE_INTERVAL_MIN; + } + } + ECORE_FILE_MONITOR_POLL(em)->mtime = mtime; +} + +static int +_ecore_file_monitor_poll_checking(Ecore_File_Monitor *em, char *name) +{ + Ecore_File *l; + + EINA_INLIST_FOREACH(em->files, l) + { + if (!strcmp(l->name, name)) + return 1; + } + return 0; +} +#endif diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_win32.c b/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_win32.c new file mode 100644 index 0000000..7f3af09 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_file/ecore_file_monitor_win32.c @@ -0,0 +1,310 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#ifdef HAVE_NOTIFY_WIN32 + +# define WIN32_LEAN_AND_MEAN +# include +# undef WIN32_LEAN_AND_MEAN +# include + +# include "ecore_file_private.h" + + +typedef struct _Ecore_File_Monitor_Win32 Ecore_File_Monitor_Win32; +typedef struct _Ecore_File_Monitor_Win32_Data Ecore_File_Monitor_Win32_Data; + +/* 4096 = 256 * sizeof(FILE_NOTIFY_INFORMATION) */ +# define ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE 4096 +# define ECORE_FILE_MONITOR_WIN32(x) ((Ecore_File_Monitor_Win32 *)(x)) + +struct _Ecore_File_Monitor_Win32_Data +{ + char buffer[ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE]; + OVERLAPPED overlapped; + HANDLE handle; + HANDLE event; + Ecore_File_Monitor *monitor; + Ecore_Win32_Handler *h; + DWORD buf_length; + int is_dir; +}; + +struct _Ecore_File_Monitor_Win32 +{ + Ecore_File_Monitor monitor; + Ecore_File_Monitor_Win32_Data *file; + Ecore_File_Monitor_Win32_Data *dir; +}; + +static Ecore_File_Monitor *_monitors = NULL; + +static Eina_Bool _ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh); + + +static Ecore_File_Monitor_Win32_Data * +_ecore_file_monitor_win32_data_new(Ecore_File_Monitor *monitor, int type) +{ + Ecore_File_Monitor_Win32_Data *md; + DWORD filter; + + md = (Ecore_File_Monitor_Win32_Data *)calloc(1, sizeof(Ecore_File_Monitor_Win32_Data)); + if (!md) return NULL; + + md->handle = CreateFile(monitor->path, + FILE_LIST_DIRECTORY, + FILE_SHARE_READ | + FILE_SHARE_WRITE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | + FILE_FLAG_OVERLAPPED, + NULL); + if (md->handle == INVALID_HANDLE_VALUE) + goto free_md; + + md->event = CreateEvent(NULL, FALSE, FALSE, NULL); + if (!md->event) + goto close_handle; + + ZeroMemory (&md->overlapped, sizeof(md->overlapped)); + md->overlapped.hEvent = md->event; + + filter = (type == 0) ? FILE_NOTIFY_CHANGE_FILE_NAME : FILE_NOTIFY_CHANGE_DIR_NAME; + filter |= + FILE_NOTIFY_CHANGE_ATTRIBUTES | + FILE_NOTIFY_CHANGE_SIZE | + FILE_NOTIFY_CHANGE_LAST_WRITE | + FILE_NOTIFY_CHANGE_LAST_ACCESS | + FILE_NOTIFY_CHANGE_CREATION | + FILE_NOTIFY_CHANGE_SECURITY; + + if (!ReadDirectoryChangesW(md->handle, + md->buffer, + ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE, + FALSE, + filter, + &md->buf_length, + &md->overlapped, + NULL)) + goto close_event; + + md->h = ecore_main_win32_handler_add(md->event, + _ecore_file_monitor_win32_cb, + md); + if (!md->h) + goto close_event; + + md->monitor = monitor; + md->is_dir = type; + + return md; + + close_event: + CloseHandle(md->event); + close_handle: + CloseHandle(md->handle); + free_md: + free(md); + + return NULL; +} + +static void +_ecore_file_monitor_win32_data_free(Ecore_File_Monitor_Win32_Data *md) +{ + if (!md) return; + + CloseHandle(md->event); + CloseHandle (md->handle); + free (md); +} + +static Eina_Bool +_ecore_file_monitor_win32_cb(void *data, Ecore_Win32_Handler *wh) +{ + char filename[PATH_MAX]; + PFILE_NOTIFY_INFORMATION fni; + Ecore_File_Monitor_Win32_Data *md; + wchar_t *wname; + char *name; + DWORD filter; + DWORD offset; + DWORD buf_length; + Ecore_File_Event event = ECORE_FILE_EVENT_NONE; + + md = (Ecore_File_Monitor_Win32_Data *)data; + + if (!GetOverlappedResult (md->handle, &md->overlapped, &buf_length, TRUE)) + return 1; + + fni = (PFILE_NOTIFY_INFORMATION)md->buffer; + do { + if (!fni) + break; + offset = fni->NextEntryOffset; + + wname = (wchar_t *)malloc(sizeof(wchar_t) * (fni->FileNameLength + 1)); + if (!wname) + return 0; + + memcpy(wname, fni->FileName, fni->FileNameLength); + wname[fni->FileNameLength]='\0'; + name = evil_wchar_to_char(wname); + free(wname); + if (!name) + return 0; + + _snprintf(filename, PATH_MAX, "%s\\%s", md->monitor->path, name); + free(name); + + switch (fni->Action) + { + case FILE_ACTION_ADDED: + if (md->is_dir) + event = ECORE_FILE_EVENT_CREATED_DIRECTORY; + else + event = ECORE_FILE_EVENT_CREATED_FILE; + break; + case FILE_ACTION_REMOVED: + if (md->is_dir) + event = ECORE_FILE_EVENT_DELETED_DIRECTORY; + else + event = ECORE_FILE_EVENT_DELETED_FILE; + break; + case FILE_ACTION_MODIFIED: + if (!md->is_dir) + event = ECORE_FILE_EVENT_MODIFIED; + break; + case FILE_ACTION_RENAMED_OLD_NAME: + if (md->is_dir) + event = ECORE_FILE_EVENT_DELETED_DIRECTORY; + else + event = ECORE_FILE_EVENT_DELETED_FILE; + break; + case FILE_ACTION_RENAMED_NEW_NAME: + if (md->is_dir) + event = ECORE_FILE_EVENT_CREATED_DIRECTORY; + else + event = ECORE_FILE_EVENT_CREATED_FILE; + break; + default: + fprintf(stderr, "unknown event\n"); + event = ECORE_FILE_EVENT_NONE; + break; + } + if (event != ECORE_FILE_EVENT_NONE) + md->monitor->func(md->monitor->data, md->monitor, event, filename); + + fni = (PFILE_NOTIFY_INFORMATION)((LPBYTE)fni + offset); + } while (offset); + + filter = (md->is_dir == 0) ? FILE_NOTIFY_CHANGE_FILE_NAME : FILE_NOTIFY_CHANGE_DIR_NAME; + filter |= + FILE_NOTIFY_CHANGE_ATTRIBUTES | + FILE_NOTIFY_CHANGE_SIZE | + FILE_NOTIFY_CHANGE_LAST_WRITE | + FILE_NOTIFY_CHANGE_LAST_ACCESS | + FILE_NOTIFY_CHANGE_CREATION | + FILE_NOTIFY_CHANGE_SECURITY; + + ReadDirectoryChangesW(md->handle, + md->buffer, + ECORE_FILE_MONITOR_WIN32_BUFFER_SIZE, + FALSE, + filter, + &md->buf_length, + &md->overlapped, + NULL); + return 1; +} + +int +ecore_file_monitor_win32_init(void) +{ + return 1; +} + +int +ecore_file_monitor_win32_shutdown(void) +{ + return 1; +} + +Ecore_File_Monitor * +ecore_file_monitor_win32_add(const char *path, + void (*func) (void *data, Ecore_File_Monitor *em, + Ecore_File_Event event, + const char *path), + void *data) +{ + Ecore_File_Monitor_Win32 *m; + Ecore_File_Monitor *em; + size_t len; + + if (!path || (*path == '\0')) return NULL; + if (!ecore_file_exists(path) || !ecore_file_is_dir(path)) + return NULL; + if (!func) return NULL; + + em = (Ecore_File_Monitor *)calloc(1, sizeof(Ecore_File_Monitor_Win32)); + if (!em) return NULL; + + em->func = func; + em->data = data; + + em->path = strdup(path); + if (!em->path) + { + free(em); + return NULL; + } + len = strlen(em->path); + if (em->path[len - 1] == '/' || em->path[len - 1] == '\\') + em->path[len - 1] = '\0'; + + m = ECORE_FILE_MONITOR_WIN32(em); + + m->file = _ecore_file_monitor_win32_data_new(em, 0); + if (!m->file) + { + free(em->path); + free(em); + return NULL; + } + + m->dir = _ecore_file_monitor_win32_data_new(em, 1); + if (!m->dir) + { + _ecore_file_monitor_win32_data_free(m->file); + free(em->path); + free(em); + return NULL; + } + + _monitors = ECORE_FILE_MONITOR(eina_inlist_append(EINA_INLIST_GET(_monitors), EINA_INLIST_GET(em))); + + return em; +} + +void +ecore_file_monitor_win32_del(Ecore_File_Monitor *em) +{ + Ecore_File_Monitor_Win32 *m; + + if (!em) + return; + + m = ECORE_FILE_MONITOR_WIN32(em); + _ecore_file_monitor_win32_data_free(m->dir); + _ecore_file_monitor_win32_data_free(m->file); + free(em->path); + free(em); +} + +#endif diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file_path.c b/libraries/ecore/src/lib/ecore_file/ecore_file_path.c new file mode 100644 index 0000000..ade3bc6 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_file/ecore_file_path.c @@ -0,0 +1,184 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#undef alloca +#ifdef HAVE_ALLOCA_H +# include +#elif defined __GNUC__ +# define alloca __builtin_alloca +#elif defined _AIX +# define alloca __alloca +#elif defined _MSC_VER +# include +# define alloca _alloca +#else +# include +# ifdef __cplusplus +extern "C" +# endif +void *alloca (size_t); +#endif + +#include +#include + +#include "ecore_file_private.h" + +static Eina_List *__ecore_file_path_bin = NULL; + +static Eina_List *_ecore_file_path_from_env(const char *env); + +void +ecore_file_path_init(void) +{ + __ecore_file_path_bin = _ecore_file_path_from_env("PATH"); +} + +void +ecore_file_path_shutdown(void) +{ + char *dir; + + EINA_LIST_FREE(__ecore_file_path_bin, dir) + eina_stringshare_del(dir); +} + +Eina_List * +_ecore_file_path_from_env(const char *env) +{ + Eina_List *path = NULL; + char *env_tmp, *env_path, *p, *last; + + env_tmp = getenv(env); + if (!env_tmp) + return path; + + env_path = alloca(sizeof(char) * strlen(env_tmp) + 1); + memset(env_path, 0, strlen(env_tmp)); + strcpy(env_path, env_tmp); + last = env_path; + for (p = env_path; *p; p++) + { + if (*p == ':') + *p = '\0'; + + if (!*p) + { + if (!ecore_file_path_dir_exists(last)) + path = eina_list_append(path, eina_stringshare_add(last)); + last = p + 1; + } + } + if (p > last) + path = eina_list_append(path, eina_stringshare_add(last)); + + return path; +} + +/** + * @addtogroup Ecore_File_Group Ecore_File - Files and directories convenience functions + * + * @{ + */ + +/** + * @brief Check if the given directory is in PATH. + * + * @param The name of the directory to search in PATH. + * @return EINA_TRUE if the directory exist in PATH, EINA_FALSE otherwise. + * + * This function checks if @p in_dir is in the environment variable + * PATH. If @p in_dir is @c NULL, or if PATH is empty, or @p in_dir is + * not in PATH, the function returns EINA_FALSE, otherwise it returns + * EINA_TRUE. + */ +EAPI Eina_Bool +ecore_file_path_dir_exists(const char *in_dir) +{ + Eina_List *l; + char *dir; + + if (!in_dir) + return EINA_FALSE; + + if (!__ecore_file_path_bin) return EINA_FALSE; + EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir) + { + if (strcmp(dir, in_dir)) + return EINA_TRUE; + } + + return EINA_FALSE; +} + +/** + * @brief Check if the given application is installed. + * + * @param exe The name of the application + * @return EINA_TRUE if the exe is in PATH and is executable, + * EINA_FALSE otherwise. + * + * + * This function checks if @p exe exists in PATH and is executable. If + * @p exe is @c NULL or is not executable, the function returns + * EINA_FALSE, otherwise it returns EINA_TRUE. + */ +EAPI Eina_Bool +ecore_file_app_installed(const char *exe) +{ + Eina_List *l; + char *dir; + char buf[PATH_MAX]; + + if (!exe) return EINA_FALSE; + if (ecore_file_can_exec(exe)) return EINA_TRUE; + + EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir) + { + snprintf(buf, sizeof(buf), "%s/%s", dir, exe); + if (ecore_file_can_exec(buf)) + return EINA_TRUE; + } + + return EINA_FALSE; +} + +/** + * @brief Get a list of all the applications installed on the system. + * + * @return An Eina_List containing all the executable files in the + * system. + * + * This function returns a list of allocated strings of all the + * executable files. If no files are found, the function returns + * @c NULL. When not needed anymore, the element of the list must be + * freed. + */ +EAPI Eina_List * +ecore_file_app_list(void) +{ + Eina_List *list = NULL; + Eina_List *files; + Eina_List *l; + char buf[PATH_MAX], *dir, *exe; + + EINA_LIST_FOREACH(__ecore_file_path_bin, l, dir) + { + files = ecore_file_ls(dir); + EINA_LIST_FREE(files, exe) + { + snprintf(buf, sizeof(buf), "%s/%s", dir, exe); + if ((ecore_file_can_exec(buf)) && + (!ecore_file_is_dir(buf))) + list = eina_list_append(list, strdup(buf)); + free(exe); + } + } + + return list; +} + +/** + * @} + */ diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file_private.h b/libraries/ecore/src/lib/ecore_file/ecore_file_private.h new file mode 100644 index 0000000..45d2cbd --- /dev/null +++ b/libraries/ecore/src/lib/ecore_file/ecore_file_private.h @@ -0,0 +1,129 @@ +#ifndef ECORE_FILE_PRIVATE_H_ +#define ECORE_FILE_PRIVATE_H_ + +#ifdef __linux__ +# include +#endif + +#ifdef HAVE_EVIL +# include +#endif + +#ifdef HAVE_ESCAPE +# include +#endif + +#include +#include + +#include "Ecore.h" +#include "ecore_private.h" + +#include "Ecore_File.h" + +extern int _ecore_file_log_dom; + +#ifdef ECORE_FILE_DEFAULT_LOG_COLOR +#undef ECORE_FILE_DEFAULT_LOG_COLOR +#endif +#define ECORE_FILE_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_ecore_file_log_dom, __VA_ARGS__) + +#ifdef DBG +# undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_ecore_file_log_dom, __VA_ARGS__) + +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_ecore_file_log_dom, __VA_ARGS__) + +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_ecore_file_log_dom, __VA_ARGS__) + +#ifdef CRIT +# undef CRIT +#endif +#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_file_log_dom, __VA_ARGS__) + +/* ecore_file_monitor */ +int ecore_file_monitor_init(void); +void ecore_file_monitor_shutdown(void); + +#define ECORE_FILE_MONITOR(x) ((Ecore_File_Monitor *)(x)) + +typedef struct _Ecore_File Ecore_File; +struct _Ecore_File +{ + EINA_INLIST; + char *name; + int mtime; + unsigned char is_dir; +}; + +struct _Ecore_File_Monitor +{ + EINA_INLIST; + void (*func) (void *data, + Ecore_File_Monitor *ecore_file_monitor, + Ecore_File_Event event, + const char *path); + + char *path; + void *data; + Ecore_File *files; +}; + +#ifdef HAVE_INOTIFY +int ecore_file_monitor_inotify_init(void); +int ecore_file_monitor_inotify_shutdown(void); +Ecore_File_Monitor *ecore_file_monitor_inotify_add(const char *path, + void (*func) (void *data, + Ecore_File_Monitor *ecore_file_monitor, + Ecore_File_Event event, + const char *path), + void *data); +void ecore_file_monitor_inotify_del(Ecore_File_Monitor *ecore_file_monitor); +#endif + +#ifdef HAVE_NOTIFY_WIN32 +int ecore_file_monitor_win32_init(void); +int ecore_file_monitor_win32_shutdown(void); +Ecore_File_Monitor *ecore_file_monitor_win32_add(const char *path, + void (*func) (void *data, + Ecore_File_Monitor *ecore_file_monitor, + Ecore_File_Event event, + const char *path), + void *data); +void ecore_file_monitor_win32_del(Ecore_File_Monitor *ecore_file_monitor); +#endif + +#ifdef HAVE_POLL +int ecore_file_monitor_poll_init(void); +int ecore_file_monitor_poll_shutdown(void); +Ecore_File_Monitor *ecore_file_monitor_poll_add(const char *path, + void (*func) (void *data, + Ecore_File_Monitor *ecore_file_monitor, + Ecore_File_Event event, + const char *path), + void *data); +void ecore_file_monitor_poll_del(Ecore_File_Monitor *ecore_file_monitor); + +#endif + +/* ecore_file_path */ +void ecore_file_path_init(void); +void ecore_file_path_shutdown(void); + +/* ecore_file_download */ +int ecore_file_download_init(void); +void ecore_file_download_shutdown(void); + +#endif diff --git a/libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h b/libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h new file mode 100644 index 0000000..21df2a0 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_imf/Ecore_IMF.h @@ -0,0 +1,418 @@ +#ifndef _ECORE_IMF_H +#define _ECORE_IMF_H + +#include + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_ECORE_IMF_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_ECORE_IMF_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif /* ! _WIN32 */ + +#ifdef __cplusplus +extern "C" { +#endif + +/* Events sent by the Input Method */ +typedef struct _Ecore_IMF_Event_Preedit_Start Ecore_IMF_Event_Preedit_Start; +typedef struct _Ecore_IMF_Event_Preedit_End Ecore_IMF_Event_Preedit_End; +typedef struct _Ecore_IMF_Event_Preedit_Changed Ecore_IMF_Event_Preedit_Changed; +typedef struct _Ecore_IMF_Event_Commit Ecore_IMF_Event_Commit; +typedef struct _Ecore_IMF_Event_Delete_Surrounding Ecore_IMF_Event_Delete_Surrounding; + +/* Events to filter */ +typedef struct _Ecore_IMF_Event_Mouse_Down Ecore_IMF_Event_Mouse_Down; +typedef struct _Ecore_IMF_Event_Mouse_Up Ecore_IMF_Event_Mouse_Up; +typedef struct _Ecore_IMF_Event_Mouse_In Ecore_IMF_Event_Mouse_In; +typedef struct _Ecore_IMF_Event_Mouse_Out Ecore_IMF_Event_Mouse_Out; +typedef struct _Ecore_IMF_Event_Mouse_Move Ecore_IMF_Event_Mouse_Move; +typedef struct _Ecore_IMF_Event_Mouse_Wheel Ecore_IMF_Event_Mouse_Wheel; +typedef struct _Ecore_IMF_Event_Key_Down Ecore_IMF_Event_Key_Down; +typedef struct _Ecore_IMF_Event_Key_Up Ecore_IMF_Event_Key_Up; +typedef union _Ecore_IMF_Event Ecore_IMF_Event; + +typedef struct _Ecore_IMF_Context Ecore_IMF_Context; /**< An Input Method Context */ +typedef struct _Ecore_IMF_Context_Class Ecore_IMF_Context_Class; /**< An Input Method Context class */ +typedef struct _Ecore_IMF_Context_Info Ecore_IMF_Context_Info; /**< An Input Method Context info */ + +/* Preedit attribute info */ +typedef struct _Ecore_IMF_Preedit_Attr Ecore_IMF_Preedit_Attr; + +EAPI extern int ECORE_IMF_EVENT_PREEDIT_START; +EAPI extern int ECORE_IMF_EVENT_PREEDIT_END; +EAPI extern int ECORE_IMF_EVENT_PREEDIT_CHANGED; +EAPI extern int ECORE_IMF_EVENT_COMMIT; +EAPI extern int ECORE_IMF_EVENT_DELETE_SURROUNDING; + +typedef enum +{ + ECORE_IMF_EVENT_MOUSE_DOWN, + ECORE_IMF_EVENT_MOUSE_UP, + ECORE_IMF_EVENT_MOUSE_IN, + ECORE_IMF_EVENT_MOUSE_OUT, + ECORE_IMF_EVENT_MOUSE_MOVE, + ECORE_IMF_EVENT_MOUSE_WHEEL, + ECORE_IMF_EVENT_KEY_DOWN, + ECORE_IMF_EVENT_KEY_UP +} Ecore_IMF_Event_Type; + +typedef enum +{ + ECORE_IMF_KEYBOARD_MODIFIER_NONE = 0, /**< No active modifiers */ + ECORE_IMF_KEYBOARD_MODIFIER_CTRL = 1 << 0, /**< "Control" is pressed */ + ECORE_IMF_KEYBOARD_MODIFIER_ALT = 1 << 1, /**< "Alt" is pressed */ + ECORE_IMF_KEYBOARD_MODIFIER_SHIFT = 1 << 2, /**< "Shift" is pressed */ + ECORE_IMF_KEYBOARD_MODIFIER_WIN = 1 << 3 /**< "Win" (between "Ctrl" and "Alt") is pressed */ +} Ecore_IMF_Keyboard_Modifiers; + +typedef enum +{ + ECORE_IMF_KEYBOARD_LOCK_NONE = 0, /**< No locks are active */ + ECORE_IMF_KEYBOARD_LOCK_NUM = 1 << 0, /**< "Num" lock is active */ + ECORE_IMF_KEYBOARD_LOCK_CAPS = 1 << 1, /**< "Caps" lock is active */ + ECORE_IMF_KEYBOARD_LOCK_SCROLL = 1 << 2 /**< "Scroll" lock is active */ +} Ecore_IMF_Keyboard_Locks; + +typedef enum +{ + ECORE_IMF_MOUSE_NONE = 0, /**< A single click */ + ECORE_IMF_MOUSE_DOUBLE_CLICK = 1 << 0, /**< A double click */ + ECORE_IMF_MOUSE_TRIPLE_CLICK = 1 << 1 /**< A triple click */ +} Ecore_IMF_Mouse_Flags; + +typedef enum +{ + ECORE_IMF_INPUT_MODE_ALPHA = 1 << 0, + ECORE_IMF_INPUT_MODE_NUMERIC = 1 << 1, + ECORE_IMF_INPUT_MODE_SPECIAL = 1 << 2, + ECORE_IMF_INPUT_MODE_HEXA = 1 << 3, + ECORE_IMF_INPUT_MODE_TELE = 1 << 4, + ECORE_IMF_INPUT_MODE_FULL = (ECORE_IMF_INPUT_MODE_ALPHA | ECORE_IMF_INPUT_MODE_NUMERIC | ECORE_IMF_INPUT_MODE_SPECIAL), + ECORE_IMF_INPUT_MODE_INVISIBLE = 1 << 29, + ECORE_IMF_INPUT_MODE_AUTOCAP = 1 << 30 +} Ecore_IMF_Input_Mode; + +typedef enum +{ + ECORE_IMF_PREEDIT_TYPE_NONE, + ECORE_IMF_PREEDIT_TYPE_SUB1, + ECORE_IMF_PREEDIT_TYPE_SUB2, + ECORE_IMF_PREEDIT_TYPE_SUB3 +} Ecore_IMF_Preedit_Type; + +typedef enum +{ + ECORE_IMF_AUTOCAPITAL_TYPE_NONE, + ECORE_IMF_AUTOCAPITAL_TYPE_WORD, + ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE, + ECORE_IMF_AUTOCAPITAL_TYPE_ALLCHARACTER +} Ecore_IMF_Autocapital_Type; + +typedef enum +{ + ECORE_IMF_INPUT_PANEL_LAYOUT_NORMAL, /**< Default layout */ + ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBER, /**< Number layout */ + ECORE_IMF_INPUT_PANEL_LAYOUT_EMAIL, /**< Email layout */ + ECORE_IMF_INPUT_PANEL_LAYOUT_URL, /**< URL layout */ + ECORE_IMF_INPUT_PANEL_LAYOUT_PHONENUMBER, /**< Phone Number layout */ + ECORE_IMF_INPUT_PANEL_LAYOUT_IP, /**< IP layout */ + ECORE_IMF_INPUT_PANEL_LAYOUT_MONTH, /**< Month layout */ + ECORE_IMF_INPUT_PANEL_LAYOUT_NUMBERONLY, /**< Number Only layout */ + ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID +} Ecore_IMF_Input_Panel_Layout; + +typedef enum +{ + ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC, /**< Automatic */ + ECORE_IMF_INPUT_PANEL_LANG_ALPHABET /**< Alphabet */ +} Ecore_IMF_Input_Panel_Lang; + +struct _Ecore_IMF_Event_Preedit_Start +{ + Ecore_IMF_Context *ctx; +}; + +struct _Ecore_IMF_Event_Preedit_End +{ + Ecore_IMF_Context *ctx; +}; + +struct _Ecore_IMF_Event_Preedit_Changed +{ + Ecore_IMF_Context *ctx; +}; + +struct _Ecore_IMF_Event_Commit +{ + Ecore_IMF_Context *ctx; + char *str; +}; + +struct _Ecore_IMF_Event_Delete_Surrounding +{ + Ecore_IMF_Context *ctx; + int offset; + int n_chars; +}; + +struct _Ecore_IMF_Event_Mouse_Down +{ + int button; /**< The button which has been pressed */ + struct { + int x, y; + } output; + struct { + int x, y; + } canvas; + Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */ + Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */ + Ecore_IMF_Mouse_Flags flags; /**< The flags corresponding the mouse click (single, double or triple click) */ + unsigned int timestamp; /**< The timestamp when the event occurred */ +}; + +struct _Ecore_IMF_Event_Mouse_Up +{ + int button; /**< The button which has been pressed */ + struct { + int x, y; + } output; + struct { + int x, y; + } canvas; + Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */ + Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */ + Ecore_IMF_Mouse_Flags flags; /**< The flags corresponding the mouse click (single, double or triple click) */ + unsigned int timestamp; /**< The timestamp when the event occurred */ +}; + +struct _Ecore_IMF_Event_Mouse_In +{ + int buttons; + struct { + int x, y; + } output; + struct { + int x, y; + } canvas; + Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */ + Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */ + unsigned int timestamp; /**< The timestamp when the event occurred */ +}; + +struct _Ecore_IMF_Event_Mouse_Out +{ + int buttons; + struct { + int x, y; + } output; + struct { + int x, y; + } canvas; + Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */ + Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */ + unsigned int timestamp; /**< The timestamp when the event occurred */ +}; + +struct _Ecore_IMF_Event_Mouse_Move +{ + int buttons; + struct { + struct { + int x, y; + } output; + struct { + int x, y; + } canvas; + } cur, prev; + Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */ + Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */ + unsigned int timestamp; /**< The timestamp when the event occurred */ +}; + +struct _Ecore_IMF_Event_Mouse_Wheel +{ + int direction; /* 0 = default up/down wheel */ + int z; /* ...,-2,-1 = down, 1,2,... = up */ + struct { + int x, y; + } output; + struct { + int x, y; + } canvas; + Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */ + Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */ + unsigned int timestamp; /**< The timestamp when the event occurred */ +}; + +struct _Ecore_IMF_Event_Key_Down +{ + const char *keyname; /**< The string name of the key pressed */ + Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */ + Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */ + const char *key; /**< The logical key : (eg shift+1 == exclamation) */ + const char *string; /**< A UTF8 string if this keystroke has produced a visible string to be ADDED */ + const char *compose; /**< A UTF8 string if this keystroke has modified a string in the middle of being composed - this string replaces the previous one */ + unsigned int timestamp; /**< The timestamp when the event occurred */ +}; + +struct _Ecore_IMF_Event_Key_Up +{ + const char *keyname; /**< The string name of the key pressed */ + Ecore_IMF_Keyboard_Modifiers modifiers; /**< The keyboard modifiers active when the event has been emitted */ + Ecore_IMF_Keyboard_Locks locks; /**< The keyboard locks active when the event has been emitted */ + const char *key; /**< The logical key : (eg shift+1 == exclamation) */ + const char *string; /**< A UTF8 string if this keystroke has produced a visible string to be ADDED */ + const char *compose; /**< A UTF8 string if this keystroke has modified a string in the middle of being composed - this string replaces the previous one */ + unsigned int timestamp; /**< The timestamp when the event occurred */ +}; + +union _Ecore_IMF_Event +{ + Ecore_IMF_Event_Mouse_Down mouse_down; + Ecore_IMF_Event_Mouse_Up mouse_up; + Ecore_IMF_Event_Mouse_In mouse_in; + Ecore_IMF_Event_Mouse_Out mouse_out; + Ecore_IMF_Event_Mouse_Move mouse_move; + Ecore_IMF_Event_Mouse_Wheel mouse_wheel; + Ecore_IMF_Event_Key_Down key_down; + Ecore_IMF_Event_Key_Up key_up; +}; + +struct _Ecore_IMF_Preedit_Attr +{ + Ecore_IMF_Preedit_Type preedit_type; + unsigned int start_index; + unsigned int end_index; +}; + +struct _Ecore_IMF_Context_Class +{ + void (*add) (Ecore_IMF_Context *ctx); + void (*del) (Ecore_IMF_Context *ctx); + void (*client_window_set) (Ecore_IMF_Context *ctx, void *window); + void (*client_canvas_set) (Ecore_IMF_Context *ctx, void *canvas); + void (*show) (Ecore_IMF_Context *ctx); + void (*hide) (Ecore_IMF_Context *ctx); + void (*preedit_string_get) (Ecore_IMF_Context *ctx, char **str, int *cursor_pos); + void (*focus_in) (Ecore_IMF_Context *ctx); + void (*focus_out) (Ecore_IMF_Context *ctx); + void (*reset) (Ecore_IMF_Context *ctx); + void (*cursor_position_set) (Ecore_IMF_Context *ctx, int cursor_pos); + void (*use_preedit_set) (Ecore_IMF_Context *ctx, Eina_Bool use_preedit); + void (*input_mode_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode); + Eina_Bool (*filter_event) (Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event); + void (*preedit_string_with_attributes_get) (Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos); + void (*prediction_allow_set)(Ecore_IMF_Context *ctx, Eina_Bool prediction); + void (*autocapital_type_set)(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type); + void (*control_panel_show) (Ecore_IMF_Context *ctx); + void (*control_panel_hide) (Ecore_IMF_Context *ctx); + void (*input_panel_layout_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout); + Ecore_IMF_Input_Panel_Layout (*input_panel_layout_get) (Ecore_IMF_Context *ctx); + void (*input_panel_language_set) (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang); + Ecore_IMF_Input_Panel_Lang (*input_panel_language_get) (Ecore_IMF_Context *ctx); + void (*cursor_location_set) (Ecore_IMF_Context *ctx, int x, int y, int w, int h); +}; + +struct _Ecore_IMF_Context_Info +{ + const char *id; /* ID */ + const char *description; /* Human readable description */ + const char *default_locales; /* Languages for which this context is the default, separated by : */ + const char *canvas_type; /* The canvas type used by the input method. Eg.: evas */ + int canvas_required; /* Whether the canvas usage is required for this input method */ +}; + +EAPI int ecore_imf_init(void); +EAPI int ecore_imf_shutdown(void); + +EAPI void ecore_imf_module_register(const Ecore_IMF_Context_Info *info, Ecore_IMF_Context *(*imf_module_create)(void), Ecore_IMF_Context *(*imf_module_exit)(void)); + +EAPI Eina_List *ecore_imf_context_available_ids_get(void); +EAPI Eina_List *ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type); +EAPI const char *ecore_imf_context_default_id_get(void); +EAPI const char *ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type); +EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_by_id_get(const char *id); + +EAPI Ecore_IMF_Context *ecore_imf_context_add(const char *id); +EAPI const Ecore_IMF_Context_Info *ecore_imf_context_info_get(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_del(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window); +EAPI void *ecore_imf_context_client_window_get(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas); +EAPI void *ecore_imf_context_client_canvas_get(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_show(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_hide(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cursor_pos); +EAPI void ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos); +EAPI void ecore_imf_context_focus_in(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_focus_out(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_reset(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos); +EAPI void ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h); +EAPI void ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit); +EAPI void ecore_imf_context_retrieve_surrounding_callback_set(Ecore_IMF_Context *ctx, Eina_Bool (*func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos), const void *data); +EAPI void ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode); +EAPI Ecore_IMF_Input_Mode ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx); +EAPI Eina_Bool ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event); + +/* plugin specific functions */ +EAPI Ecore_IMF_Context *ecore_imf_context_new(const Ecore_IMF_Context_Class *ctxc); +EAPI void ecore_imf_context_data_set(Ecore_IMF_Context *ctx, void *data); +EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx); +EAPI Eina_Bool ecore_imf_context_surrounding_get(Ecore_IMF_Context *ctx, char **text, int *cursor_pos); +EAPI void ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_preedit_changed_event_add(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str); +EAPI void ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offset, int n_chars); +EAPI void ecore_imf_context_prediction_allow_set(Ecore_IMF_Context *ctx, Eina_Bool prediction); +EAPI Eina_Bool ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type); +EAPI Ecore_IMF_Autocapital_Type ecore_imf_context_autocapital_type_get(Ecore_IMF_Context *ctx); + +EAPI void ecore_imf_context_control_panel_show(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_control_panel_hide(Ecore_IMF_Context *ctx); + +EAPI void ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_input_panel_layout_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout); +EAPI Ecore_IMF_Input_Panel_Layout ecore_imf_context_input_panel_layout_get(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_input_panel_language_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang); +EAPI Ecore_IMF_Input_Panel_Lang ecore_imf_context_input_panel_language_get(Ecore_IMF_Context *ctx); +EAPI void ecore_imf_context_input_panel_enabled_set(Ecore_IMF_Context *ctx, Eina_Bool enable); +EAPI Eina_Bool ecore_imf_context_input_panel_enabled_get(Ecore_IMF_Context *ctx); + +/* The following entry points must be exported by each input method module + */ + +/* + * int imf_module_init (const Ecore_IMF_Context_Info **info); + * void imf_module_exit (void); + * Ecore_IMF_Context *imf_module_create (void); + */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/ecore/src/lib/ecore_imf/Makefile.am b/libraries/ecore/src/lib/ecore_imf/Makefile.am new file mode 100644 index 0000000..10f6c2f --- /dev/null +++ b/libraries/ecore/src/lib/ecore_imf/Makefile.am @@ -0,0 +1,28 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +@EFL_ECORE_IMF_BUILD@ \ +@EVIL_CFLAGS@ \ +@EINA_CFLAGS@ + +AM_CFLAGS = @WIN32_CFLAGS@ + +lib_LTLIBRARIES = libecore_imf.la +includes_HEADERS = Ecore_IMF.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_imf_la_SOURCES = \ +ecore_imf.c \ +ecore_imf_context.c \ +ecore_imf_module.c + +libecore_imf_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EINA_LIBS@ \ +@EVIL_LIBS@ + +libecore_imf_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ + +EXTRA_DIST = ecore_imf_private.h diff --git a/libraries/ecore/src/lib/ecore_imf/Makefile.in b/libraries/ecore/src/lib/ecore_imf/Makefile.in new file mode 100644 index 0000000..adf8dea --- /dev/null +++ b/libraries/ecore/src/lib/ecore_imf/Makefile.in @@ -0,0 +1,822 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_imf +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_imf_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore/libecore.la +am_libecore_imf_la_OBJECTS = ecore_imf.lo ecore_imf_context.lo \ + ecore_imf_module.lo +libecore_imf_la_OBJECTS = $(am_libecore_imf_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_imf_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libecore_imf_la_LDFLAGS) $(LDFLAGS) \ + -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_imf_la_SOURCES) +DIST_SOURCES = $(libecore_imf_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +@EFL_ECORE_IMF_BUILD@ \ +@EVIL_CFLAGS@ \ +@EINA_CFLAGS@ + +AM_CFLAGS = @WIN32_CFLAGS@ +lib_LTLIBRARIES = libecore_imf.la +includes_HEADERS = Ecore_IMF.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_imf_la_SOURCES = \ +ecore_imf.c \ +ecore_imf_context.c \ +ecore_imf_module.c + +libecore_imf_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EINA_LIBS@ \ +@EVIL_LIBS@ + +libecore_imf_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ +EXTRA_DIST = ecore_imf_private.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_imf/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_imf/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_imf.la: $(libecore_imf_la_OBJECTS) $(libecore_imf_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_imf_la_LINK) -rpath $(libdir) $(libecore_imf_la_OBJECTS) $(libecore_imf_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_imf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_imf_context.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_imf_module.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_imf/ecore_imf.c b/libraries/ecore/src/lib/ecore_imf/ecore_imf.c new file mode 100644 index 0000000..7cf8a4a --- /dev/null +++ b/libraries/ecore/src/lib/ecore_imf/ecore_imf.c @@ -0,0 +1,73 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include "Ecore_IMF.h" +#include "ecore_imf_private.h" + +EAPI int ECORE_IMF_EVENT_PREEDIT_START = 0; +EAPI int ECORE_IMF_EVENT_PREEDIT_END = 0; +EAPI int ECORE_IMF_EVENT_PREEDIT_CHANGED = 0; +EAPI int ECORE_IMF_EVENT_COMMIT = 0; +EAPI int ECORE_IMF_EVENT_DELETE_SURROUNDING = 0; + +int _ecore_imf_log_dom = -1; +static int _ecore_imf_init_count = 0; + +/** + * @defgroup Ecore_IMF_Lib_Group Ecore Input Method Library Functions + * + * Utility functions that set up and shut down the Ecore Input Method + * library. + */ + +/** + * Initialises the Ecore_IMF library. + * @return Number of times the library has been initialised without being + * shut down. + * @ingroup Ecore_IMF_Lib_Group + */ +EAPI int +ecore_imf_init(void) +{ + if (++_ecore_imf_init_count != 1) return _ecore_imf_init_count; + + if (!ecore_init()) return --_ecore_imf_init_count; + _ecore_imf_log_dom = eina_log_domain_register + ("ecore_imf", ECORE_IMF_DEFAULT_LOG_COLOR); + if (_ecore_imf_log_dom < 0) + { + EINA_LOG_ERR("Impossible to create a log domain for the Ecore IMF module."); + ecore_shutdown(); + return --_ecore_imf_init_count; + } + ecore_imf_module_init(); + + ECORE_IMF_EVENT_PREEDIT_START = ecore_event_type_new(); + ECORE_IMF_EVENT_PREEDIT_END = ecore_event_type_new(); + ECORE_IMF_EVENT_PREEDIT_CHANGED = ecore_event_type_new(); + ECORE_IMF_EVENT_COMMIT = ecore_event_type_new(); + ECORE_IMF_EVENT_DELETE_SURROUNDING = ecore_event_type_new(); + + return _ecore_imf_init_count; +} + +/** + * Shuts down the Ecore_IMF library. + * @return Number of times the library has been initialised without being + * shut down. + * @ingroup Ecore_IMF_Lib_Group + */ +EAPI int +ecore_imf_shutdown(void) +{ + if (--_ecore_imf_init_count != 0) return _ecore_imf_init_count; + ecore_imf_module_shutdown(); + eina_log_domain_unregister(_ecore_imf_log_dom); + _ecore_imf_log_dom = -1; + ecore_shutdown(); + return _ecore_imf_init_count; +} diff --git a/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c b/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c new file mode 100644 index 0000000..417fad3 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_imf/ecore_imf_context.c @@ -0,0 +1,1237 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include + +#include +#include + +#include "Ecore_IMF.h" +#include "ecore_imf_private.h" + +/** + * @defgroup Ecore_IMF_Context_Group Ecore Input Method Context Functions + * + * Functions that operate on Ecore Input Method Context objects. + */ + +/** + * Get the list of the available Input Method Context ids. + * + * Note that the caller is responsible for freeing the Eina_List + * when finished with it. There is no need to finish the list strings. + * + * @return Return an Eina_List of strings; + * on failure it returns NULL. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI Eina_List * +ecore_imf_context_available_ids_get(void) +{ + return ecore_imf_module_context_ids_get(); +} + +EAPI Eina_List * +ecore_imf_context_available_ids_by_canvas_type_get(const char *canvas_type) +{ + return ecore_imf_module_context_ids_by_canvas_type_get(canvas_type); +} + +/* + * Match @locale against @against. + * + * 'en_US' against 'en_US' => 4 + * 'en_US' against 'en' => 3 + * 'en', 'en_UK' against 'en_US' => 2 + * all locales, against '*' => 1 + */ +static int +_ecore_imf_context_match_locale(const char *locale, const char *against, int against_len) +{ + if (strcmp(against, "*") == 0) + return 1; + + if (strcasecmp(locale, against) == 0) + return 4; + + if (strncasecmp(locale, against, 2) == 0) + return (against_len == 2) ? 3 : 2; + + return 0; +} + +/** + * Get the id of the default Input Method Context. + * The id may to used to create a new instance of an Input Method + * Context object. + * + * @return Return a string containing the id of the default Input + * Method Context; on failure it returns NULL. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI const char * +ecore_imf_context_default_id_get(void) +{ + return ecore_imf_context_default_id_by_canvas_type_get(NULL); +} + +EAPI const char * +ecore_imf_context_default_id_by_canvas_type_get(const char *canvas_type) +{ + const char *id; + Eina_List *modules; + Ecore_IMF_Module *module; + char *locale; + char *tmp; + int best_goodness = 0; + + id = getenv("ECORE_IMF_MODULE"); + if (id) + { + if (strcmp(id, "none") == 0) return NULL; + if (ecore_imf_module_get(id)) return id; + } + + modules = ecore_imf_module_available_get(); + if (!modules) return NULL; + + locale = setlocale(LC_CTYPE, NULL); + if (!locale) return NULL; + + locale = strdup(locale); + + tmp = strchr(locale, '.'); + if (tmp) *tmp = '\0'; + tmp = strchr(locale, '@'); + if (tmp) *tmp = '\0'; + + id = NULL; + + EINA_LIST_FREE(modules, module) + { + if (canvas_type && + strcmp(module->info->canvas_type, canvas_type) == 0) + continue; + + const char *p = module->info->default_locales; + while (p) + { + const char *q = strchr(p, ':'); + int goodness = _ecore_imf_context_match_locale(locale, p, q ? (size_t)(q - p) : strlen (p)); + + if (goodness > best_goodness) + { + id = module->info->id; + best_goodness = goodness; + } + + p = q ? q + 1 : NULL; + } + } + + free(locale); + return id; +} + +/** + * Retrieve the info for the Input Method Context with @p id. + * + * @param id The Input Method Context id to query for. + * @return Return a #Ecore_IMF_Context_Info for the Input Method Context with @p id; + * on failure it returns NULL. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI const Ecore_IMF_Context_Info * +ecore_imf_context_info_by_id_get(const char *id) +{ + Ecore_IMF_Module *module; + + if (!id) return NULL; + module = ecore_imf_module_get(id); + if (!module) return NULL; + return module->info; +} + +/** + * Create a new Input Method Context defined by the given id. + * + * @param id The Input Method Context id. + * @return A newly allocated Input Method Context; + * on failure it returns NULL. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI Ecore_IMF_Context * +ecore_imf_context_add(const char *id) +{ + Ecore_IMF_Context *ctx; + + if (!id) return NULL; + ctx = ecore_imf_module_context_create(id); + if (!ctx || !ctx->klass) return NULL; + if (ctx->klass->add) ctx->klass->add(ctx); + /* default use_preedit is EINA_TRUE, so let's make sure it's + * set on the immodule */ + ecore_imf_context_use_preedit_set(ctx, EINA_TRUE); + + /* default prediction is EINA_TRUE, so let's make sure it's + * set on the immodule */ + ecore_imf_context_prediction_allow_set(ctx, EINA_TRUE); + + /* default autocapital type is SENTENCE type, so let's make sure it's + * set on the immodule */ + ecore_imf_context_autocapital_type_set(ctx, ECORE_IMF_AUTOCAPITAL_TYPE_SENTENCE); + + /* default input panel enabled status is EINA_TRUE, so let's make sure it's + * set on the immodule */ + ecore_imf_context_input_panel_enabled_set(ctx, EINA_TRUE); + + /* default input_mode is ECORE_IMF_INPUT_MODE_FULL, so let's make sure it's + * set on the immodule */ + ecore_imf_context_input_mode_set(ctx, ECORE_IMF_INPUT_MODE_FULL); + return ctx; +} + +/** + * Retrieve the info for the given Input Method Context. + * + * @param ctx An #Ecore_IMF_Context. + * @return Return a #Ecore_IMF_Context_Info for the given Input Method Context; + * on failure it returns NULL. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI const Ecore_IMF_Context_Info * +ecore_imf_context_info_get(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_info_get"); + return NULL; + } + return ctx->module->info; +} + +/** + * Delete the given Input Method Context and free its memory. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_del(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_del"); + return; + } + if (ctx->klass->del) ctx->klass->del(ctx); + ECORE_MAGIC_SET(ctx, ECORE_MAGIC_NONE); + free(ctx); +} + +/** + * Set the client window for the Input Method Context; this is the + * Ecore_X_Window when using X11, Ecore_Win32_Window when using Win32, etc. + * This window is used in order to correctly position status windows, and may + * also be used for purposes internal to the Input Method Context. + * + * @param ctx An #Ecore_IMF_Context. + * @param window The client window. This may be NULL to indicate + * that the previous client window no longer exists. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_client_window_set(Ecore_IMF_Context *ctx, void *window) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_client_window_set"); + return; + } + if (ctx->klass->client_window_set) ctx->klass->client_window_set(ctx, window); + ctx->window = window; +} + +/** + * Get the client window of the Input Method Context + * + * See @ref ecore_imf_context_client_window_set for more details. + * + * @param ctx An #Ecore_IMF_Context. + * @return Return the client window. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI void * +ecore_imf_context_client_window_get(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_client_window_get"); + return NULL; + } + return ctx->window; +} + +/** + * Set the client canvas for the Input Method Context; this is the + * canvas in which the input appears. + * The canvas type can be determined by using the context canvas type. + * Actually only canvas with type "evas" (Evas *) is supported. + * This canvas may be used in order to correctly position status windows, and may + * also be used for purposes internal to the Input Method Context. + * + * @param ctx An #Ecore_IMF_Context. + * @param canvas The client canvas. This may be NULL to indicate + * that the previous client canvas no longer exists. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_client_canvas_set(Ecore_IMF_Context *ctx, void *canvas) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_client_canvas_set"); + return; + } + if (ctx->klass->client_canvas_set) ctx->klass->client_canvas_set(ctx, canvas); + ctx->client_canvas = canvas; +} + +/** + * Get the client canvas of the Input Method Context. + * + * See @ref ecore_imf_context_client_canvas_set for more details. + * + * @param ctx An #Ecore_IMF_Context. + * @return Return the client canvas. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI void * +ecore_imf_context_client_canvas_get(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_client_canvas_get"); + return NULL; + } + return ctx->client_canvas; +} + +/** + * Ask the Input Method Context to show itself. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_show(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_show"); + return; + } + if (ctx->klass->show) ctx->klass->show(ctx); +} + +/** + * Ask the Input Method Context to hide itself. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_hide(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_hide"); + return; + } + if (ctx->klass->hide) ctx->klass->hide(ctx); +} + +/** + * Retrieve the current preedit string and cursor position + * for the Input Method Context. + * + * @param ctx An #Ecore_IMF_Context. + * @param str Location to store the retrieved string. The + * string retrieved must be freed with free(). + * @param cursor_pos Location to store position of cursor (in characters) + * within the preedit string. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_preedit_string_get(Ecore_IMF_Context *ctx, char **str, int *cursor_pos) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_preedit_string_get"); + return; + } + if (ctx->klass->preedit_string_get) + ctx->klass->preedit_string_get(ctx, str, cursor_pos); + else + { + if (str) *str = strdup(""); + if (cursor_pos) *cursor_pos = 0; + } +} + +/** + * Retrieve the current preedit string, atrributes and + * cursor position for the Input Method Context. + * + * @param ctx An #Ecore_IMF_Context. + * @param str Location to store the retrieved string. The + * string retrieved must be freed with free(). + * @param attrs an Eina_List of attributes + * @param cursor_pos Location to store position of cursor (in characters) + * within the preedit string. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_preedit_string_with_attributes_get(Ecore_IMF_Context *ctx, char **str, Eina_List **attrs, int *cursor_pos) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_preedit_string_with_attributes_get"); + return; + } + if (ctx->klass->preedit_string_with_attributes_get) + ctx->klass->preedit_string_with_attributes_get(ctx, str, attrs, cursor_pos); + else + { + if (str) *str = strdup(""); + if (attrs) *attrs = NULL; + if (cursor_pos) *cursor_pos = 0; + } +} + +/** + * Notify the Input Method Context that the widget to which its + * correspond has gained focus. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_focus_in(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_focus_in"); + return; + } + if (ctx->klass->focus_in) ctx->klass->focus_in(ctx); +} + +/** + * Notify the Input Method Context that the widget to which its + * correspond has lost focus. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_focus_out(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_focus_out"); + return; + } + if (ctx->klass->focus_out) ctx->klass->focus_out(ctx); +} + +/** + * Notify the Input Method Context that a change such as a + * change in cursor position has been made. This will typically + * cause the Input Method Context to clear the preedit state. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_reset(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_reset"); + return; + } + if (ctx->klass->reset) ctx->klass->reset(ctx); +} + +/** + * Notify the Input Method Context that a change in the cursor + * position has been made. + * + * @param ctx An #Ecore_IMF_Context. + * @param cursor_pos New cursor position in characters. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_cursor_position_set(Ecore_IMF_Context *ctx, int cursor_pos) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_cursor_position_set"); + return; + } + if (ctx->klass->cursor_position_set) ctx->klass->cursor_position_set(ctx, cursor_pos); +} + +/** + * Notify the Input Method Context that a change in the cursor + * location has been made. The location is relative to the canvas. + * + * @param ctx An #Ecore_IMF_Context. + * @param x cursor x position. + * @param x cursor y position. + * @param w cursor width. + * @param h cursor height. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_cursor_location_set(Ecore_IMF_Context *ctx, int x, int y, int w, int h) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_cursor_location_set"); + return; + } + if (ctx->klass->cursor_location_set) ctx->klass->cursor_location_set(ctx, x, y, w, h); +} + +/** + * Set whether the IM context should use the preedit string + * to display feedback. If @use_preedit is EINA_FALSE (default + * is EINA_TRUE), then the IM context may use some other method to display + * feedback, such as displaying it in a child of the root window. + * + * @param ctx An #Ecore_IMF_Context. + * @param use_preedit Whether the IM context should use the preedit string. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_use_preedit_set(Ecore_IMF_Context *ctx, Eina_Bool use_preedit) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_use_preedit_set"); + return; + } + if (ctx->klass->use_preedit_set) ctx->klass->use_preedit_set(ctx, use_preedit); +} + +/** + * Set whether the IM context should allow to use the text prediction. + * If @prediction is EINA_FALSE (default is EINA_TRUE), then the IM context will not display the text prediction window. + * + * @param ctx An #Ecore_IMF_Context. + * @param prediction Whether the IM context should allow to use the text prediction. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_prediction_allow_set(Ecore_IMF_Context *ctx, Eina_Bool prediction) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_prediction_allow_set"); + return; + } + + ctx->allow_prediction = prediction; + + if (ctx->klass->prediction_allow_set) + ctx->klass->prediction_allow_set(ctx, prediction); +} + +/** + * Get whether the IM context should allow to use the text prediction. + * + * @param ctx An #Ecore_IMF_Context. + * @return EINA_TRUE if it allows to use the text prediction, otherwise EINA_FALSE. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI Eina_Bool +ecore_imf_context_prediction_allow_get(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_prediction_allow_get"); + return EINA_FALSE; + } + + return ctx->allow_prediction; +} + +/** + * Set the autocapitalization type on the immodule. + * + * @param ctx An #Ecore_IMF_Context. + * @param autocapital_type the autocapitalization type. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_autocapital_type_set(Ecore_IMF_Context *ctx, Ecore_IMF_Autocapital_Type autocapital_type) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_autocapital_type_set"); + return; + } + + ctx->autocapital_type = autocapital_type; + + if (ctx->klass->autocapital_type_set) ctx->klass->autocapital_type_set(ctx, autocapital_type); +} + +/** + * Get the autocapitalization type. + * + * @param ctx An #Ecore_IMF_Context. + * @return The autocapital type being used by @p ctx. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI Ecore_IMF_Autocapital_Type +ecore_imf_context_autocapital_type_get(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_autocapital_allow_get"); + return ECORE_IMF_AUTOCAPITAL_TYPE_NONE; + } + + return ctx->autocapital_type; +} + +/** + * Set the callback to be used on get_surrounding request. + * + * This callback will be called when the Input Method Context + * module requests the surrounding context. + * + * @param ctx An #Ecore_IMF_Context. + * @param func The callback to be called. + * @param data The data pointer to be passed to @p func + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_retrieve_surrounding_callback_set(Ecore_IMF_Context *ctx, Eina_Bool (*func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos), const void *data) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_retrieve_surrounding_callback_set"); + return; + } + + ctx->retrieve_surrounding_func = func; + ctx->retrieve_surrounding_data = (void *) data; +} + +/** + * Set the input mode used by the Ecore Input Context. + * + * The input mode can be one of the input modes defined in + * #Ecore_IMF_Input_Mode. The default input mode is + * ECORE_IMF_INPUT_MODE_FULL. + * + * @param ctx An #Ecore_IMF_Context. + * @param input_mode The input mode to be used by @p ctx. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI void +ecore_imf_context_input_mode_set(Ecore_IMF_Context *ctx, Ecore_IMF_Input_Mode input_mode) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_mode_set"); + return; + } + if (ctx->klass->input_mode_set) ctx->klass->input_mode_set(ctx, input_mode); + ctx->input_mode = input_mode; +} + +/** + * Get the input mode being used by the Ecore Input Context. + * + * See @ref ecore_imf_context_input_mode_set for more details. + * + * @param ctx An #Ecore_IMF_Context. + * @return The input mode being used by @p ctx. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI Ecore_IMF_Input_Mode +ecore_imf_context_input_mode_get(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_mode_set"); + return 0; + } + return ctx->input_mode; +} + +/** + * Allow an Ecore Input Context to internally handle an event. + * If this function returns EINA_TRUE, then no further processing + * should be done for this event. + * + * Input methods must be able to accept all types of events (simply + * returning EINA_FALSE if the event was not handled), but there is no + * obligation of any events to be submitted to this function. + * + * @param ctx An #Ecore_IMF_Context. + * @param type The type of event defined by #Ecore_IMF_Event_Type. + * @param event The event itself. + * @return EINA_TRUE if the event was handled; otherwise EINA_FALSE. + * @ingroup Ecore_IMF_Context_Group + */ +EAPI Eina_Bool +ecore_imf_context_filter_event(Ecore_IMF_Context *ctx, Ecore_IMF_Event_Type type, Ecore_IMF_Event *event) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_filter_event"); + return EINA_FALSE; + } + if (ctx->klass->filter_event) return ctx->klass->filter_event(ctx, type, event); + return EINA_FALSE; +} + +/** + * @defgroup Ecore_IMF_Context_Module_Group Ecore Input Method Context Module Functions + * + * Functions that should be used by Ecore Input Method Context modules. + */ + +/** + * Creates a new Input Method Context with klass specified by @p ctxc. + * + * This method should be used by modules implementing the Input + * Method Context interface. + * + * @param ctxc An #Ecore_IMF_Context_Class. + * @return A new #Ecore_IMF_Context; on failure it returns NULL. + * @ingroup Ecore_IMF_Context_Module_Group + */ +EAPI Ecore_IMF_Context * +ecore_imf_context_new(const Ecore_IMF_Context_Class *ctxc) +{ + Ecore_IMF_Context *ctx; + + if (!ctxc) return NULL; + ctx = calloc(1, sizeof(Ecore_IMF_Context)); + if (!ctx) return NULL; + ECORE_MAGIC_SET(ctx, ECORE_MAGIC_CONTEXT); + ctx->klass = ctxc; + ctx->data = NULL; + ctx->retrieve_surrounding_func = NULL; + ctx->retrieve_surrounding_data = NULL; + return ctx; +} + +/** + * Set the Input Method Context specific data. + * + * Note that this method should be used by modules to set + * the Input Method Context specific data and it's not meant to + * be used by applications to store application specific data. + * + * @param ctx An #Ecore_IMF_Context. + * @param data The Input Method Context specific data. + * @return A new #Ecore_IMF_Context; on failure it returns NULL. + * @ingroup Ecore_IMF_Context_Module_Group + */ +EAPI void +ecore_imf_context_data_set(Ecore_IMF_Context *ctx, void *data) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_data_set"); + return; + } + ctx->data = data; +} + +/** + * Get the Input Method Context specific data. + * + * See @ref ecore_imf_context_data_set for more details. + * + * @param ctx An #Ecore_IMF_Context. + * @return The Input Method Context specific data. + * @ingroup Ecore_IMF_Context_Module_Group + */ +EAPI void *ecore_imf_context_data_get(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_data_get"); + return NULL; + } + return ctx->data; +} + +/** + * Retrieve context around insertion point. + * + * This function is implemented by calling the + * Ecore_IMF_Context::retrieve_surrounding_func ( + * set using #ecore_imf_context_retrieve_surrounding_callback_set). + * + * There is no obligation for a widget to respond to the + * ::retrieve_surrounding_func, so input methods must be prepared + * to function without context. + * + * @param ctx An #Ecore_IMF_Context. + * @param text Location to store a UTF-8 encoded string of text + * holding context around the insertion point. + * If the function returns EINA_TRUE, then you must free + * the result stored in this location with free(). + * @param cursor_pos Location to store the position in characters of + * the insertion cursor within @text. + * @return EINA_TRUE if surrounding text was provided; otherwise EINA_FALSE. + * @ingroup Ecore_IMF_Context_Module_Group + */ +EAPI Eina_Bool +ecore_imf_context_surrounding_get(Ecore_IMF_Context *ctx, char **text, int *cursor_pos) +{ + int result = EINA_FALSE; + + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_surrounding_get"); + return EINA_FALSE; + } + + if (ctx->retrieve_surrounding_func) + { + result = ctx->retrieve_surrounding_func(ctx->retrieve_surrounding_data, ctx, text, cursor_pos); + if (!result) + { + if (text) *text = NULL; + if (cursor_pos) *cursor_pos = 0; + } + } + return result; +} + +static void +_ecore_imf_event_free_preedit(void *data __UNUSED__, void *event) +{ + free(event); +} + +/** + * Adds ECORE_IMF_EVENT_PREEDIT_START to the event queue. + * + * ECORE_IMF_EVENT_PREEDIT_START should be added when a new preedit sequence starts. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Module_Group + */ +EAPI void +ecore_imf_context_preedit_start_event_add(Ecore_IMF_Context *ctx) +{ + Ecore_IMF_Event_Commit *ev; + + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_preedit_start_event_add"); + return; + } + + ev = malloc(sizeof(Ecore_IMF_Event_Preedit_Start)); + ev->ctx = ctx; + ecore_event_add(ECORE_IMF_EVENT_PREEDIT_START, + ev, _ecore_imf_event_free_preedit, NULL); +} + +/** + * Adds ECORE_IMF_EVENT_PREEDIT_END to the event queue. + * + * ECORE_IMF_EVENT_PREEDIT_END should be added when a new preedit sequence has been completed or canceled. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Module_Group + */ +EAPI void +ecore_imf_context_preedit_end_event_add(Ecore_IMF_Context *ctx) +{ + Ecore_IMF_Event_Commit *ev; + + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_preedit_end_event_add"); + return; + } + + ev = malloc(sizeof(Ecore_IMF_Event_Preedit_End)); + ev->ctx = ctx; + ecore_event_add(ECORE_IMF_EVENT_PREEDIT_END, + ev, _ecore_imf_event_free_preedit, NULL); +} + +/** + * Adds ECORE_IMF_EVENT_PREEDIT_CHANGED to the event queue. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_Module_Group + */ +EAPI void +ecore_imf_context_preedit_changed_event_add(Ecore_IMF_Context *ctx) +{ + Ecore_IMF_Event_Commit *ev; + + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_preedit_changed_event_add"); + return; + } + + ev = malloc(sizeof(Ecore_IMF_Event_Preedit_Changed)); + ev->ctx = ctx; + ecore_event_add(ECORE_IMF_EVENT_PREEDIT_CHANGED, + ev, _ecore_imf_event_free_preedit, NULL); +} + +static void +_ecore_imf_event_free_commit(void *data __UNUSED__, void *event) +{ + Ecore_IMF_Event_Commit *ev; + + ev = event; + if (ev->str) free(ev->str); + free(ev); +} + +/** + * Adds ECORE_IMF_EVENT_COMMIT to the event queue. + * + * @param ctx An #Ecore_IMF_Context. + * @param str The committed string. + * @ingroup Ecore_IMF_Context_Module_Group + */ +EAPI void +ecore_imf_context_commit_event_add(Ecore_IMF_Context *ctx, const char *str) +{ + Ecore_IMF_Event_Commit *ev; + + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_commit_event_add"); + return; + } + + ev = malloc(sizeof(Ecore_IMF_Event_Commit)); + ev->ctx = ctx; + ev->str = str ? strdup(str) : NULL; + ecore_event_add(ECORE_IMF_EVENT_COMMIT, + ev, _ecore_imf_event_free_commit, NULL); + +} + +static void +_ecore_imf_event_free_delete_surrounding(void *data __UNUSED__, void *event) +{ + free(event); +} + +/** + * Adds ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue. + * + * Asks the widget that the input context is attached to to delete characters around the cursor position + * by adding the ECORE_IMF_EVENT_DELETE_SURROUNDING to the event queue. + * Note that offset and n_chars are in characters not in bytes. + * + * @param ctx An #Ecore_IMF_Context. + * @param offset The start offset of surrounding to be deleted. + * @param n_chars The number of characters to be deleted. + * @ingroup Ecore_IMF_Context_Module_Group + */ +EAPI void +ecore_imf_context_delete_surrounding_event_add(Ecore_IMF_Context *ctx, int offset, int n_chars) +{ + Ecore_IMF_Event_Delete_Surrounding *ev; + + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_delete_surrounding_event_add"); + return; + } + + ev = malloc(sizeof(Ecore_IMF_Event_Delete_Surrounding)); + ev->ctx = ctx; + ev->offset = offset; + ev->n_chars = n_chars; + ecore_event_add(ECORE_IMF_EVENT_DELETE_SURROUNDING, + ev, _ecore_imf_event_free_delete_surrounding, NULL); +} + +/** + * Ask the Input Method Context to show the control panel of using Input Method. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_IMControl_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_control_panel_show (Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_control_panel_show"); + return; + } + + if (ctx->klass->control_panel_show) ctx->klass->control_panel_show(ctx); +} + +/** + * Ask the Input Method Context to hide the control panel of using Input Method. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_IMControl_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_control_panel_hide (Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_control_panel_hide"); + return; + } + + if (ctx->klass->control_panel_hide) ctx->klass->control_panel_hide(ctx); +} + +/** + * Ask the Input Method Context to show the input panel (virtual keyboard). + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_IMControl_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_input_panel_show(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_show"); + return; + } + + if (ctx->klass->show) ctx->klass->show(ctx); +} + +/** + * Ask the Input Method Context to hide the input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @ingroup Ecore_IMF_Context_IMControl_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_input_panel_hide(Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_hide"); + return; + } + + if (ctx->klass->hide) ctx->klass->hide(ctx); +} + +/** + * Set the layout of the input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @param layout see #ECORE_IMF_INPUT_PANEL_LAYOUT + * @ingroup Ecore_IMF_Context_IMControl_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_input_panel_layout_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Layout layout) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_layout_set"); + return; + } + + if (ctx->klass->input_panel_layout_set) + ctx->klass->input_panel_layout_set(ctx, layout); + + ctx->input_panel_layout = layout; +} + +/** + * Get the layout of the current active input panel. + * + * @param ctx An #Ecore_IMF_Context. + * @return layout see #Ecore_IMF_Input_Panel_Layout + * @ingroup Ecore_IMF_Context_IMControl_Group + * @since 1.1.0 + */ +EAPI Ecore_IMF_Input_Panel_Layout +ecore_imf_context_input_panel_layout_get (Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_layout_get"); + return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID; + } + + if (ctx->klass->input_panel_layout_get) + { + return ctx->input_panel_layout; + } + else + return ECORE_IMF_INPUT_PANEL_LAYOUT_INVALID; +} + +/** + * Set the language of the input panel. + * This API can be used when you want to show the English keyboard. + * + * @param ctx An #Ecore_IMF_Context. + * @param lang the language to be set to the input panel. + * @ingroup Ecore_IMF_Context_IMControl_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_input_panel_language_set (Ecore_IMF_Context *ctx, Ecore_IMF_Input_Panel_Lang lang) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_language_set"); + return; + } + + if (ctx->klass->input_panel_language_set) ctx->klass->input_panel_language_set(ctx, lang); + ctx->input_panel_lang = lang; +} + +/** + * Get the language of the input panel. + * + * See @ref ecore_imf_context_input_panel_language_set for more details. + * + * @param ctx An #Ecore_IMF_Context. + * @return Ecore_IMF_Input_Panel_Lang + * @ingroup Ecore_IMF_Context_IMControl_Group + * @since 1.1.0 + */ +EAPI Ecore_IMF_Input_Panel_Lang +ecore_imf_context_input_panel_language_get (Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_language_get"); + return ECORE_IMF_INPUT_PANEL_LANG_AUTOMATIC; + } + + return ctx->input_panel_lang; +} + +/** + * Set whether the Input Method Context should request to show the input panel automatically + * when the widget has focus. + * + * @param ctx An #Ecore_IMF_Context. + * @param enabled If true, the input panel will be shown when the widget is clicked or has focus. + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI void +ecore_imf_context_input_panel_enabled_set (Ecore_IMF_Context *ctx, + Eina_Bool enabled) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_enabled_set"); + return; + } + + ctx->input_panel_enabled = enabled; +} + +/** + * Get whether the Input Method Context requests to show the input panel automatically. + * + * @param ctx An #Ecore_IMF_Context. + * @return Return the attribute to show the input panel automatically + * @ingroup Ecore_IMF_Context_Group + * @since 1.1.0 + */ +EAPI Eina_Bool +ecore_imf_context_input_panel_enabled_get (Ecore_IMF_Context *ctx) +{ + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_context_input_panel_enabled_get"); + return EINA_FALSE; + } + + return ctx->input_panel_enabled; +} + diff --git a/libraries/ecore/src/lib/ecore_imf/ecore_imf_module.c b/libraries/ecore/src/lib/ecore_imf/ecore_imf_module.c new file mode 100644 index 0000000..946f5bc --- /dev/null +++ b/libraries/ecore/src/lib/ecore_imf/ecore_imf_module.c @@ -0,0 +1,212 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include + +#include +#include + +#include "Ecore_IMF.h" +#include "ecore_imf_private.h" + +static void _ecore_imf_module_free(Ecore_IMF_Module *module); +static int _ecore_imf_modules_exists(const char *ctx_id); + +typedef struct _Ecore_IMF_Selector +{ + const char *toselect; + void *selected; +} Ecore_IMF_Selector; + +static Eina_Hash *modules = NULL; +static Eina_Array *module_list = NULL; + +void +ecore_imf_module_init(void) +{ + char *homedir; + + module_list = eina_module_list_get(NULL, PACKAGE_LIB_DIR "/ecore/immodules", 0, NULL, NULL); + homedir = eina_module_environment_path_get("HOME", "/.ecore/immodules"); + if (homedir) + { + module_list = eina_module_list_get(module_list, homedir, 0, NULL, NULL); + free(homedir); + } + eina_module_list_load(module_list); +} + +void +ecore_imf_module_shutdown(void) +{ + if (modules) + { + eina_hash_free(modules); + modules = NULL; + } + if (module_list) + { + eina_module_list_free(module_list); + eina_array_free(module_list); + module_list = NULL; + } +} + +static Eina_Bool +_hash_module_available_get(const Eina_Hash *hash __UNUSED__, int *data, void *list) +{ + *(Eina_List**)list = eina_list_append(*(Eina_List**)list, data); + return EINA_TRUE; +} + +Eina_List * +ecore_imf_module_available_get(void) +{ + Eina_List *values = NULL; + Eina_Iterator *it = NULL; + + if (!modules) return NULL; + + it = eina_hash_iterator_data_new(modules); + if (!it) + return NULL; + + eina_iterator_foreach(it, EINA_EACH_CB(_hash_module_available_get), &values); + eina_iterator_free(it); + + return values; +} + +Ecore_IMF_Module * +ecore_imf_module_get(const char *ctx_id) +{ + if (!modules) return NULL; + return eina_hash_find(modules, ctx_id); +} + +Ecore_IMF_Context * +ecore_imf_module_context_create(const char *ctx_id) +{ + Ecore_IMF_Module *module; + Ecore_IMF_Context *ctx = NULL; + + if (!modules) return NULL; + module = eina_hash_find(modules, ctx_id); + if (module) + { + ctx = module->create(); + if (!ECORE_MAGIC_CHECK(ctx, ECORE_MAGIC_CONTEXT)) + { + ECORE_MAGIC_FAIL(ctx, ECORE_MAGIC_CONTEXT, + "ecore_imf_module_context_create"); + return NULL; + } + ctx->module = module; + } + return ctx; +} + +static Eina_Bool +_hash_ids_get(const Eina_Hash *hash __UNUSED__, const char *key, void *list) +{ + *(Eina_List**)list = eina_list_append(*(Eina_List**)list, key); + return EINA_TRUE; +} + +Eina_List * +ecore_imf_module_context_ids_get(void) +{ + Eina_List *l = NULL; + Eina_Iterator *it = NULL; + + if (!modules) return NULL; + + it = eina_hash_iterator_key_new(modules); + if (!it) + return NULL; + + eina_iterator_foreach(it, EINA_EACH_CB(_hash_ids_get), &l); + eina_iterator_free(it); + + return l; +} + +static Eina_Bool +_hash_ids_by_canvas_type_get(const Eina_Hash *hash __UNUSED__, void *data, void *fdata) +{ + Ecore_IMF_Module *module = data; + Ecore_IMF_Selector *selector = fdata; + + if (!strcmp(module->info->canvas_type, selector->toselect)) + selector->selected = eina_list_append(selector->selected, (void *)module->info->id); + + return EINA_TRUE; +} + +Eina_List * +ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type) +{ + Ecore_IMF_Selector selector; + Eina_List *values = NULL; + Eina_Iterator *it = NULL; + + if (!modules) return NULL; + + if (!canvas_type) + return ecore_imf_module_context_ids_get(); + + it = eina_hash_iterator_data_new(modules); + if (!it) + return NULL; + + selector.toselect = canvas_type; + selector.selected = values; + eina_iterator_foreach(it, EINA_EACH_CB(_hash_ids_by_canvas_type_get), &selector); + eina_iterator_free(it); + + return values; +} + +EAPI void +ecore_imf_module_register(const Ecore_IMF_Context_Info *info, + Ecore_IMF_Context *(*imf_module_create)(void), + Ecore_IMF_Context *(*imf_module_exit)(void)) +{ + Ecore_IMF_Module *module; + + if (_ecore_imf_modules_exists(info->id)) return; + + if (!modules) + modules = eina_hash_string_superfast_new(EINA_FREE_CB(_ecore_imf_module_free)); + + module = malloc(sizeof(Ecore_IMF_Module)); + module->info = info; + /* cache imf_module_create as it may be used several times */ + module->create = imf_module_create; + module->exit = imf_module_exit; + + eina_hash_add(modules, info->id, module); +} + +static void +_ecore_imf_module_free(Ecore_IMF_Module *module) +{ + if (module->exit) module->exit(); + free(module); +} + +static int +_ecore_imf_modules_exists(const char *ctx_id) +{ + if (!modules) return 0; + if (!ctx_id) return 0; + + if (eina_hash_find(modules, ctx_id)) + return 1; + + return 0; +} diff --git a/libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h b/libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h new file mode 100644 index 0000000..07a5b09 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_imf/ecore_imf_private.h @@ -0,0 +1,72 @@ +#ifndef _ECORE_IMF_PRIVATE_H +#define _ECORE_IMF_PRIVATE_H + +#define ECORE_MAGIC_CONTEXT 0x56c1b39a + +#ifdef ECORE_IMF_DEFAULT_LOG_COLOR +#undef ECORE_IMF_DEFAULT_LOG_COLOR +#endif +#define ECORE_IMF_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + +extern int _ecore_imf_log_dom; +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_ecore_imf_log_dom, __VA_ARGS__) + +#ifdef DBG +# undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_ecore_imf_log_dom, __VA_ARGS__) + +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_ecore_imf_log_dom, __VA_ARGS__) + +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_ecore_imf_log_dom, __VA_ARGS__) + +#ifdef CRIT +# undef CRIT +#endif +#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_imf_log_dom, __VA_ARGS__) + +typedef struct _Ecore_IMF_Module Ecore_IMF_Module; + +struct _Ecore_IMF_Context +{ + ECORE_MAGIC; + const Ecore_IMF_Module *module; + const Ecore_IMF_Context_Class *klass; + void *data; + int input_mode; + void *window; + void *client_canvas; + Eina_Bool (*retrieve_surrounding_func)(void *data, Ecore_IMF_Context *ctx, char **text, int *cursor_pos); + void *retrieve_surrounding_data; + Ecore_IMF_Autocapital_Type autocapital_type; + Ecore_IMF_Input_Panel_Layout input_panel_layout; + Ecore_IMF_Input_Panel_Lang input_panel_lang; + Eina_Bool allow_prediction : 1; + Eina_Bool input_panel_enabled : 1; +}; + +struct _Ecore_IMF_Module +{ + const Ecore_IMF_Context_Info *info; + Ecore_IMF_Context *(*create)(void); + Ecore_IMF_Context *(*exit)(void); +}; + +void ecore_imf_module_init(void); +void ecore_imf_module_shutdown(void); +Eina_List *ecore_imf_module_available_get(void); +Ecore_IMF_Module *ecore_imf_module_get(const char *ctx_id); +Ecore_IMF_Context *ecore_imf_module_context_create(const char *ctx_id); +Eina_List *ecore_imf_module_context_ids_get(void); +Eina_List *ecore_imf_module_context_ids_by_canvas_type_get(const char *canvas_type); + +#endif diff --git a/libraries/ecore/src/lib/ecore_imf_evas/Ecore_IMF_Evas.h b/libraries/ecore/src/lib/ecore_imf_evas/Ecore_IMF_Evas.h new file mode 100644 index 0000000..5f7cdb9 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_imf_evas/Ecore_IMF_Evas.h @@ -0,0 +1,50 @@ +#ifndef _ECORE_IMF_EVAS_H +#define _ECORE_IMF_EVAS_H + +#include +#include + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_ECORE_IMF_EVAS_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_ECORE_IMF_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif /* ! _WIN32 */ + +#ifdef __cplusplus +extern "C" { +#endif + +EAPI void ecore_imf_evas_event_mouse_in_wrap(Evas_Event_Mouse_In *evas_event, Ecore_IMF_Event_Mouse_In *imf_event); +EAPI void ecore_imf_evas_event_mouse_out_wrap(Evas_Event_Mouse_Out *evas_event, Ecore_IMF_Event_Mouse_Out *imf_event); +EAPI void ecore_imf_evas_event_mouse_move_wrap(Evas_Event_Mouse_Move *evas_event, Ecore_IMF_Event_Mouse_Move *imf_event); +EAPI void ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event, Ecore_IMF_Event_Mouse_Down *imf_event); +EAPI void ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event, Ecore_IMF_Event_Mouse_Up *imf_event); +EAPI void ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_event, Ecore_IMF_Event_Mouse_Wheel *imf_event); +EAPI void ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event, Ecore_IMF_Event_Key_Down *imf_event); +EAPI void ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event, Ecore_IMF_Event_Key_Up *imf_event); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/ecore/src/lib/ecore_imf_evas/Makefile.am b/libraries/ecore/src/lib/ecore_imf_evas/Makefile.am new file mode 100644 index 0000000..fa5c491 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_imf_evas/Makefile.am @@ -0,0 +1,22 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_imf \ +@EFL_ECORE_IMF_EVAS_BUILD@ \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_imf_evas.la +includes_HEADERS = Ecore_IMF_Evas.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_imf_evas_la_SOURCES = \ +ecore_imf_evas.c + +libecore_imf_evas_la_LIBADD = \ +$(top_builddir)/src/lib/ecore_imf/libecore_imf.la \ +@EVAS_LIBS@ \ +@EINA_LIBS@ + +libecore_imf_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ diff --git a/libraries/ecore/src/lib/ecore_imf_evas/Makefile.in b/libraries/ecore/src/lib/ecore_imf_evas/Makefile.in new file mode 100644 index 0000000..9b26915 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_imf_evas/Makefile.in @@ -0,0 +1,815 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_imf_evas +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_imf_evas_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore_imf/libecore_imf.la +am_libecore_imf_evas_la_OBJECTS = ecore_imf_evas.lo +libecore_imf_evas_la_OBJECTS = $(am_libecore_imf_evas_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_imf_evas_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libecore_imf_evas_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_imf_evas_la_SOURCES) +DIST_SOURCES = $(libecore_imf_evas_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_imf \ +@EFL_ECORE_IMF_EVAS_BUILD@ \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_imf_evas.la +includes_HEADERS = Ecore_IMF_Evas.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_imf_evas_la_SOURCES = \ +ecore_imf_evas.c + +libecore_imf_evas_la_LIBADD = \ +$(top_builddir)/src/lib/ecore_imf/libecore_imf.la \ +@EVAS_LIBS@ \ +@EINA_LIBS@ + +libecore_imf_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_imf_evas/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_imf_evas/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_imf_evas.la: $(libecore_imf_evas_la_OBJECTS) $(libecore_imf_evas_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_imf_evas_la_LINK) -rpath $(libdir) $(libecore_imf_evas_la_OBJECTS) $(libecore_imf_evas_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_imf_evas.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_imf_evas/ecore_imf_evas.c b/libraries/ecore/src/lib/ecore_imf_evas/ecore_imf_evas.c new file mode 100644 index 0000000..86badf5 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_imf_evas/ecore_imf_evas.c @@ -0,0 +1,259 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "Ecore_IMF_Evas.h" + +/** + * @defgroup Ecore_IMF_Evas_Group Ecore Input Method Context Evas Helper Functions + * + * Helper functions to make it easy to use Evas with Ecore_IMF. + */ + +static const char *_ecore_imf_evas_event_empty = ""; + +/* Converts the Evas modifiers to Ecore_IMF keyboard modifiers */ +static void +_ecore_imf_evas_event_modifiers_wrap(Evas_Modifier *evas_modifiers, + Ecore_IMF_Keyboard_Modifiers *imf_keyboard_modifiers) +{ + if (!evas_modifiers || !imf_keyboard_modifiers) + return; + + *imf_keyboard_modifiers = ECORE_IMF_KEYBOARD_MODIFIER_NONE; + if (evas_key_modifier_is_set(evas_modifiers, "Control")) + *imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_CTRL; + if (evas_key_modifier_is_set(evas_modifiers, "Alt")) + *imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_ALT; + if (evas_key_modifier_is_set(evas_modifiers, "Shift")) + *imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_SHIFT; + if (evas_key_modifier_is_set(evas_modifiers, "Super") || evas_key_modifier_is_set(evas_modifiers, "Hyper")) + *imf_keyboard_modifiers |= ECORE_IMF_KEYBOARD_MODIFIER_WIN; +} + +/* Converts the Evas locks to Ecore_IMF keyboard locks */ +static void +_ecore_imf_evas_event_locks_wrap(Evas_Lock *evas_locks, + Ecore_IMF_Keyboard_Locks *imf_keyboard_locks) +{ + if (!evas_locks || !imf_keyboard_locks) + return; + + *imf_keyboard_locks = ECORE_IMF_KEYBOARD_LOCK_NONE; + if (evas_key_lock_is_set(evas_locks, "Num_Lock")) + *imf_keyboard_locks |= ECORE_IMF_KEYBOARD_LOCK_NUM; + if (evas_key_lock_is_set(evas_locks, "Caps_Lock")) + *imf_keyboard_locks |= ECORE_IMF_KEYBOARD_LOCK_CAPS; + if (evas_key_lock_is_set(evas_locks, "Scroll_Lock")) + *imf_keyboard_locks |= ECORE_IMF_KEYBOARD_LOCK_SCROLL; +} + +/* Converts the Evas mouse flags to Ecore_IMF mouse flags */ +static void +_ecore_imf_evas_event_mouse_flags_wrap(Evas_Button_Flags evas_flags, + Ecore_IMF_Mouse_Flags *imf_flags) +{ + if (!imf_flags) + return; + + *imf_flags = ECORE_IMF_MOUSE_NONE; + if (evas_flags & EVAS_BUTTON_DOUBLE_CLICK) + *imf_flags |= ECORE_IMF_MOUSE_DOUBLE_CLICK; + if (evas_flags & EVAS_BUTTON_TRIPLE_CLICK) + *imf_flags |= ECORE_IMF_MOUSE_TRIPLE_CLICK; +} + +/** + * Converts a "mouse_in" event from Evas to the corresponding event of Ecore_IMF. + * + * @param evas_event The received Evas event. + * @param imf_event The location to store the converted Ecore_IMF event. + * @ingroup Ecore_IMF_Evas_Group + */ +EAPI void +ecore_imf_evas_event_mouse_in_wrap(Evas_Event_Mouse_In *evas_event, + Ecore_IMF_Event_Mouse_In *imf_event) +{ + if (!evas_event || !imf_event) + return; + + imf_event->buttons = evas_event->buttons; + imf_event->output.x = evas_event->output.x; + imf_event->output.y = evas_event->output.y; + imf_event->canvas.x = evas_event->canvas.x; + imf_event->canvas.y = evas_event->canvas.y; + imf_event->timestamp = evas_event->timestamp; + _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); + _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); +} + +/** + * Converts a "mouse_out" event from Evas to the corresponding event of Ecore_IMF. + * + * @param evas_event The received Evas event. + * @param imf_event The location to store the converted Ecore_IMF event. + * @ingroup Ecore_IMF_Evas_Group + */ +EAPI void +ecore_imf_evas_event_mouse_out_wrap(Evas_Event_Mouse_Out *evas_event, + Ecore_IMF_Event_Mouse_Out *imf_event) +{ + if (!evas_event || !imf_event) + return; + + imf_event->buttons = evas_event->buttons; + imf_event->output.x = evas_event->output.x; + imf_event->output.y = evas_event->output.y; + imf_event->canvas.x = evas_event->canvas.x; + imf_event->canvas.y = evas_event->canvas.y; + imf_event->timestamp = evas_event->timestamp; + _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); + _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); +} + +/** + * Converts a "mouse_move" event from Evas to the corresponding event of Ecore_IMF. + * + * @param evas_event The received Evas event. + * @param imf_event The location to store the converted Ecore_IMF event. + * @ingroup Ecore_IMF_Evas_Group + */ +EAPI void +ecore_imf_evas_event_mouse_move_wrap(Evas_Event_Mouse_Move *evas_event, + Ecore_IMF_Event_Mouse_Move *imf_event) +{ + if (!evas_event || !imf_event) + return; + + imf_event->buttons = evas_event->buttons; + imf_event->cur.output.x = evas_event->cur.output.x; + imf_event->cur.output.y = evas_event->cur.output.y; + imf_event->prev.output.x = evas_event->prev.output.x; + imf_event->prev.output.y = evas_event->prev.output.y; + imf_event->cur.canvas.x = evas_event->cur.canvas.x; + imf_event->cur.canvas.y = evas_event->cur.canvas.y; + imf_event->prev.canvas.x = evas_event->prev.canvas.x; + imf_event->prev.canvas.y = evas_event->prev.canvas.y; + imf_event->timestamp = evas_event->timestamp; + _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); + _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); +} + +/** + * Converts a "mouse_down" event from Evas to the corresponding event of Ecore_IMF. + * + * @param evas_event The received Evas event. + * @param imf_event The location to store the converted Ecore_IMF event. + * @ingroup Ecore_IMF_Evas_Group + */ +EAPI void +ecore_imf_evas_event_mouse_down_wrap(Evas_Event_Mouse_Down *evas_event, + Ecore_IMF_Event_Mouse_Down *imf_event) +{ + if (!evas_event || !imf_event) + return; + + imf_event->button = evas_event->button; + imf_event->output.x = evas_event->output.x; + imf_event->output.y = evas_event->output.y; + imf_event->canvas.x = evas_event->canvas.x; + imf_event->canvas.y = evas_event->canvas.y; + imf_event->timestamp = evas_event->timestamp; + _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); + _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); + _ecore_imf_evas_event_mouse_flags_wrap(evas_event->flags, &imf_event->flags); +} + +/** + * Converts a "mouse_up" event from Evas to the corresponding event of Ecore_IMF. + * + * @param evas_event The received Evas event. + * @param imf_event The location to store the converted Ecore_IMF event. + * @ingroup Ecore_IMF_Evas_Group + */ +EAPI void +ecore_imf_evas_event_mouse_up_wrap(Evas_Event_Mouse_Up *evas_event, + Ecore_IMF_Event_Mouse_Up *imf_event) +{ + if (!evas_event || !imf_event) + return; + + imf_event->button = evas_event->button; + imf_event->output.x = evas_event->output.x; + imf_event->output.y = evas_event->output.y; + imf_event->canvas.x = evas_event->canvas.x; + imf_event->canvas.y = evas_event->canvas.y; + imf_event->timestamp = evas_event->timestamp; + _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); + _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); + _ecore_imf_evas_event_mouse_flags_wrap(evas_event->flags, &imf_event->flags); +} + +/** + * Converts a "mouse_wheel" event from Evas to the corresponding event of Ecore_IMF. + * + * @param evas_event The received Evas event. + * @param imf_event The location to store the converted Ecore_IMF event. + * @ingroup Ecore_IMF_Evas_Group + */ +EAPI void +ecore_imf_evas_event_mouse_wheel_wrap(Evas_Event_Mouse_Wheel *evas_event, + Ecore_IMF_Event_Mouse_Wheel *imf_event) +{ + if (!evas_event || !imf_event) + return; + + imf_event->direction = evas_event->direction; + imf_event->z = evas_event->z; + imf_event->output.x = evas_event->output.x; + imf_event->output.y = evas_event->output.y; + imf_event->canvas.x = evas_event->canvas.x; + imf_event->canvas.y = evas_event->canvas.y; + imf_event->timestamp = evas_event->timestamp; + _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); + _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); + imf_event->timestamp = evas_event->timestamp; +} + +/** + * Converts a "key_down" event from Evas to the corresponding event of Ecore_IMF. + * + * @param evas_event The received Evas event. + * @param imf_event The location to store the converted Ecore_IMF event. + * @ingroup Ecore_IMF_Evas_Group + */ +EAPI void +ecore_imf_evas_event_key_down_wrap(Evas_Event_Key_Down *evas_event, + Ecore_IMF_Event_Key_Down *imf_event) +{ + if (!evas_event || !imf_event) + return; + + imf_event->keyname = evas_event->keyname ? evas_event->keyname : _ecore_imf_evas_event_empty; + imf_event->key = evas_event->key ? evas_event->key : _ecore_imf_evas_event_empty; + imf_event->string = evas_event->string ? evas_event->string : _ecore_imf_evas_event_empty; + imf_event->compose = evas_event->compose ? evas_event->compose : _ecore_imf_evas_event_empty; + imf_event->timestamp = evas_event->timestamp; + _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); + _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); +} + +/** + * Converts a "key_up" event from Evas to the corresponding event of Ecore_IMF. + * + * @param evas_event The received Evas event. + * @param imf_event The location to store the converted Ecore_IMF event. + * @ingroup Ecore_IMF_Evas_Group + */ +EAPI void +ecore_imf_evas_event_key_up_wrap(Evas_Event_Key_Up *evas_event, + Ecore_IMF_Event_Key_Up *imf_event) +{ + imf_event->keyname = evas_event->keyname ? evas_event->keyname : _ecore_imf_evas_event_empty; + imf_event->key = evas_event->key ? evas_event->key : _ecore_imf_evas_event_empty; + imf_event->string = evas_event->string ? evas_event->string : _ecore_imf_evas_event_empty; + imf_event->compose = evas_event->compose ? evas_event->compose : _ecore_imf_evas_event_empty; + imf_event->timestamp = evas_event->timestamp; + _ecore_imf_evas_event_modifiers_wrap(evas_event->modifiers, &imf_event->modifiers); + _ecore_imf_evas_event_locks_wrap(evas_event->locks, &imf_event->locks); +} diff --git a/libraries/ecore/src/lib/ecore_input/Ecore_Input.h b/libraries/ecore/src/lib/ecore_input/Ecore_Input.h new file mode 100644 index 0000000..a64bb2b --- /dev/null +++ b/libraries/ecore/src/lib/ecore_input/Ecore_Input.h @@ -0,0 +1,220 @@ +#ifndef _ECORE_INPUT_H +#define _ECORE_INPUT_H + +#ifdef _WIN32 +# include +#else +# include +#endif + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_ECORE_INPUT_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_ECORE_INPUT_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + EAPI extern int ECORE_EVENT_KEY_DOWN; + EAPI extern int ECORE_EVENT_KEY_UP; + EAPI extern int ECORE_EVENT_MOUSE_BUTTON_DOWN; + EAPI extern int ECORE_EVENT_MOUSE_BUTTON_UP; + EAPI extern int ECORE_EVENT_MOUSE_MOVE; + EAPI extern int ECORE_EVENT_MOUSE_WHEEL; + EAPI extern int ECORE_EVENT_MOUSE_IN; + EAPI extern int ECORE_EVENT_MOUSE_OUT; + +#define ECORE_EVENT_MODIFIER_SHIFT 0x0001 +#define ECORE_EVENT_MODIFIER_CTRL 0x0002 +#define ECORE_EVENT_MODIFIER_ALT 0x0004 +#define ECORE_EVENT_MODIFIER_WIN 0x0008 +#define ECORE_EVENT_MODIFIER_SCROLL 0x0010 +#define ECORE_EVENT_MODIFIER_NUM 0x0020 +#define ECORE_EVENT_MODIFIER_CAPS 0x0040 +#define ECORE_EVENT_LOCK_SCROLL 0x0080 +#define ECORE_EVENT_LOCK_NUM 0x0100 +#define ECORE_EVENT_LOCK_CAPS 0x0200 +#define ECORE_EVENT_LOCK_SHIFT 0x0300 + + typedef uintptr_t Ecore_Window; + typedef struct _Ecore_Event_Key Ecore_Event_Key; + typedef struct _Ecore_Event_Mouse_Button Ecore_Event_Mouse_Button; + typedef struct _Ecore_Event_Mouse_Wheel Ecore_Event_Mouse_Wheel; + typedef struct _Ecore_Event_Mouse_Move Ecore_Event_Mouse_Move; + typedef struct _Ecore_Event_Mouse_IO Ecore_Event_Mouse_IO; + typedef struct _Ecore_Event_Modifiers Ecore_Event_Modifiers; + + typedef enum _Ecore_Event_Modifier + { + ECORE_NONE, + ECORE_SHIFT, + ECORE_CTRL, + ECORE_ALT, + ECORE_WIN, + ECORE_SCROLL, + ECORE_CAPS, + ECORE_LAST + } Ecore_Event_Modifier; + + typedef enum _Ecore_Event_Press + { + ECORE_DOWN, + ECORE_UP + } Ecore_Event_Press; + + typedef enum _Ecore_Event_IO + { + ECORE_IN, + ECORE_OUT + } Ecore_Event_IO; + + struct _Ecore_Event_Key + { + const char *keyname; + const char *key; + const char *string; + const char *compose; + Ecore_Window window; + Ecore_Window root_window; + Ecore_Window event_window; + + unsigned int timestamp; + unsigned int modifiers; + + int same_screen; + }; + + struct _Ecore_Event_Mouse_Button + { + Ecore_Window window; + Ecore_Window root_window; + Ecore_Window event_window; + + unsigned int timestamp; + unsigned int modifiers; + unsigned int buttons; + unsigned int double_click; + unsigned int triple_click; + int same_screen; + + int x; + int y; + struct { + int x; + int y; + } root; + + struct { + int device; /* 0 if normal mouse, 1+ for other mouse-devices (eg multi-touch - other fingers) */ + double radius, radius_x, radius_y; /* radius of press point - radius_x and y if its an ellipse (radius is the average of the 2) */ + double pressure; /* pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */ + double angle; /* angle relative to perpendicular (0.0 == perpendicular), in degrees */ + double x, y; /* same as x, y root.x, root.y, but with sub-pixel precision, if available */ + struct { + double x, y; + } root; + } multi; + }; + + struct _Ecore_Event_Mouse_Wheel + { + Ecore_Window window; + Ecore_Window root_window; + Ecore_Window event_window; + + unsigned int timestamp; + unsigned int modifiers; + + int same_screen; + int direction; + int z; + + int x; + int y; + struct { + int x; + int y; + } root; + }; + + struct _Ecore_Event_Mouse_Move + { + Ecore_Window window; + Ecore_Window root_window; + Ecore_Window event_window; + + unsigned int timestamp; + unsigned int modifiers; + + int same_screen; + + int x; + int y; + struct { + int x; + int y; + } root; + + struct { + int device; /* 0 if normal mouse, 1+ for other mouse-devices (eg multi-touch - other fingers) */ + double radius, radius_x, radius_y; /* radius of press point - radius_x and y if its an ellipse (radius is the average of the 2) */ + double pressure; /* pressure - 1.0 == normal, > 1.0 == more, 0.0 == none */ + double angle; /* angle relative to perpendicular (0.0 == perpendicular), in degrees */ + double x, y; /* same as x, y root.x, root.y, but with sub-pixel precision, if available */ + struct { + double x, y; + } root; + } multi; + }; + + struct _Ecore_Event_Mouse_IO + { + Ecore_Window window; + Ecore_Window event_window; + + unsigned int timestamp; + unsigned int modifiers; + + int x; + int y; + }; + + struct _Ecore_Event_Modifiers + { + unsigned int size; + unsigned int array[ECORE_LAST]; + }; + + EAPI int ecore_event_init(void); + EAPI int ecore_event_shutdown(void); + + EAPI unsigned int ecore_event_modifier_mask(Ecore_Event_Modifier modifier); + EAPI Ecore_Event_Modifier ecore_event_update_modifier(const char *key, Ecore_Event_Modifiers *modifiers, int inc); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/ecore/src/lib/ecore_input/Makefile.am b/libraries/ecore/src/lib/ecore_input/Makefile.am new file mode 100644 index 0000000..427dc1a --- /dev/null +++ b/libraries/ecore/src/lib/ecore_input/Makefile.am @@ -0,0 +1,24 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore \ +@EFL_ECORE_INPUT_BUILD@ \ +@EINA_CFLAGS@ \ +@EVIL_CFLAGS@ + +lib_LTLIBRARIES = libecore_input.la +includes_HEADERS = Ecore_Input.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_input_la_SOURCES = \ +ecore_input.c + +libecore_input_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EINA_LIBS@ \ +@EVIL_LIBS@ + +libecore_input_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ + +EXTRA_DIST = ecore_input_private.h diff --git a/libraries/ecore/src/lib/ecore_input/Makefile.in b/libraries/ecore/src/lib/ecore_input/Makefile.in new file mode 100644 index 0000000..dd4d663 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_input/Makefile.in @@ -0,0 +1,816 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_input +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_input_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore/libecore.la +am_libecore_input_la_OBJECTS = ecore_input.lo +libecore_input_la_OBJECTS = $(am_libecore_input_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_input_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libecore_input_la_LDFLAGS) $(LDFLAGS) \ + -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_input_la_SOURCES) +DIST_SOURCES = $(libecore_input_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore \ +@EFL_ECORE_INPUT_BUILD@ \ +@EINA_CFLAGS@ \ +@EVIL_CFLAGS@ + +lib_LTLIBRARIES = libecore_input.la +includes_HEADERS = Ecore_Input.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_input_la_SOURCES = \ +ecore_input.c + +libecore_input_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EINA_LIBS@ \ +@EVIL_LIBS@ + +libecore_input_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ +EXTRA_DIST = ecore_input_private.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_input/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_input/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_input.la: $(libecore_input_la_OBJECTS) $(libecore_input_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_input_la_LINK) -rpath $(libdir) $(libecore_input_la_OBJECTS) $(libecore_input_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_input.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_input/ecore_input.c b/libraries/ecore/src/lib/ecore_input/ecore_input.c new file mode 100644 index 0000000..ce4c275 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_input/ecore_input.c @@ -0,0 +1,120 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include "Ecore.h" +#include "ecore_private.h" + +#include "Ecore_Input.h" +#include "ecore_input_private.h" + + +int _ecore_input_log_dom = -1; + +EAPI int ECORE_EVENT_KEY_DOWN = 0; +EAPI int ECORE_EVENT_KEY_UP = 0; +EAPI int ECORE_EVENT_MOUSE_BUTTON_DOWN = 0; +EAPI int ECORE_EVENT_MOUSE_BUTTON_UP = 0; +EAPI int ECORE_EVENT_MOUSE_MOVE = 0; +EAPI int ECORE_EVENT_MOUSE_WHEEL = 0; +EAPI int ECORE_EVENT_MOUSE_IN = 0; +EAPI int ECORE_EVENT_MOUSE_OUT = 0; + +static int _ecore_event_init_count = 0; + +EAPI int +ecore_event_init(void) +{ + if (++_ecore_event_init_count != 1) + return _ecore_event_init_count; + + _ecore_input_log_dom = eina_log_domain_register + ("ecore_input", ECORE_INPUT_DEFAULT_LOG_COLOR); + if(_ecore_input_log_dom < 0) + { + EINA_LOG_ERR("Impossible to create a log domain for the ecore input module."); + return --_ecore_event_init_count; + } + + ECORE_EVENT_KEY_DOWN = ecore_event_type_new(); + ECORE_EVENT_KEY_UP = ecore_event_type_new(); + ECORE_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new(); + ECORE_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new(); + ECORE_EVENT_MOUSE_MOVE = ecore_event_type_new(); + ECORE_EVENT_MOUSE_WHEEL = ecore_event_type_new(); + ECORE_EVENT_MOUSE_IN = ecore_event_type_new(); + ECORE_EVENT_MOUSE_OUT = ecore_event_type_new(); + + return _ecore_event_init_count; +} + +EAPI int +ecore_event_shutdown(void) +{ + if (--_ecore_event_init_count != 0) + return _ecore_event_init_count; + + ECORE_EVENT_KEY_DOWN = 0; + ECORE_EVENT_KEY_UP = 0; + ECORE_EVENT_MOUSE_BUTTON_DOWN = 0; + ECORE_EVENT_MOUSE_BUTTON_UP = 0; + ECORE_EVENT_MOUSE_MOVE = 0; + ECORE_EVENT_MOUSE_WHEEL = 0; + ECORE_EVENT_MOUSE_IN = 0; + ECORE_EVENT_MOUSE_OUT = 0; + eina_log_domain_unregister(_ecore_input_log_dom); + _ecore_input_log_dom = -1; + return _ecore_event_init_count; +} + +typedef struct _Ecore_Event_Modifier_Match Ecore_Event_Modifier_Match; +struct _Ecore_Event_Modifier_Match +{ + const char *key; + Ecore_Event_Modifier modifier; + unsigned int event_modifier; +}; + +static const Ecore_Event_Modifier_Match matchs[] = { + { "Shift_L", ECORE_SHIFT, ECORE_EVENT_MODIFIER_SHIFT }, + { "Shift_R", ECORE_SHIFT, ECORE_EVENT_MODIFIER_SHIFT }, + { "Alt_L", ECORE_ALT, ECORE_EVENT_MODIFIER_ALT }, + { "Alt_R", ECORE_ALT, ECORE_EVENT_MODIFIER_ALT }, + { "Control_L", ECORE_CTRL, ECORE_EVENT_MODIFIER_CTRL }, + { "Control_R", ECORE_CTRL, ECORE_EVENT_MODIFIER_CTRL }, + { "Caps_Lock", ECORE_CAPS, ECORE_EVENT_MODIFIER_CAPS }, + { "Super_L", ECORE_WIN, ECORE_EVENT_MODIFIER_WIN }, + { "Super_R", ECORE_WIN, ECORE_EVENT_MODIFIER_WIN }, + { "Scroll_Lock", ECORE_SCROLL, ECORE_EVENT_MODIFIER_SCROLL } +}; + +EAPI unsigned int +ecore_event_modifier_mask(Ecore_Event_Modifier modifier) +{ + size_t i; + + for (i = 0; i < sizeof (matchs) / sizeof (Ecore_Event_Modifier_Match); i++) + if (matchs[i].modifier == modifier) + return matchs[i].event_modifier; + + return 0; +} + +EAPI Ecore_Event_Modifier +ecore_event_update_modifier(const char *key, Ecore_Event_Modifiers *modifiers, int inc) +{ + size_t i; + + for (i = 0; i < sizeof (matchs) / sizeof (Ecore_Event_Modifier_Match); i++) + if (strcmp(matchs[i].key, key) == 0) + { + if (modifiers && matchs[i].modifier < modifiers->size) + modifiers->array[matchs[i].modifier] += inc; + return matchs[i].modifier; + } + + return ECORE_NONE; +} diff --git a/libraries/ecore/src/lib/ecore_input/ecore_input_private.h b/libraries/ecore/src/lib/ecore_input/ecore_input_private.h new file mode 100644 index 0000000..5660a20 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_input/ecore_input_private.h @@ -0,0 +1,37 @@ +#ifndef _ECORE_INPUT_PRIVATE_H +#define _ECORE_INPUT_PRIVATE_H + +extern int _ecore_input_log_dom; + +#ifdef ECORE_INPUT_DEFAULT_LOG_COLOR +# undef ECORE_INPUT_DEFAULT_LOG_COLOR +#endif + +#define ECORE_INPUT_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_ecore_input_log_dom, __VA_ARGS__) + +#ifdef DBG +# undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_ecore_input_log_dom, __VA_ARGS__) + +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_ecore_input_log_dom, __VA_ARGS__) + +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_ecore_input_log_dom, __VA_ARGS__) + +#ifdef CRIT +# undef CRIT +#endif +#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_input_log_dom, __VA_ARGS__) + +#endif diff --git a/libraries/ecore/src/lib/ecore_input_evas/Ecore_Input_Evas.h b/libraries/ecore/src/lib/ecore_input_evas/Ecore_Input_Evas.h new file mode 100644 index 0000000..c97274e --- /dev/null +++ b/libraries/ecore/src/lib/ecore_input_evas/Ecore_Input_Evas.h @@ -0,0 +1,64 @@ +#ifndef _ECORE_INPUT_EVAS_H +#define _ECORE_INPUT_EVAS_H + +#include + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_ECORE_INPUT_EVAS_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_ECORE_INPUT_EVAS_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void (*Ecore_Event_Mouse_Move_Cb)(void *window, int x, int y, unsigned int timestamp); +typedef void (*Ecore_Event_Multi_Move_Cb)(void *window, int device, int x, int y, double radius, double radius_x, double radius_y, double pressure, double angle, double mx, double my, unsigned int timestamp); +typedef void (*Ecore_Event_Multi_Down_Cb)(void *window, int device, int x, int y, double radius, double radius_x, double radius_y, double pressure, double angle, double mx, double my, Evas_Button_Flags flags, unsigned int timestamp); +typedef void (*Ecore_Event_Multi_Up_Cb)(void *window, int device, int x, int y, double radius, double radius_x, double radius_y, double pressure, double angle, double mx, double my, Evas_Button_Flags flags, unsigned int timestamp); + +EAPI int ecore_event_evas_init(void); +EAPI int ecore_event_evas_shutdown(void); + +EAPI Eina_Bool ecore_event_evas_key_down(void *data, int type, void *event); +EAPI Eina_Bool ecore_event_evas_key_up(void *data, int type, void *event); +EAPI Eina_Bool ecore_event_evas_mouse_button_up(void *data, int type, void *event); +EAPI Eina_Bool ecore_event_evas_mouse_button_down(void *data, int type, void *event); +EAPI Eina_Bool ecore_event_evas_mouse_wheel(void *data, int type, void *event); +EAPI Eina_Bool ecore_event_evas_mouse_move(void *data, int type, void *event); +EAPI Eina_Bool ecore_event_evas_mouse_in(void *data, int type, void *event); +EAPI Eina_Bool ecore_event_evas_mouse_out(void *data, int type, void *event); + +EAPI void ecore_event_window_register(Ecore_Window id, void *window, Evas *evas, Ecore_Event_Mouse_Move_Cb move_mouse, Ecore_Event_Multi_Move_Cb move_multi, Ecore_Event_Multi_Down_Cb down_multi, Ecore_Event_Multi_Up_Cb up_multi); +EAPI void ecore_event_window_unregister(Ecore_Window id); +EAPI void *ecore_event_window_match(Ecore_Window id); +EAPI void ecore_event_window_ignore_events(Ecore_Window id, int ignore_event); + +EAPI void ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/ecore/src/lib/ecore_input_evas/Makefile.am b/libraries/ecore/src/lib/ecore_input_evas/Makefile.am new file mode 100644 index 0000000..ab5cd3b --- /dev/null +++ b/libraries/ecore/src/lib/ecore_input_evas/Makefile.am @@ -0,0 +1,29 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore_input \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore \ +@EFL_ECORE_INPUT_EVAS_BUILD@ \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ \ +@EVIL_CFLAGS@ + +lib_LTLIBRARIES = libecore_input_evas.la +includes_HEADERS = Ecore_Input_Evas.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_input_evas_la_SOURCES = \ +ecore_input_evas.c + +libecore_input_evas_la_LIBADD = \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EVAS_LIBS@ \ +@EINA_LIBS@ \ +@EVIL_LIBS@ + +libecore_input_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ + +EXTRA_DIST = ecore_input_evas_private.h diff --git a/libraries/ecore/src/lib/ecore_input_evas/Makefile.in b/libraries/ecore/src/lib/ecore_input_evas/Makefile.in new file mode 100644 index 0000000..9097992 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_input_evas/Makefile.in @@ -0,0 +1,822 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_input_evas +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_input_evas_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore_input/libecore_input.la \ + $(top_builddir)/src/lib/ecore/libecore.la +am_libecore_input_evas_la_OBJECTS = ecore_input_evas.lo +libecore_input_evas_la_OBJECTS = $(am_libecore_input_evas_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_input_evas_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libecore_input_evas_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_input_evas_la_SOURCES) +DIST_SOURCES = $(libecore_input_evas_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore_input \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore \ +@EFL_ECORE_INPUT_EVAS_BUILD@ \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ \ +@EVIL_CFLAGS@ + +lib_LTLIBRARIES = libecore_input_evas.la +includes_HEADERS = Ecore_Input_Evas.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_input_evas_la_SOURCES = \ +ecore_input_evas.c + +libecore_input_evas_la_LIBADD = \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EVAS_LIBS@ \ +@EINA_LIBS@ \ +@EVIL_LIBS@ + +libecore_input_evas_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ +EXTRA_DIST = ecore_input_evas_private.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_input_evas/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_input_evas/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_input_evas.la: $(libecore_input_evas_la_OBJECTS) $(libecore_input_evas_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_input_evas_la_LINK) -rpath $(libdir) $(libecore_input_evas_la_OBJECTS) $(libecore_input_evas_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_input_evas.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas.c b/libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas.c new file mode 100644 index 0000000..0cfe20a --- /dev/null +++ b/libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas.c @@ -0,0 +1,412 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "Ecore.h" +#include "Ecore_Input.h" + +#include "Ecore_Input_Evas.h" +#include "ecore_input_evas_private.h" + +int _ecore_input_evas_log_dom = -1; + +typedef struct _Ecore_Input_Window Ecore_Input_Window; +struct _Ecore_Input_Window +{ + Evas *evas; + void *window; + Ecore_Event_Mouse_Move_Cb move_mouse; + Ecore_Event_Multi_Move_Cb move_multi; + Ecore_Event_Multi_Down_Cb down_multi; + Ecore_Event_Multi_Up_Cb up_multi; + int ignore_event; +}; + +static int _ecore_event_evas_init_count = 0; +static Ecore_Event_Handler *ecore_event_evas_handlers[8]; +static Eina_Hash *_window_hash = NULL; + +EAPI void +ecore_event_evas_modifier_lock_update(Evas *e, unsigned int modifiers) +{ + if (modifiers & ECORE_EVENT_MODIFIER_SHIFT) + evas_key_modifier_on(e, "Shift"); + else evas_key_modifier_off(e, "Shift"); + + if (modifiers & ECORE_EVENT_MODIFIER_CTRL) + evas_key_modifier_on(e, "Control"); + else evas_key_modifier_off(e, "Control"); + + if (modifiers & ECORE_EVENT_MODIFIER_ALT) + evas_key_modifier_on(e, "Alt"); + else evas_key_modifier_off(e, "Alt"); + + if (modifiers & ECORE_EVENT_MODIFIER_WIN) + { + evas_key_modifier_on(e, "Super"); + evas_key_modifier_on(e, "Hyper"); + } + else + { + evas_key_modifier_off(e, "Super"); + evas_key_modifier_off(e, "Hyper"); + } + + if (modifiers & ECORE_EVENT_LOCK_SCROLL) + evas_key_lock_on(e, "Scroll_Lock"); + else evas_key_lock_off(e, "Scroll_Lock"); + + if (modifiers & ECORE_EVENT_LOCK_NUM) + evas_key_lock_on(e, "Num_Lock"); + else evas_key_lock_off(e, "Num_Lock"); + + if (modifiers & ECORE_EVENT_LOCK_CAPS) + evas_key_lock_on(e, "Caps_Lock"); + else evas_key_lock_off(e, "Caps_Lock"); + + if (modifiers & ECORE_EVENT_LOCK_SHIFT) + evas_key_lock_on(e, "Shift_Lock"); + else evas_key_lock_off(e, "Shift_Lock"); +} + +EAPI void +ecore_event_window_register(Ecore_Window id, void *window, Evas *evas, + Ecore_Event_Mouse_Move_Cb move_mouse, + Ecore_Event_Multi_Move_Cb move_multi, + Ecore_Event_Multi_Down_Cb down_multi, + Ecore_Event_Multi_Up_Cb up_multi) +{ + Ecore_Input_Window *w; + + w = calloc(1, sizeof(Ecore_Input_Window)); + if (!w) return; + + w->evas = evas; + w->window = window; + w->move_mouse = move_mouse; + w->move_multi = move_multi; + w->down_multi = down_multi; + w->up_multi = up_multi; + w->ignore_event = 0; + + eina_hash_add(_window_hash, &id, w); + + evas_key_modifier_add(evas, "Shift"); + evas_key_modifier_add(evas, "Control"); + evas_key_modifier_add(evas, "Alt"); + evas_key_modifier_add(evas, "Meta"); + evas_key_modifier_add(evas, "Hyper"); + evas_key_modifier_add(evas, "Super"); + evas_key_lock_add(evas, "Caps_Lock"); + evas_key_lock_add(evas, "Num_Lock"); + evas_key_lock_add(evas, "Scroll_Lock"); +} + +EAPI void +ecore_event_window_unregister(Ecore_Window id) +{ + eina_hash_del(_window_hash, &id, NULL); +} + +EAPI void * +ecore_event_window_match(Ecore_Window id) +{ + Ecore_Input_Window *lookup; + + lookup = eina_hash_find(_window_hash, &id); + if (lookup) return lookup->window; + return NULL; +} + +EAPI void +ecore_event_window_ignore_events(Ecore_Window id, int ignore_event) +{ + Ecore_Input_Window *lookup; + + lookup = eina_hash_find(_window_hash, &id); + if (!lookup) return; + lookup->ignore_event = ignore_event; +} + +static Ecore_Input_Window* +_ecore_event_window_match(Ecore_Window id) +{ + Ecore_Input_Window *lookup; + + lookup = eina_hash_find(_window_hash, &id); + if (!lookup) return NULL; + if (lookup->ignore_event) return NULL; /* Pass on event. */ + return lookup; +} + +static Eina_Bool +_ecore_event_evas_key(Ecore_Event_Key *e, Ecore_Event_Press press) +{ + Ecore_Input_Window *lookup; + + lookup = _ecore_event_window_match(e->event_window); + if (!lookup) return ECORE_CALLBACK_RENEW; + ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); + if (press == ECORE_DOWN) + evas_event_feed_key_down(lookup->evas, e->keyname, e->key, e->string, e->compose, e->timestamp, NULL); + else + evas_event_feed_key_up(lookup->evas, e->keyname, e->key, e->string, e->compose, e->timestamp, NULL); + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Press press) +{ + Ecore_Input_Window *lookup; + Evas_Button_Flags flags = EVAS_BUTTON_NONE; + + lookup = _ecore_event_window_match(e->event_window); + if (!lookup) return ECORE_CALLBACK_RENEW; + if (e->double_click) flags |= EVAS_BUTTON_DOUBLE_CLICK; + if (e->triple_click) flags |= EVAS_BUTTON_TRIPLE_CLICK; + if (e->multi.device == 0) + { + ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); + if (press == ECORE_DOWN) + evas_event_feed_mouse_down(lookup->evas, e->buttons, flags, + e->timestamp, NULL); + else + evas_event_feed_mouse_up(lookup->evas, e->buttons, flags, + e->timestamp, NULL); + } + else + { + if (press == ECORE_DOWN) + { + if (lookup->down_multi) + lookup->down_multi(lookup->window, e->multi.device, + e->x, e->y, e->multi.radius, + e->multi.radius_x, e->multi.radius_y, + e->multi.pressure, e->multi.angle, + e->multi.x, e->multi.y, flags, + e->timestamp); + else + evas_event_feed_multi_down(lookup->evas, e->multi.device, + e->x, e->y, e->multi.radius, + e->multi.radius_x, e->multi.radius_y, + e->multi.pressure, e->multi.angle, + e->multi.x, e->multi.y, flags, + e->timestamp, NULL); + } + else + { + if (lookup->up_multi) + lookup->up_multi(lookup->window, e->multi.device, + e->x, e->y, e->multi.radius, + e->multi.radius_x, e->multi.radius_y, + e->multi.pressure, e->multi.angle, + e->multi.x, e->multi.y, flags, + e->timestamp); + else + evas_event_feed_multi_up(lookup->evas, e->multi.device, + e->x, e->y, e->multi.radius, + e->multi.radius_x, e->multi.radius_y, + e->multi.pressure, e->multi.angle, + e->multi.x, e->multi.y, flags, + e->timestamp, NULL); + } + } + return ECORE_CALLBACK_RENEW; +} + +EAPI Eina_Bool +ecore_event_evas_mouse_move(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Event_Mouse_Move *e; + Ecore_Input_Window *lookup; + + e = event; + lookup = _ecore_event_window_match(e->event_window); + if (!lookup) return ECORE_CALLBACK_RENEW; + if (e->multi.device == 0) + { + ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); + if (lookup->move_mouse) + lookup->move_mouse(lookup->window, e->x, e->y, e->timestamp); + else + evas_event_feed_mouse_move(lookup->evas, e->x, e->y, e->timestamp, + NULL); + } + else + { + if (lookup->move_multi) + lookup->move_multi(lookup->window, e->multi.device, + e->x, e->y, e->multi.radius, + e->multi.radius_x, e->multi.radius_y, + e->multi.pressure, e->multi.angle, + e->multi.x, e->multi.y, e->timestamp); + else + evas_event_feed_multi_move(lookup->evas, e->multi.device, + e->x, e->y, e->multi.radius, + e->multi.radius_x, e->multi.radius_y, + e->multi.pressure, e->multi.angle, + e->multi.x, e->multi.y, e->timestamp, + NULL); + } + return ECORE_CALLBACK_RENEW; +} + +EAPI Eina_Bool +ecore_event_evas_mouse_button_down(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button *)event, ECORE_DOWN); +} + +EAPI Eina_Bool +ecore_event_evas_mouse_button_up(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + return _ecore_event_evas_mouse_button((Ecore_Event_Mouse_Button *)event, ECORE_UP); +} + +static Eina_Bool +_ecore_event_evas_mouse_io(Ecore_Event_Mouse_IO *e, Ecore_Event_IO io) +{ + Ecore_Input_Window *lookup; + + lookup = _ecore_event_window_match(e->event_window); + if (!lookup) return ECORE_CALLBACK_RENEW; + ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); + switch (io) + { + case ECORE_IN: + evas_event_feed_mouse_in(lookup->evas, e->timestamp, NULL); + break; + case ECORE_OUT: + evas_event_feed_mouse_out(lookup->evas, e->timestamp, NULL); + break; + default: + break; + } + + lookup->move_mouse(lookup->window, e->x, e->y, e->timestamp); + return ECORE_CALLBACK_RENEW; +} + +EAPI Eina_Bool +ecore_event_evas_key_down(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + return _ecore_event_evas_key((Ecore_Event_Key *)event, ECORE_DOWN); +} + +EAPI Eina_Bool +ecore_event_evas_key_up(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + return _ecore_event_evas_key((Ecore_Event_Key *)event, ECORE_UP); +} + +EAPI Eina_Bool +ecore_event_evas_mouse_wheel(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + Ecore_Event_Mouse_Wheel *e; + Ecore_Input_Window *lookup; + + e = event; + lookup = _ecore_event_window_match(e->event_window); + if (!lookup) return ECORE_CALLBACK_RENEW; + ecore_event_evas_modifier_lock_update(lookup->evas, e->modifiers); + evas_event_feed_mouse_wheel(lookup->evas, e->direction, e->z, e->timestamp, NULL); + return ECORE_CALLBACK_RENEW; +} + +EAPI Eina_Bool +ecore_event_evas_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + return _ecore_event_evas_mouse_io((Ecore_Event_Mouse_IO *)event, ECORE_IN); +} + +EAPI Eina_Bool +ecore_event_evas_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *event) +{ + return _ecore_event_evas_mouse_io((Ecore_Event_Mouse_IO *)event, ECORE_OUT); +} + +EAPI int +ecore_event_evas_init(void) +{ + if (++_ecore_event_evas_init_count != 1) + return _ecore_event_evas_init_count; + + _ecore_input_evas_log_dom = eina_log_domain_register + ("ecore_input_evas", ECORE_INPUT_EVAS_DEFAULT_LOG_COLOR); + if (_ecore_input_evas_log_dom < 0) + { + EINA_LOG_ERR("Impossible to create a log domain for the ecore input evas_module."); + return --_ecore_event_evas_init_count; + } + + if (!ecore_init()) + { + return --_ecore_event_evas_init_count; + } + + if (!ecore_event_init()) + { + goto shutdown_ecore; + } + + ecore_event_evas_handlers[0] = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, + ecore_event_evas_key_down, + NULL); + ecore_event_evas_handlers[1] = ecore_event_handler_add(ECORE_EVENT_KEY_UP, + ecore_event_evas_key_up, + NULL); + ecore_event_evas_handlers[2] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, + ecore_event_evas_mouse_button_down, + NULL); + ecore_event_evas_handlers[3] = ecore_event_handler_add(ECORE_EVENT_MOUSE_BUTTON_UP, + ecore_event_evas_mouse_button_up, + NULL); + ecore_event_evas_handlers[4] = ecore_event_handler_add(ECORE_EVENT_MOUSE_MOVE, + ecore_event_evas_mouse_move, + NULL); + ecore_event_evas_handlers[5] = ecore_event_handler_add(ECORE_EVENT_MOUSE_WHEEL, + ecore_event_evas_mouse_wheel, + NULL); + ecore_event_evas_handlers[6] = ecore_event_handler_add(ECORE_EVENT_MOUSE_IN, + ecore_event_evas_mouse_in, + NULL); + ecore_event_evas_handlers[7] = ecore_event_handler_add(ECORE_EVENT_MOUSE_OUT, + ecore_event_evas_mouse_out, + NULL); + + _window_hash = eina_hash_pointer_new(free); + + return _ecore_event_evas_init_count; + + shutdown_ecore: + ecore_shutdown(); + + return --_ecore_event_evas_init_count; +} + +EAPI int +ecore_event_evas_shutdown(void) +{ + size_t i; + + if (--_ecore_event_evas_init_count != 0) + return _ecore_event_evas_init_count; + + eina_hash_free(_window_hash); + _window_hash = NULL; + for (i = 0; i < sizeof(ecore_event_evas_handlers) / sizeof(Ecore_Event_Handler *); i++) + { + ecore_event_handler_del(ecore_event_evas_handlers[i]); + ecore_event_evas_handlers[i] = NULL; + } + + ecore_event_shutdown(); + ecore_shutdown(); + + eina_log_domain_unregister(_ecore_input_evas_log_dom); + _ecore_input_evas_log_dom = -1; + + return _ecore_event_evas_init_count; +} diff --git a/libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas_private.h b/libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas_private.h new file mode 100644 index 0000000..c19cfbf --- /dev/null +++ b/libraries/ecore/src/lib/ecore_input_evas/ecore_input_evas_private.h @@ -0,0 +1,37 @@ +#ifndef _ECORE_INPUT_PRIVATE_H +#define _ECORE_INPUT_PRIVATE_H + +extern int _ecore_input_evas_log_dom; + +#ifdef ECORE_INPUT_EVAS_DEFAULT_LOG_COLOR +#undef ECORE_INPUT_EVAS_DEFAULT_LOG_COLOR +#endif + +#define ECORE_INPUT_EVAS_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + +#ifdef ERR +#undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_ecore_input_evas_log_dom, __VA_ARGS__) + +#ifdef DBG +#undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_ecore_input_evas_log_dom, __VA_ARGS__) + +#ifdef INF +#undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_ecore_input_evas_log_dom, __VA_ARGS__) + +#ifdef WRN +#undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_ecore_input_evas_log_dom, __VA_ARGS__) + +#ifdef CRIT +#undef CRIT +#endif +#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_input_evas_log_dom, __VA_ARGS__) + +#endif diff --git a/libraries/ecore/src/lib/ecore_ipc/Ecore_Ipc.h b/libraries/ecore/src/lib/ecore_ipc/Ecore_Ipc.h new file mode 100644 index 0000000..40ae621 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_ipc/Ecore_Ipc.h @@ -0,0 +1,325 @@ +#ifndef _ECORE_IPC_H +#define _ECORE_IPC_H + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_ECORE_IPC_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif +# else +# define EAPI __declspec(dllimport) +# endif +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif + +/** + * @file Ecore_Ipc.h + * @brief Ecore inter-process communication functions. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct _Ecore_Ipc_Server Ecore_Ipc_Server; /**< An IPC connection handle */ +typedef struct _Ecore_Ipc_Client Ecore_Ipc_Client; /**< An IPC connection handle */ + +EAPI unsigned short _ecore_ipc_swap_16(unsigned short v); +EAPI unsigned int _ecore_ipc_swap_32(unsigned int v); +EAPI unsigned long long _ecore_ipc_swap_64(unsigned long long v); + +#ifdef WORDS_BIGENDIAN +#define ECORE_IPC_SWAP2NET64(x) _ecore_ipc_swap_64(x) +#define ECORE_IPC_SWAP2CPU64(x) _ecore_ipc_swap_64(x) +#define ECORE_IPC_SWAP2NET32(x) _ecore_ipc_swap_32(x) +#define ECORE_IPC_SWAP2CPU32(x) _ecore_ipc_swap_32(x) +#define ECORE_IPC_SWAP2NET16(x) _ecore_ipc_swap_16(x) +#define ECORE_IPC_SWAP2CPU16(x) _ecore_ipc_swap_16(x) +#define ECORE_IPC_SWAP2NET8(x) (x) +#define ECORE_IPC_SWAP2CPU8(x) (x) +#else +#define ECORE_IPC_SWAP2NET64(x) (x) +#define ECORE_IPC_SWAP2CPU64(x) (x) +#define ECORE_IPC_SWAP2NET32(x) (x) +#define ECORE_IPC_SWAP2CPU32(x) (x) +#define ECORE_IPC_SWAP2NET16(x) (x) +#define ECORE_IPC_SWAP2CPU16(x) (x) +#define ECORE_IPC_SWAP2NET8(x) (x) +#define ECORE_IPC_SWAP2CPU8(x) (x) +#endif + +/* 1, 2, 4 and 8 byte datatypes */ +/* unpacking */ +#define ECORE_IPC_GET64(v)\ + { \ + p->v = ECORE_IPC_SWAP2CPU64(*(long long *)(ptr)); \ + ptr += 8; \ + } +#define ECORE_IPC_GET32(v)\ + { \ + p->v = ECORE_IPC_SWAP2CPU32(*(int *)(ptr)); \ + ptr += 4; \ + } +#define ECORE_IPC_GET16(v)\ + { \ + p->v = ECORE_IPC_SWAP2CPU16(*(short *)(ptr)); \ + ptr += 2; \ + } +#define ECORE_IPC_GET8(v) \ + { \ + p->v = ECORE_IPC_SWAP2CPU8(*(char *)(ptr)); \ + ptr += 1; \ + } +/* packing */ +#define ECORE_IPC_PUT64(v)\ + { \ + *(long long *)(ptr) = ECORE_IPC_SWAP2NET64(p->v); \ + ptr += 8; \ + } +#define ECORE_IPC_PUT32(v)\ + { \ + *(int *)(ptr) = ECORE_IPC_SWAP2NET32(p->v); \ + ptr += 4; \ + } +#define ECORE_IPC_PUT16(v)\ + { \ + *(short *)(ptr) = ECORE_IPC_SWAP2NET16(p->v); \ + ptr += 2; \ + } +#define ECORE_IPC_PUT8(v) \ + { \ + *(char *)(ptr) = ECORE_IPC_SWAP2NET8(p->v); \ + ptr += 1; \ + } +/* padding data */ +#define ECORE_IPC_PAD8() ptr += 1 +#define ECORE_IPC_PAD16() ptr += 2 +#define ECORE_IPC_PAD32() ptr += 4 +#define ECORE_IPC_PAD64() ptr += 8 + +/* counting data when encoding lists */ +#define ECORE_IPC_CNT8() len += 1 +#define ECORE_IPC_CNT16() len += 2 +#define ECORE_IPC_CNT32() len += 4 +#define ECORE_IPC_CNT64() len += 8 + +/* strings */ +#define ECORE_IPC_CHEKS() if (*((unsigned char *)d + s - 1) != 0) return 0; +#define ECORE_IPC_GETS(v) \ + { \ + if (ptr < ((unsigned char *)d + s)) \ + { \ + p->v = (char *)ptr; \ + ptr += strlen(p->v) + 1; \ + } \ + } +#define ECORE_IPC_PUTS(v, l)\ + { \ + strcpy((char *)ptr, p->v); \ + ptr += l + 1; \ + } + +/* handy to calculate what sized block we need to alloc */ +#define ECORE_IPC_SLEN(l, v) ((l = strlen(p->v)) + 1) +#define ECORE_IPC_CNTS(v) len += strlen(p->v) + 1 + +/* saves typing function headers */ +#define ECORE_IPC_DEC_STRUCT_PROTO(x) static int x(void *d, int s, void *pp) +#define ECORE_IPC_ENC_STRUCT_PROTO(x) static void *x(void *pp, int *s) +#define ECORE_IPC_DEC_EINA_LIST_PROTO(x) static Eina_List *x(void *d, int s) +#define ECORE_IPC_ENC_EINA_LIST_PROTO(x) static void *x(Eina_List *lp, int *s) + + +/* decoder setup - saves typing. requires data packet of exact size, or fail */ +#define ECORE_IPC_DEC_STRUCT_HEAD_EXACT(typ, x) \ + typ *p; \ + unsigned char *ptr; \ + p = (typ *)pp; \ + if (!d) return 0; if (s != (x)) return 0; \ + ptr = d; +/* decoder setup - saves typing. requires data packet of a minimum size */ +#define ECORE_IPC_DEC_STRUCT_HEAD_MIN(typ, x) \ + typ *p; \ + unsigned char *ptr; \ + p = (typ *)pp; \ + if (!d) return 0; if (s < (x)) return 0; \ + ptr = d; +/* footer for the hell of it */ +#define ECORE_IPC_DEC_STRUCT_FOOT() return 1 +/* header for encoder - gives native strct type and size of flattened packet */ +#define ECORE_IPC_ENC_STRUCT_HEAD(typ, sz) \ + typ *p; \ + unsigned char *d, *ptr; \ + int len; \ + *s = 0; \ + if(!pp) return NULL; \ + p = (typ *)pp; \ + len = sz; \ + d = malloc(len); \ + if (!d) return NULL; \ + *s = len; \ + ptr = d; +/* footer for the hell of it */ +#define ECORE_IPC_ENC_STRUCT_FOOT() return d + +#define ECORE_IPC_DEC_EINA_LIST_HEAD(typ) \ + unsigned char *ptr; \ + Eina_List *l; \ + typ *p; \ + l = NULL; \ + ptr = d; \ + while(ptr < (unsigned char *)(d + s)) \ + { \ + p = malloc(sizeof(typ)); + +#define ECORE_IPC_DEC_EINA_LIST_FOOT() \ + l = eina_list_append(l, p); \ + } \ + return l +#define ECORE_IPC_ENC_EINA_LIST_HEAD_START(typ) \ + Eina_List *l; \ + typ *p; \ + unsigned char *d, *ptr; \ + int len; \ + *s = 0; \ + len = 0; \ + for (l = lp; l; l = l->next) \ + { \ + p = l->data; +#define ECORE_IPC_ENC_EINA_LIST_HEAD_FINISH() \ + } \ + d = malloc(len); \ + if(!d) return NULL; \ + *s = len; \ + ptr = d; \ + for (l = lp; l; l = l->next) \ + { \ + p = l->data; + +#define ECORE_IPC_ENC_EINA_LIST_FOOT() \ + } \ + return d + +typedef enum _Ecore_Ipc_Type +{ + ECORE_IPC_LOCAL_USER, + ECORE_IPC_LOCAL_SYSTEM, + ECORE_IPC_REMOTE_SYSTEM, + ECORE_IPC_USE_SSL = 16 +} Ecore_Ipc_Type; + +typedef struct _Ecore_Ipc_Event_Client_Add Ecore_Ipc_Event_Client_Add; +typedef struct _Ecore_Ipc_Event_Client_Del Ecore_Ipc_Event_Client_Del; +typedef struct _Ecore_Ipc_Event_Server_Add Ecore_Ipc_Event_Server_Add; +typedef struct _Ecore_Ipc_Event_Server_Del Ecore_Ipc_Event_Server_Del; +typedef struct _Ecore_Ipc_Event_Client_Data Ecore_Ipc_Event_Client_Data; +typedef struct _Ecore_Ipc_Event_Server_Data Ecore_Ipc_Event_Server_Data; + +struct _Ecore_Ipc_Event_Client_Add +{ + Ecore_Ipc_Client *client; +}; + +struct _Ecore_Ipc_Event_Client_Del +{ + Ecore_Ipc_Client *client; +}; + +struct _Ecore_Ipc_Event_Server_Add +{ + Ecore_Ipc_Server *server; +}; + +struct _Ecore_Ipc_Event_Server_Del +{ + Ecore_Ipc_Server *server; +}; + +struct _Ecore_Ipc_Event_Client_Data +{ + Ecore_Ipc_Client *client; + /* FIXME: this needs to become an ipc message */ + int major; + int minor; + int ref; + int ref_to; + int response; + void *data; + int size; +}; + +struct _Ecore_Ipc_Event_Server_Data +{ + Ecore_Ipc_Server *server; + /* FIXME: this needs to become an ipc message */ + int major; + int minor; + int ref; + int ref_to; + int response; + void *data; + int size; +}; + +EAPI extern int ECORE_IPC_EVENT_CLIENT_ADD; +EAPI extern int ECORE_IPC_EVENT_CLIENT_DEL; +EAPI extern int ECORE_IPC_EVENT_SERVER_ADD; +EAPI extern int ECORE_IPC_EVENT_SERVER_DEL; +EAPI extern int ECORE_IPC_EVENT_CLIENT_DATA; +EAPI extern int ECORE_IPC_EVENT_SERVER_DATA; + +EAPI int ecore_ipc_init(void); +EAPI int ecore_ipc_shutdown(void); + +/* FIXME: need to add protocol type parameter */ +EAPI Ecore_Ipc_Server *ecore_ipc_server_add(Ecore_Ipc_Type type, const char *name, int port, const void *data); + +/* FIXME: need to add protocol type parameter */ +EAPI Ecore_Ipc_Server *ecore_ipc_server_connect(Ecore_Ipc_Type type, char *name, int port, const void *data); +EAPI void *ecore_ipc_server_del(Ecore_Ipc_Server *svr); +EAPI void *ecore_ipc_server_data_get(Ecore_Ipc_Server *svr); +EAPI Eina_Bool ecore_ipc_server_connected_get(Ecore_Ipc_Server *svr); +EAPI Eina_List *ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr); +/* FIXME: this needs to become an ipc message */ +EAPI int ecore_ipc_server_send(Ecore_Ipc_Server *svr, int major, int minor, int ref, int ref_to, int response, const void *data, int size); +EAPI void ecore_ipc_server_client_limit_set(Ecore_Ipc_Server *svr, int client_limit, char reject_excess_clients); +EAPI void ecore_ipc_server_data_size_max_set(Ecore_Ipc_Server *srv, int size); +EAPI int ecore_ipc_server_data_size_max_get(Ecore_Ipc_Server *srv); +EAPI const char *ecore_ipc_server_ip_get(Ecore_Ipc_Server *svr); +EAPI void ecore_ipc_server_flush(Ecore_Ipc_Server *svr); + +/* FIXME: this needs to become an ipc message */ +EAPI int ecore_ipc_client_send(Ecore_Ipc_Client *cl, int major, int minor, int ref, int ref_to, int response, const void *data, int size); +EAPI Ecore_Ipc_Server *ecore_ipc_client_server_get(Ecore_Ipc_Client *cl); +EAPI void *ecore_ipc_client_del(Ecore_Ipc_Client *cl); +EAPI void ecore_ipc_client_data_set(Ecore_Ipc_Client *cl, const void *data); +EAPI void *ecore_ipc_client_data_get(Ecore_Ipc_Client *cl); +EAPI void ecore_ipc_client_data_size_max_set(Ecore_Ipc_Client *cl, int size); +EAPI int ecore_ipc_client_data_size_max_get(Ecore_Ipc_Client *cl); +EAPI const char *ecore_ipc_client_ip_get(Ecore_Ipc_Client *cl); +EAPI void ecore_ipc_client_flush(Ecore_Ipc_Client *cl); + +EAPI int ecore_ipc_ssl_available_get(void); +/* FIXME: need to add a callback to "ok" large ipc messages greater than */ +/* a certain size (seurity/DOS attack safety) */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/ecore/src/lib/ecore_ipc/Makefile.am b/libraries/ecore/src/lib/ecore_ipc/Makefile.am new file mode 100644 index 0000000..9cbed43 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_ipc/Makefile.am @@ -0,0 +1,29 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_con \ +-I$(top_builddir)/src/lib/ecore_ipc \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_con \ +-I$(top_srcdir)/src/lib/ecore_ipc \ +@EFL_ECORE_IPC_BUILD@ \ +@SSL_CFLAGS@ \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_ipc.la +includes_HEADERS = Ecore_Ipc.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_ipc_la_SOURCES = \ +ecore_ipc.c + +libecore_ipc_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_con/libecore_con.la \ +@SSL_LIBS@ \ +@EINA_LIBS@ + +libecore_ipc_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@ + +EXTRA_DIST = ecore_ipc_private.h diff --git a/libraries/ecore/src/lib/ecore_ipc/Makefile.in b/libraries/ecore/src/lib/ecore_ipc/Makefile.in new file mode 100644 index 0000000..189e069 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_ipc/Makefile.in @@ -0,0 +1,822 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_ipc +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_ipc_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore/libecore.la \ + $(top_builddir)/src/lib/ecore_con/libecore_con.la +am_libecore_ipc_la_OBJECTS = ecore_ipc.lo +libecore_ipc_la_OBJECTS = $(am_libecore_ipc_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_ipc_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libecore_ipc_la_LDFLAGS) $(LDFLAGS) \ + -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_ipc_la_SOURCES) +DIST_SOURCES = $(libecore_ipc_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_con \ +-I$(top_builddir)/src/lib/ecore_ipc \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_con \ +-I$(top_srcdir)/src/lib/ecore_ipc \ +@EFL_ECORE_IPC_BUILD@ \ +@SSL_CFLAGS@ \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_ipc.la +includes_HEADERS = Ecore_Ipc.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_ipc_la_SOURCES = \ +ecore_ipc.c + +libecore_ipc_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_con/libecore_con.la \ +@SSL_LIBS@ \ +@EINA_LIBS@ + +libecore_ipc_la_LDFLAGS = -no-undefined -version-info @version_info@ @release_info@ +EXTRA_DIST = ecore_ipc_private.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_ipc/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_ipc/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_ipc.la: $(libecore_ipc_la_OBJECTS) $(libecore_ipc_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_ipc_la_LINK) -rpath $(libdir) $(libecore_ipc_la_OBJECTS) $(libecore_ipc_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_ipc.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c b/libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c new file mode 100644 index 0000000..c17cadd --- /dev/null +++ b/libraries/ecore/src/lib/ecore_ipc/ecore_ipc.c @@ -0,0 +1,1591 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#ifdef HAVE_NETINET_IN_H +# include +# include +#endif + +#ifdef HAVE_WINSOCK2_H +# include +#endif + +#if USE_GNUTLS_OPENSSL +# include +#elif USE_OPENSSL +# include +#endif + +#include +#include +#include + +#include "Ecore_Ipc.h" +#include "ecore_ipc_private.h" + +#define DLT_ZERO 0 +#define DLT_ONE 1 +#define DLT_SAME 2 +#define DLT_SHL 3 +#define DLT_SHR 4 +#define DLT_ADD8 5 +#define DLT_DEL8 6 +#define DLT_ADDU8 7 +#define DLT_DELU8 8 +#define DLT_ADD16 9 +#define DLT_DEL16 10 +#define DLT_ADDU16 11 +#define DLT_DELU16 12 +#define DLT_SET 13 +#define DLT_R1 14 +#define DLT_R2 15 + +int _ecore_ipc_log_dom = -1; + +EAPI unsigned short +_ecore_ipc_swap_16(unsigned short v) +{ + unsigned char *s, t; + + s = (unsigned char *)(&v); + t = s[0]; s[0] = s[1]; s[1] = t; + return v; +} + +EAPI unsigned int +_ecore_ipc_swap_32(unsigned int v) +{ + unsigned char *s, t; + + s = (unsigned char *)(&v); + t = s[0]; s[0] = s[3]; s[3] = t; + t = s[1]; s[1] = s[2]; s[2] = t; + return v; +} + +EAPI unsigned long long +_ecore_ipc_swap_64(unsigned long long v) +{ + unsigned char *s, t; + + s = (unsigned char *)(&v); + t = s[0]; s[0] = s[7]; s[7] = t; + t = s[1]; s[1] = s[6]; s[6] = t; + t = s[2]; s[2] = s[5]; s[5] = t; + t = s[3]; s[3] = s[4]; s[4] = t; + return v; +} + +static int _ecore_ipc_dlt_int(int out, int prev, int *mode); +static int _ecore_ipc_ddlt_int(int in, int prev, int mode); + +static int +_ecore_ipc_dlt_int(int out, int prev, int *mode) +{ + int dlt; + + /* 0 byte */ + if (out == 0) + { + *mode = DLT_ZERO; + return 0; + } + if (out == (int)0xffffffff) + { + *mode = DLT_ONE; + return 0; + } + if (out == prev) + { + *mode = DLT_SAME; + return 0; + } + if (out == prev << 1) + { + *mode = DLT_SHL; + return 0; + } + if (out == prev >> 1) + { + *mode = DLT_SHR; + return 0; + } + /* 1 byte */ + dlt = out - prev; + if (!(dlt & 0xffffff00)) + { + *mode = DLT_ADD8; + return dlt & 0xff; + } + dlt = prev - out; + if (!(dlt & 0xffffff00)) + { + *mode = DLT_DEL8; + return dlt & 0xff; + } + dlt = out - prev; + if (!(dlt & 0x00ffffff)) + { + *mode = DLT_ADDU8; + return (dlt >> 24) & 0xff; + } + dlt = prev - out; + if (!(dlt & 0x00ffffff)) + { + *mode = DLT_DELU8; + return (dlt >> 24) & 0xff; + } + /* 2 byte */ + dlt = out - prev; + if (!(dlt & 0xffff0000)) + { + *mode = DLT_ADD16; + return dlt & 0xffff; + } + dlt = prev - out; + if (!(dlt & 0xffff0000)) + { + *mode = DLT_DEL16; + return dlt & 0xffff; + } + dlt = out - prev; + if (!(dlt & 0x0000ffff)) + { + *mode = DLT_ADDU16; + return (dlt >> 16) & 0xffff; + } + dlt = prev - out; + if (!(dlt & 0x0000ffff)) + { + *mode = DLT_DELU16; + return (dlt >> 16) & 0xffff; + } + /* 4 byte */ + *mode = DLT_SET; + return out; +} + +static int +_ecore_ipc_ddlt_int(int in, int prev, int mode) +{ + switch (mode) + { + case DLT_ZERO: + return 0; + break; + case DLT_ONE: + return 0xffffffff; + break; + case DLT_SAME: + return prev; + break; + case DLT_SHL: + return prev << 1; + break; + case DLT_SHR: + return prev >> 1; + break; + case DLT_ADD8: + return prev + in; + break; + case DLT_DEL8: + return prev - in; + break; + case DLT_ADDU8: + return prev + (in << 24); + break; + case DLT_DELU8: + return prev - (in << 24); + break; + case DLT_ADD16: + return prev + in; + break; + case DLT_DEL16: + return prev - in; + break; + case DLT_ADDU16: + return prev + (in << 16); + break; + case DLT_DELU16: + return prev - (in << 16); + break; + case DLT_SET: + return in; + break; + case DLT_R1: + return 0; + break; + case DLT_R2: + return 0; + break; + default: + break; + } + return 0; +} + +static Eina_Bool _ecore_ipc_event_client_add(void *data, int ev_type, void *ev); +static Eina_Bool _ecore_ipc_event_client_del(void *data, int ev_type, void *ev); +static Eina_Bool _ecore_ipc_event_server_add(void *data, int ev_type, void *ev); +static Eina_Bool _ecore_ipc_event_server_del(void *data, int ev_type, void *ev); +static Eina_Bool _ecore_ipc_event_client_data(void *data, int ev_type, void *ev); +static Eina_Bool _ecore_ipc_event_server_data(void *data, int ev_type, void *ev); +static void _ecore_ipc_event_client_add_free(void *data, void *ev); +static void _ecore_ipc_event_client_del_free(void *data, void *ev); +static void _ecore_ipc_event_client_data_free(void *data, void *ev); +static void _ecore_ipc_event_server_add_free(void *data, void *ev); +static void _ecore_ipc_event_server_del_free(void *data, void *ev); +static void _ecore_ipc_event_server_data_free(void *data, void *ev); + +EAPI int ECORE_IPC_EVENT_CLIENT_ADD = 0; +EAPI int ECORE_IPC_EVENT_CLIENT_DEL = 0; +EAPI int ECORE_IPC_EVENT_SERVER_ADD = 0; +EAPI int ECORE_IPC_EVENT_SERVER_DEL = 0; +EAPI int ECORE_IPC_EVENT_CLIENT_DATA = 0; +EAPI int ECORE_IPC_EVENT_SERVER_DATA = 0; + +static int _ecore_ipc_init_count = 0; +static Eina_List *servers = NULL; +static Ecore_Event_Handler *handler[6]; + +/** + * @defgroup Ecore_IPC_Library_Group IPC Library Functions + * + * Functions that set up and shut down the Ecore IPC Library. + */ + +/** + * Initialises the Ecore IPC library. + * @return Number of times the library has been initialised without + * being shut down. + * @ingroup Ecore_IPC_Library_Group + */ +EAPI int +ecore_ipc_init(void) +{ + int i = 0; + + if (++_ecore_ipc_init_count != 1) + return _ecore_ipc_init_count; + _ecore_ipc_log_dom = eina_log_domain_register + ("ecore_ipc", ECORE_IPC_DEFAULT_LOG_COLOR); + if(_ecore_ipc_log_dom < 0) + { + EINA_LOG_ERR("Impossible to create a log domain for the Ecore IPC module."); + return --_ecore_ipc_init_count; + } + if (!ecore_con_init()) + return --_ecore_ipc_init_count; + + ECORE_IPC_EVENT_CLIENT_ADD = ecore_event_type_new(); + ECORE_IPC_EVENT_CLIENT_DEL = ecore_event_type_new(); + ECORE_IPC_EVENT_SERVER_ADD = ecore_event_type_new(); + ECORE_IPC_EVENT_SERVER_DEL = ecore_event_type_new(); + ECORE_IPC_EVENT_CLIENT_DATA = ecore_event_type_new(); + ECORE_IPC_EVENT_SERVER_DATA = ecore_event_type_new(); + + handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, + _ecore_ipc_event_client_add, NULL); + handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, + _ecore_ipc_event_client_del, NULL); + handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, + _ecore_ipc_event_server_add, NULL); + handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, + _ecore_ipc_event_server_del, NULL); + handler[i++] = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, + _ecore_ipc_event_client_data, NULL); + handler[i] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, + _ecore_ipc_event_server_data, NULL); + return _ecore_ipc_init_count; +} + +/** + * Shuts down the Ecore IPC library. + * @return Number of times the library has been initialised without being + * shut down. + * @ingroup Ecore_IPC_Library_Group + */ +EAPI int +ecore_ipc_shutdown(void) +{ + int i; + + if (--_ecore_ipc_init_count != 0) + return _ecore_ipc_init_count; + + while (servers) ecore_ipc_server_del(eina_list_data_get(servers)); + + for (i = 0; i < 6; i++) + ecore_event_handler_del(handler[i]); + + ecore_con_shutdown(); + eina_log_domain_unregister(_ecore_ipc_log_dom); + _ecore_ipc_log_dom = -1; + return _ecore_ipc_init_count; +} + +/** + * @defgroup Ecore_IPC_Server_Group IPC Server Functions + * + * Functions the deal with IPC server objects. + */ + +/** + * Creates an IPC server that listens for connections. + * + * For more details about the @p compl_type, @p name and @p port + * parameters, see the @ref ecore_con_server_add documentation. + * + * @param compl_type The connection type. + * @param name Name to associate with the socket used for connection. + * @param port Number to identify with socket used for connection. + * @param data Data to associate with the IPC server. + * @return New IPC server. If there is an error, @c NULL is returned. + * @ingroup Ecore_IPC_Server_Group + * @todo Need to add protocol type parameter to this function. + */ +EAPI Ecore_Ipc_Server * +ecore_ipc_server_add(Ecore_Ipc_Type compl_type, const char *name, int port, const void *data) +{ + Ecore_Ipc_Server *svr; + Ecore_Ipc_Type type; + Ecore_Con_Type extra = 0; + + svr = calloc(1, sizeof(Ecore_Ipc_Server)); + if (!svr) return NULL; + type = compl_type; + type &= ~ECORE_IPC_USE_SSL; + if (compl_type & ECORE_IPC_USE_SSL) extra = ECORE_CON_USE_SSL; + switch (type) + { + case ECORE_IPC_LOCAL_USER: + svr->server = ecore_con_server_add(ECORE_CON_LOCAL_USER | extra, name, port, svr); + break; + case ECORE_IPC_LOCAL_SYSTEM: + svr->server = ecore_con_server_add(ECORE_CON_LOCAL_SYSTEM | extra, name, port, svr); + break; + case ECORE_IPC_REMOTE_SYSTEM: + svr->server = ecore_con_server_add(ECORE_CON_REMOTE_SYSTEM | extra, name, port, svr); + break; + default: + free(svr); + return NULL; + } + if (!svr->server) + { + free(svr); + return NULL; + } + svr->max_buf_size = 32 * 1024; + svr->data = (void *)data; + servers = eina_list_append(servers, svr); + ECORE_MAGIC_SET(svr, ECORE_MAGIC_IPC_SERVER); + return svr; +} + +/** + * Creates an IPC server object to represent the IPC server listening + * on the given port. + * + * For more details about the @p compl_type, @p name and @p port + * parameters, see the @ref ecore_con_server_connect documentation. + * + * @param compl_type The IPC connection type. + * @param name Name used to determine which socket to use for the + * IPC connection. + * @param port Number used to identify the socket to use for the + * IPC connection. + * @param data Data to associate with the server. + * @return A new IPC server. @c NULL is returned on error. + * @ingroup Ecore_IPC_Server_Group + * @todo Need to add protocol type parameter. + */ +EAPI Ecore_Ipc_Server * +ecore_ipc_server_connect(Ecore_Ipc_Type compl_type, char *name, int port, const void *data) +{ + Ecore_Ipc_Server *svr; + Ecore_Ipc_Type type; + Ecore_Con_Type extra = 0; + + svr = calloc(1, sizeof(Ecore_Ipc_Server)); + if (!svr) return NULL; + type = compl_type; + type &= ~ECORE_IPC_USE_SSL; + if (compl_type & ECORE_IPC_USE_SSL) extra = ECORE_CON_USE_SSL; + switch (type) + { + case ECORE_IPC_LOCAL_USER: + svr->server = ecore_con_server_connect(ECORE_CON_LOCAL_USER | extra, name, port, svr); + break; + case ECORE_IPC_LOCAL_SYSTEM: + svr->server = ecore_con_server_connect(ECORE_CON_LOCAL_SYSTEM | extra, name, port, svr); + break; + case ECORE_IPC_REMOTE_SYSTEM: + svr->server = ecore_con_server_connect(ECORE_CON_REMOTE_SYSTEM | extra, name, port, svr); + break; + default: + free(svr); + return NULL; + } + if (!svr->server) + { + free(svr); + return NULL; + } + svr->max_buf_size = -1; + svr->data = (void *)data; + servers = eina_list_append(servers, svr); + ECORE_MAGIC_SET(svr, ECORE_MAGIC_IPC_SERVER); + return svr; +} + +/** + * Closes the connection and frees the given IPC server. + * @param svr The given IPC server. + * @return The data associated with the server when it was created. + * @ingroup Ecore_IPC_Server_Group + */ +EAPI void * +ecore_ipc_server_del(Ecore_Ipc_Server *svr) +{ + void *data; + + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER, + "ecore_ipc_server_del"); + return NULL; + } + if (svr->delete_me) return NULL; + + data = svr->data; + svr->data = NULL; + svr->delete_me = 1; + if (svr->event_count == 0) + { + Ecore_Ipc_Client *cl; + + EINA_LIST_FREE(svr->clients, cl) + ecore_ipc_client_del(cl); + ecore_con_server_del(svr->server); + servers = eina_list_remove(servers, svr); + + if (svr->buf) free(svr->buf); + ECORE_MAGIC_SET(svr, ECORE_MAGIC_NONE); + free(svr); + } + return data; +} + +/** + * Retrieves the data associated with the given IPC server. + * @param svr The given IPC server. + * @return The associated data. + * @ingroup Ecore_IPC_Server_Group + */ +EAPI void * +ecore_ipc_server_data_get(Ecore_Ipc_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER, + "ecore_ipc_server_data_get"); + return NULL; + } + return svr->data; +} + +/** + * Retrieves whether the given IPC server is currently connected. + * @param svr The given IPC server. + * @return #EINA_TRUE if the server is connected. #EINA_FALSE otherwise. + * @ingroup Ecore_IPC_Server_Group + */ +EAPI Eina_Bool +ecore_ipc_server_connected_get(Ecore_Ipc_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER, + "ecore_ipc_server_connected_get"); + return EINA_FALSE; + } + return ecore_con_server_connected_get(svr->server); +} + +/** + * Retrieves the list of clients for this server. + * @param svr The given IPC server. + * @return An Eina_List with the clients. + * @ingroup Ecore_IPC_Server_Group + */ +EAPI Eina_List * +ecore_ipc_server_clients_get(Ecore_Ipc_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER, + "ecore_ipc_server_clients_get"); + return NULL; + } + return svr->client_list; +} + +#define SVENC(_member) \ + d = _ecore_ipc_dlt_int(msg._member, svr->prev.o._member, &md); \ + if (md >= DLT_SET) \ + { \ + unsigned int v; \ + unsigned char *dd; \ + dd = (unsigned char *)&v; \ + v = d; \ + v = htonl(v); \ + *(dat + s + 0) = dd[0]; \ + *(dat + s + 1) = dd[1]; \ + *(dat + s + 2) = dd[2]; \ + *(dat + s + 3) = dd[3]; \ + s += 4; \ + } \ + else if (md >= DLT_ADD16) \ + { \ + unsigned short v; \ + unsigned char *dd; \ + dd = (unsigned char *)&v; \ + v = d; \ + v = htons(v); \ + *(dat + s + 0) = dd[0]; \ + *(dat + s + 1) = dd[1]; \ + s += 2; \ + } \ + else if (md >= DLT_ADD8) \ + { \ + *(dat + s + 0) = (unsigned char)d; \ + s += 1; \ + } + +/** + * Sends a message to the given IPC server. + * + * The content of the parameters, excluding the @p svr paramter, is up to + * the client. + * + * @param svr The given IPC server. + * @param major Major opcode of the message. + * @param minor Minor opcode of the message. + * @param ref Message reference number. + * @param ref_to Reference number of the message this message refers to. + * @param response Requires response. + * @param data The data to send as part of the message. + * @param size Length of the data, in bytes, to send. + * @return Number of bytes sent. @c 0 is returned if there is an error. + * @ingroup Ecore_IPC_Server_Group + * @todo This function needs to become an IPC message. + * @todo Fix up the documentation: Make sure what ref_to and response are. + */ +EAPI int +ecore_ipc_server_send(Ecore_Ipc_Server *svr, int major, int minor, int ref, int ref_to, int response, const void *data, int size) +{ + Ecore_Ipc_Msg_Head msg; + int ret; + int *head, md = 0, d, s; + unsigned char dat[sizeof(Ecore_Ipc_Msg_Head)]; + + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER, + "ecore_ipc_server_send"); + return 0; + } + if (size < 0) size = 0; + msg.major = major; + msg.minor = minor; + msg.ref = ref; + msg.ref_to = ref_to; + msg.response = response; + msg.size = size; + head = (int *)dat; + s = 4; + SVENC(major); + *head = md; + SVENC(minor); + *head |= md << (4 * 1); + SVENC(ref); + *head |= md << (4 * 2); + SVENC(ref_to); + *head |= md << (4 * 3); + SVENC(response); + *head |= md << (4 * 4); + SVENC(size); + *head |= md << (4 * 5); + *head = htonl(*head); + svr->prev.o = msg; + ret = ecore_con_server_send(svr->server, dat, s); + if (size > 0) ret += ecore_con_server_send(svr->server, data, size); + return ret; +} + +/** + * Sets a limit on the number of clients that can be handled concurrently + * by the given server, and a policy on what to do if excess clients try to + * connect. + * Beware that if you set this once ecore is already running, you may + * already have pending CLIENT_ADD events in your event queue. Those + * clients have already connected and will not be affected by this call. + * Only clients subsequently trying to connect will be affected. + * @param svr The given server. + * @param client_limit The maximum number of clients to handle + * concurrently. -1 means unlimited (default). 0 + * effectively disables the server. + * @param reject_excess_clients Set to 1 to automatically disconnect + * excess clients as soon as they connect if you are + * already handling client_limit clients. Set to 0 + * (default) to just hold off on the "accept()" + * system call until the number of active clients + * drops. This causes the kernel to queue up to 4096 + * connections (or your kernel's limit, whichever is + * lower). + * @ingroup Ecore_Ipc_Server_Group + */ +EAPI void +ecore_ipc_server_client_limit_set(Ecore_Ipc_Server *svr, int client_limit, char reject_excess_clients) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER, + "ecore_ipc_server_client_limit_set"); + return; + } + ecore_con_server_client_limit_set(svr->server, client_limit, reject_excess_clients); +} + +/** + * Sets the max data payload size for an Ipc message in bytes + * + * @param svr The given server. + * @param size The maximum data payload size in bytes. + * @ingroup Ecore_Ipc_Server_Group + */ +EAPI void +ecore_ipc_server_data_size_max_set(Ecore_Ipc_Server *svr, int size) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER, + "ecore_ipc_server_data_size_max_set"); + return; + } + svr->max_buf_size = size; +} + +/** + * Gets the max data payload size for an Ipc message in bytes + * + * @param svr The given server. + * @return The maximum data payload in bytes. + * @ingroup Ecore_Ipc_Server_Group + */ +EAPI int +ecore_ipc_server_data_size_max_get(Ecore_Ipc_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER, + "ecore_ipc_server_data_size_max_get"); + return -1; + } + return svr->max_buf_size; +} + +/** + * Gets the IP address of a server that has been connected to. + * + * @param svr The given server. + * @return A pointer to an internal string that contains the IP address of + * the connected server in the form "XXX.YYY.ZZZ.AAA" IP notation. + * This string should not be modified or trusted to stay valid after + * deletion for the @p svr object. If no IP is known NULL is returned. + * @ingroup Ecore_Ipc_Server_Group + */ +EAPI const char * +ecore_ipc_server_ip_get(Ecore_Ipc_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER, + "ecore_ipc_server_ip_get"); + return NULL; + } + return ecore_con_server_ip_get(svr->server); +} + +/** + * Flushes all pending data to the given server. Will return when done. + * + * @param svr The given server. + * @ingroup Ecore_Ipc_Server_Group + */ +EAPI void +ecore_ipc_server_flush(Ecore_Ipc_Server *svr) +{ + if (!ECORE_MAGIC_CHECK(svr, ECORE_MAGIC_IPC_SERVER)) + { + ECORE_MAGIC_FAIL(svr, ECORE_MAGIC_IPC_SERVER, + "ecore_ipc_server_server_flush"); + return; + } + ecore_con_server_flush(svr->server); +} + +#define CLENC(_member) \ + d = _ecore_ipc_dlt_int(msg._member, cl->prev.o._member, &md); \ + if (md >= DLT_SET) \ + { \ + unsigned int v; \ + unsigned char *dd; \ + dd = (unsigned char *)&v; \ + v = d; \ + v = htonl(v); \ + *(dat + s + 0) = dd[0]; \ + *(dat + s + 1) = dd[1]; \ + *(dat + s + 2) = dd[2]; \ + *(dat + s + 3) = dd[3]; \ + s += 4; \ + } \ + else if (md >= DLT_ADD16) \ + { \ + unsigned short v; \ + unsigned char *dd; \ + dd = (unsigned char *)&v; \ + v = d; \ + v = htons(v); \ + *(dat + s + 0) = dd[0]; \ + *(dat + s + 1) = dd[1]; \ + s += 2; \ + } \ + else if (md >= DLT_ADD8) \ + { \ + *(dat + s) = (unsigned char)d; \ + s += 1; \ + } + +/** + * @defgroup Ecore_IPC_Client_Group IPC Client Functions + * + * Functions that deal with IPC client objects. + */ + +/** + * Sends a message to the given IPC client. + * @param cl The given IPC client. + * @param major Major opcode of the message. + * @param minor Minor opcode of the message. + * @param ref Reference number of the message. + * @param ref_to Reference number of the message this message refers to. + * @param response Requires response. + * @param data The data to send as part of the message. + * @param size Length of the data, in bytes, to send. + * @return The number of bytes sent. @c 0 will be returned if there is + * an error. + * @ingroup Ecore_IPC_Client_Group + * @todo This function needs to become an IPC message. + * @todo Make sure ref_to and response parameters are described correctly. + */ +EAPI int +ecore_ipc_client_send(Ecore_Ipc_Client *cl, int major, int minor, int ref, int ref_to, int response, const void *data, int size) +{ + Ecore_Ipc_Msg_Head msg; + int ret; + int *head, md = 0, d, s; + unsigned char dat[sizeof(Ecore_Ipc_Msg_Head)]; + + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT, + "ecore_ipc_client_send"); + return 0; + } + if (size < 0) size = 0; + msg.major = major; + msg.minor = minor; + msg.ref = ref; + msg.ref_to = ref_to; + msg.response = response; + msg.size = size; + head = (int *)dat; + s = 4; + CLENC(major); + *head = md; + CLENC(minor); + *head |= md << (4 * 1); + CLENC(ref); + *head |= md << (4 * 2); + CLENC(ref_to); + *head |= md << (4 * 3); + CLENC(response); + *head |= md << (4 * 4); + CLENC(size); + *head |= md << (4 * 5); + *head = htonl(*head); + cl->prev.o = msg; + ret = ecore_con_client_send(cl->client, dat, s); + if (size > 0) ret += ecore_con_client_send(cl->client, data, size); + return ret; +} + +/** + * Retrieves the IPC server that the given IPC client is connected to. + * @param cl The given IPC client. + * @return The IPC server the IPC client is connected to. + * @ingroup Ecore_IPC_Client_Group + */ +EAPI Ecore_Ipc_Server * +ecore_ipc_client_server_get(Ecore_Ipc_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT, + "ecore_ipc_client_server_get"); + return NULL; + } + return (ecore_con_server_data_get(ecore_con_client_server_get(cl->client))); +} + +/** + * Closes the connection and frees memory allocated to the given IPC + * client. + * @param cl The given client. + * @return Data associated with the client. + * @ingroup Ecore_IPC_Client_Group + */ +EAPI void * +ecore_ipc_client_del(Ecore_Ipc_Client *cl) +{ + void *data; + Ecore_Ipc_Server *svr; + + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT, + "ecore_ipc_client_del"); + return NULL; + } + data = cl->data; + cl->data = NULL; + cl->delete_me = 1; + if (cl->event_count == 0) + { + svr = ecore_con_server_data_get(ecore_con_client_server_get(cl->client)); + ecore_con_client_del(cl->client); + svr->clients = eina_list_remove(svr->clients, cl); + if (cl->buf) free(cl->buf); + ECORE_MAGIC_SET(cl, ECORE_MAGIC_NONE); + free(cl); + } + return data; +} + +/** + * Sets the IPC data associated with the given IPC client to @p data. + * @param cl The given IPC client. + * @param data The data to associate with the IPC client. + * @ingroup Ecore_IPC_Client_Group + */ +EAPI void +ecore_ipc_client_data_set(Ecore_Ipc_Client *cl, const void *data) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT, + "ecore_ipc_client_data_set"); + return; + } + cl->data = (void *)data; +} + +/** + * Retrieves the data that has been associated with the given IPC client. + * @param cl The given client. + * @return The data associated with the IPC client. + * @ingroup Ecore_IPC_Client_Group + */ +EAPI void * +ecore_ipc_client_data_get(Ecore_Ipc_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT, + "ecore_ipc_client_data_get"); + return NULL; + } + return cl->data; +} + +/** + * Sets the max data payload size for an Ipc message in bytes + * + * @param client The given client. + * @param size The maximum data payload size in bytes. + * @ingroup Ecore_Ipc_Client_Group + */ +EAPI void +ecore_ipc_client_data_size_max_set(Ecore_Ipc_Client *cl, int size) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT, + "ecore_ipc_client_data_size_max_set"); + return; + } + cl->max_buf_size = size; +} + +/** + * Sets the max data payload size for an Ipc message in bytes + * + * @param cl The given client. + * @param size The maximum data payload size in bytes. + * @ingroup Ecore_Ipc_Client_Group + */ +EAPI int +ecore_ipc_client_data_size_max_get(Ecore_Ipc_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT, + "ecore_ipc_client_data_size_max_get"); + return -1; + } + return cl->max_buf_size; +} + +/** + * Gets the IP address of a client that has been connected to. + * + * @param cl The given client. + * @return A pointer to an internal string that contains the IP address of + * the connected server in the form "XXX.YYY.ZZZ.AAA" IP notation. + * This string should not be modified or trusted to stay valid after + * deletion for the @p cl object. If no IP is known NULL is returned. + * @ingroup Ecore_Ipc_Client_Group + */ +EAPI const char * +ecore_ipc_client_ip_get(Ecore_Ipc_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT, + "ecore_ipc_client_ip_get"); + return NULL; + } + return ecore_con_client_ip_get(cl->client); +} + +/** + * Flushes all pending data to the given client. Will return when done. + * + * @param cl The given client. + * @ingroup Ecore_Ipc_Client_Group + */ +EAPI void +ecore_ipc_client_flush(Ecore_Ipc_Client *cl) +{ + if (!ECORE_MAGIC_CHECK(cl, ECORE_MAGIC_IPC_CLIENT)) + { + ECORE_MAGIC_FAIL(cl, ECORE_MAGIC_IPC_CLIENT, + "ecore_ipc_client_flush"); + return; + } + ecore_con_client_flush(cl->client); +} + +/** + * Returns if SSL support is available + * @return 1 if SSL is available, 0 if it is not. + * @ingroup Ecore_Con_Client_Group + */ +EAPI int +ecore_ipc_ssl_available_get(void) +{ + return ecore_con_ssl_available_get(); +} + + +static Eina_Bool +_ecore_ipc_event_client_add(void *data __UNUSED__, int ev_type __UNUSED__, void *ev) +{ + Ecore_Con_Event_Client_Add *e; + + e = ev; + if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return ECORE_CALLBACK_RENEW; + /* handling code here */ + { + Ecore_Ipc_Client *cl; + Ecore_Ipc_Server *svr; + + cl = calloc(1, sizeof(Ecore_Ipc_Client)); + if (!cl) return ECORE_CALLBACK_CANCEL; + svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client)); + ECORE_MAGIC_SET(cl, ECORE_MAGIC_IPC_CLIENT); + cl->client = e->client; + cl->max_buf_size = 32 * 1024; + ecore_con_client_data_set(cl->client, (void *)cl); + svr->clients = eina_list_append(svr->clients, cl); + svr->client_list = eina_list_append(svr->client_list, cl); + if (!cl->delete_me) + { + Ecore_Ipc_Event_Client_Add *e2; + + e2 = calloc(1, sizeof(Ecore_Ipc_Event_Client_Add)); + if (e2) + { + cl->event_count++; + e2->client = cl; + ecore_event_add(ECORE_IPC_EVENT_CLIENT_ADD, e2, + _ecore_ipc_event_client_add_free, NULL); + } + } + } + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_ecore_ipc_event_client_del(void *data __UNUSED__, int ev_type __UNUSED__, void *ev) +{ + Ecore_Con_Event_Client_Del *e; + + e = ev; + if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return ECORE_CALLBACK_RENEW; + /* handling code here */ + { + Ecore_Ipc_Client *cl; + + cl = ecore_con_client_data_get(e->client); + { + Ecore_Ipc_Event_Client_Del *e2; + Ecore_Ipc_Server *svr; + + svr = ecore_con_server_data_get(ecore_con_client_server_get(e->client)); + svr->client_list = eina_list_remove(svr->client_list, cl); + if (!cl->delete_me) + { + e2 = calloc(1, sizeof(Ecore_Ipc_Event_Client_Del)); + if (e2) + { + cl->event_count++; + e2->client = cl; + ecore_event_add(ECORE_IPC_EVENT_CLIENT_DEL, e2, + _ecore_ipc_event_client_del_free, NULL); + } + } + } + } + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_ecore_ipc_event_server_add(void *data __UNUSED__, int ev_type __UNUSED__, void *ev) +{ + Ecore_Con_Event_Server_Add *e; + + e = ev; + if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return ECORE_CALLBACK_RENEW; + /* handling code here */ + { + Ecore_Ipc_Server *svr; + + svr = ecore_con_server_data_get(e->server); + if (!svr->delete_me) + { + Ecore_Ipc_Event_Server_Add *e2; + + e2 = calloc(1, sizeof(Ecore_Ipc_Event_Server_Add)); + if (e2) + { + svr->event_count++; + e2->server = svr; + ecore_event_add(ECORE_IPC_EVENT_SERVER_ADD, e2, + _ecore_ipc_event_server_add_free, NULL); + } + } + } + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_ecore_ipc_event_server_del(void *data __UNUSED__, int ev_type __UNUSED__, void *ev) +{ + Ecore_Con_Event_Server_Del *e; + + e = ev; + if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return ECORE_CALLBACK_RENEW; + /* handling code here */ + { + Ecore_Ipc_Server *svr; + + svr = ecore_con_server_data_get(e->server); + if (!svr->delete_me) + { + Ecore_Ipc_Event_Server_Del *e2; + + e2 = calloc(1, sizeof(Ecore_Ipc_Event_Server_Del)); + if (e2) + { + svr->event_count++; + e2->server = svr; + ecore_event_add(ECORE_IPC_EVENT_SERVER_DEL, e2, + _ecore_ipc_event_server_del_free, NULL); + } + } + } + return ECORE_CALLBACK_CANCEL; +} + +#define CLSZ(_n) \ + md = ((head >> (4 * _n)) & 0xf); \ + if (md >= DLT_SET) s += 4; \ + else if (md >= DLT_ADD16) s += 2; \ + else if (md >= DLT_ADD8) s += 1; + +#define CLDEC(_n, _member) \ + md = ((head >> (4 * _n)) & 0xf); \ + if (md >= DLT_SET) \ + { \ + unsigned int v; \ + unsigned char *dv; \ + dv = (unsigned char *)&v; \ + dv[0] = *(cl->buf + offset + s + 0); \ + dv[1] = *(cl->buf + offset + s + 1); \ + dv[2] = *(cl->buf + offset + s + 2); \ + dv[3] = *(cl->buf + offset + s + 3); \ + d = (int)ntohl(v); \ + s += 4; \ + } \ + else if (md >= DLT_ADD16) \ + { \ + unsigned short v; \ + unsigned char *dv; \ + dv = (unsigned char *)&v; \ + dv[0] = *(cl->buf + offset + s + 0); \ + dv[1] = *(cl->buf + offset + s + 1); \ + d = (int)ntohs(v); \ + s += 2; \ + } \ + else if (md >= DLT_ADD8) \ + { \ + unsigned char v; \ + unsigned char *dv; \ + dv = (unsigned char *)&v; \ + dv[0] = *(cl->buf + offset + s + 0); \ + d = (int)v; \ + s += 1; \ + } \ + msg._member = _ecore_ipc_ddlt_int(d, cl->prev.i._member, md); + +static Eina_Bool +_ecore_ipc_event_client_data(void *data __UNUSED__, int ev_type __UNUSED__, void *ev) +{ + Ecore_Con_Event_Client_Data *e; + + e = ev; + if (!eina_list_data_find(servers, ecore_con_server_data_get(ecore_con_client_server_get(e->client)))) return ECORE_CALLBACK_RENEW; + /* handling code here */ + { + Ecore_Ipc_Client *cl; + Ecore_Ipc_Msg_Head msg; + int offset = 0; + unsigned char *buf; + + cl = ecore_con_client_data_get(e->client); + + if (!cl->buf) + { + cl->buf_size = e->size; + cl->buf = e->data; + e->data = NULL; /* take it out of the old event */ + } + else + { + buf = realloc(cl->buf, cl->buf_size + e->size); + if (!buf) + { + free(cl->buf); + cl->buf = 0; + cl->buf_size = 0; + return ECORE_CALLBACK_CANCEL; + } + cl->buf = buf; + memcpy(cl->buf + cl->buf_size, e->data, e->size); + cl->buf_size += e->size; + } + /* examine header */ + redo: + if ((cl->buf_size - offset) >= (int)sizeof(int)) + { + int s, md, d = 0, head; + unsigned char *dd; + + dd = (unsigned char *)&head; + dd[0] = *(cl->buf + offset + 0); + dd[1] = *(cl->buf + offset + 1); + dd[2] = *(cl->buf + offset + 2); + dd[3] = *(cl->buf + offset + 3); + head = ntohl(head); + dd = (unsigned char *)&d; + s = 4; + CLSZ(0); + CLSZ(1); + CLSZ(2); + CLSZ(3); + CLSZ(4); + CLSZ(5); + if ((cl->buf_size - offset) < s) + { + if (offset > 0) goto scroll; + return ECORE_CALLBACK_CANCEL; + } + + s = 4; + CLDEC(0, major); + CLDEC(1, minor); + CLDEC(2, ref); + CLDEC(3, ref_to); + CLDEC(4, response); + CLDEC(5, size); + if (msg.size < 0) msg.size = 0; + /* there is enough data in the buffer for a full message */ + if ((cl->buf_size - offset) >= (s + msg.size)) + { + Ecore_Ipc_Event_Client_Data *e2; + Ecore_Ipc_Server *svr; + int max, max2; + + buf = NULL; + svr = ecore_con_server_data_get(ecore_con_client_server_get(cl->client)); + max = svr->max_buf_size; + max2 = cl->max_buf_size; + if ((max >= 0) && (max2 >= 0)) + { + if (max2 < max) max = max2; + } + else + { + if (max < 0) max = max2; + } + if ((max < 0) || (msg.size <= max)) + { + if (msg.size > 0) + { + buf = malloc(msg.size); + if (!buf) return ECORE_CALLBACK_CANCEL; + memcpy(buf, cl->buf + offset + s, msg.size); + } + if (!cl->delete_me) + { + e2 = calloc(1, sizeof(Ecore_Ipc_Event_Client_Data)); + if (e2) + { + cl->event_count++; + e2->client = cl; + e2->major = msg.major; + e2->minor = msg.minor; + e2->ref = msg.ref; + e2->ref_to = msg.ref_to; + e2->response = msg.response; + e2->size = msg.size; + e2->data = buf; + ecore_event_add(ECORE_IPC_EVENT_CLIENT_DATA, e2, + _ecore_ipc_event_client_data_free, + NULL); + } + } + } + cl->prev.i = msg; + offset += (s + msg.size); + if (cl->buf_size == offset) + { + free(cl->buf); + cl->buf = NULL; + cl->buf_size = 0; + return ECORE_CALLBACK_CANCEL; + } + goto redo; + } + else goto scroll; + } + else + { + scroll: + buf = malloc(cl->buf_size - offset); + if (!buf) + { + free(cl->buf); + cl->buf = NULL; + cl->buf_size = 0; + return ECORE_CALLBACK_CANCEL; + } + memcpy(buf, cl->buf + offset, cl->buf_size - offset); + free(cl->buf); + cl->buf = buf; + cl->buf_size -= offset; + } + } + return ECORE_CALLBACK_CANCEL; +} + +#define SVSZ(_n) \ + md = ((head >> (4 * _n)) & 0xf); \ + if (md >= DLT_SET) s += 4; \ + else if (md >= DLT_ADD16) s += 2; \ + else if (md >= DLT_ADD8) s += 1; + +#define SVDEC(_n, _member) \ + md = ((head >> (4 * _n)) & 0xf); \ + if (md >= DLT_SET) \ + { \ + unsigned int v; \ + unsigned char *dv; \ + dv = (unsigned char *)&v; \ + dv[0] = *(svr->buf + offset + s + 0); \ + dv[1] = *(svr->buf + offset + s + 1); \ + dv[2] = *(svr->buf + offset + s + 2); \ + dv[3] = *(svr->buf + offset + s + 3); \ + d = (int)ntohl(v); \ + s += 4; \ + } \ + else if (md >= DLT_ADD16) \ + { \ + unsigned short v; \ + unsigned char *dv; \ + dv = (unsigned char *)&v; \ + dv[0] = *(svr->buf + offset + s + 0); \ + dv[1] = *(svr->buf + offset + s + 1); \ + d = (int)ntohs(v); \ + s += 2; \ + } \ + else if (md >= DLT_ADD8) \ + { \ + unsigned char v; \ + unsigned char *dv; \ + dv = (unsigned char *)&v; \ + dv[0] = *(svr->buf + offset + s + 0); \ + d = (int)v; \ + s += 1; \ + } \ + msg._member = _ecore_ipc_ddlt_int(d, svr->prev.i._member, md); + +static Eina_Bool +_ecore_ipc_event_server_data(void *data __UNUSED__, int ev_type __UNUSED__, void *ev) +{ + Ecore_Con_Event_Server_Data *e; + + e = ev; + if (!eina_list_data_find(servers, ecore_con_server_data_get(e->server))) return ECORE_CALLBACK_RENEW; + /* handling code here */ + { + Ecore_Ipc_Server *svr; + Ecore_Ipc_Msg_Head msg; + int offset = 0; + unsigned char *buf; + + svr = ecore_con_server_data_get(e->server); + + if (!svr->buf) + { + svr->buf_size = e->size; + svr->buf = e->data; + e->data = NULL; /* take it out of the old event */ + } + else + { + buf = realloc(svr->buf, svr->buf_size + e->size); + if (!buf) + { + free(svr->buf); + svr->buf = 0; + svr->buf_size = 0; + return ECORE_CALLBACK_CANCEL; + } + svr->buf = buf; + memcpy(svr->buf + svr->buf_size, e->data, e->size); + svr->buf_size += e->size; + } + /* examine header */ + redo: + if ((svr->buf_size - offset) >= (int)sizeof(int)) + { + int s, md, d = 0, head; + unsigned char *dd; + + dd = (unsigned char *)&head; + dd[0] = *(svr->buf + offset + 0); + dd[1] = *(svr->buf + offset + 1); + dd[2] = *(svr->buf + offset + 2); + dd[3] = *(svr->buf + offset + 3); + head = ntohl(head); + dd = (unsigned char *)&d; + s = 4; + SVSZ(0); + SVSZ(1); + SVSZ(2); + SVSZ(3); + SVSZ(4); + SVSZ(5); + if ((svr->buf_size - offset) < s) + { + if (offset > 0) goto scroll; + return ECORE_CALLBACK_CANCEL; + } + + s = 4; + SVDEC(0, major); + SVDEC(1, minor); + SVDEC(2, ref); + SVDEC(3, ref_to); + SVDEC(4, response); + SVDEC(5, size); + if (msg.size < 0) msg.size = 0; + /* there is enough data in the buffer for a full message */ + if ((svr->buf_size - offset) >= (s + msg.size)) + { + Ecore_Ipc_Event_Server_Data *e2; + int max; + + buf = NULL; + max = svr->max_buf_size; + if ((max < 0) || (msg.size <= max)) + { + if (msg.size > 0) + { + buf = malloc(msg.size); + if (!buf) return ECORE_CALLBACK_CANCEL; + memcpy(buf, svr->buf + offset + s, msg.size); + } + if (!svr->delete_me) + { + e2 = calloc(1, sizeof(Ecore_Ipc_Event_Server_Data)); + if (e2) + { + svr->event_count++; + e2->server = svr; + e2->major = msg.major; + e2->minor = msg.minor; + e2->ref = msg.ref; + e2->ref_to = msg.ref_to; + e2->response = msg.response; + e2->size = msg.size; + e2->data = buf; + ecore_event_add(ECORE_IPC_EVENT_SERVER_DATA, e2, + _ecore_ipc_event_server_data_free, + NULL); + } + } + } + svr->prev.i = msg; + offset += (s + msg.size); + if (svr->buf_size == offset) + { + free(svr->buf); + svr->buf = NULL; + svr->buf_size = 0; + return ECORE_CALLBACK_CANCEL; + } + goto redo; + } + else goto scroll; + } + else + { + scroll: + buf = malloc(svr->buf_size - offset); + if (!buf) + { + free(svr->buf); + svr->buf = NULL; + svr->buf_size = 0; + return ECORE_CALLBACK_CANCEL; + } + memcpy(buf, svr->buf + offset, svr->buf_size - offset); + free(svr->buf); + svr->buf = buf; + svr->buf_size -= offset; + } + } + return ECORE_CALLBACK_CANCEL; +} + +static void +_ecore_ipc_event_client_add_free(void *data __UNUSED__, void *ev) +{ + Ecore_Ipc_Event_Client_Add *e; + + e = ev; + e->client->event_count--; + if ((e->client->event_count == 0) && (e->client->delete_me)) + ecore_ipc_client_del(e->client); + free(e); +} + +static void +_ecore_ipc_event_client_del_free(void *data __UNUSED__, void *ev) +{ + Ecore_Ipc_Event_Client_Del *e; + + e = ev; + e->client->event_count--; + if ((e->client->event_count == 0) && (e->client->delete_me)) + ecore_ipc_client_del(e->client); + free(e); +} + +static void +_ecore_ipc_event_client_data_free(void *data __UNUSED__, void *ev) +{ + Ecore_Ipc_Event_Client_Data *e; + + e = ev; + e->client->event_count--; + if (e->data) free(e->data); + if ((e->client->event_count == 0) && (e->client->delete_me)) + ecore_ipc_client_del(e->client); + free(e); +} + +static void +_ecore_ipc_event_server_add_free(void *data __UNUSED__, void *ev) +{ + Ecore_Ipc_Event_Server_Add *e; + + e = ev; + e->server->event_count--; + if ((e->server->event_count == 0) && (e->server->delete_me)) + ecore_ipc_server_del(e->server); + free(e); +} + +static void +_ecore_ipc_event_server_del_free(void *data __UNUSED__, void *ev) +{ + Ecore_Ipc_Event_Server_Add *e; + + e = ev; + e->server->event_count--; + if ((e->server->event_count == 0) && (e->server->delete_me)) + ecore_ipc_server_del(e->server); + free(e); +} + +static void +_ecore_ipc_event_server_data_free(void *data __UNUSED__, void *ev) +{ + Ecore_Ipc_Event_Server_Data *e; + + e = ev; + if (e->data) free(e->data); + e->server->event_count--; + if ((e->server->event_count == 0) && (e->server->delete_me)) + ecore_ipc_server_del(e->server); + free(e); +} diff --git a/libraries/ecore/src/lib/ecore_ipc/ecore_ipc_private.h b/libraries/ecore/src/lib/ecore_ipc/ecore_ipc_private.h new file mode 100644 index 0000000..57f7849 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_ipc/ecore_ipc_private.h @@ -0,0 +1,104 @@ +#ifndef _ECORE_IPC_PRIVATE_H +#define _ECORE_IPC_PRIVATE_H + + +extern int _ecore_ipc_log_dom; + +#ifdef ECORE_IPC_DEFAULT_LOG_COLOR +# undef ECORE_IPC_DEFAULT_LOG_COLOR +#endif +#define ECORE_IPC_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_ecore_ipc_log_dom, __VA_ARGS__) + +#ifdef DBG +# undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_ecore_ipc_log_dom, __VA_ARGS__) + +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_ecore_ipc_log_dom, __VA_ARGS__) + +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_ecore_ipc_log_dom, __VA_ARGS__) + +#ifdef CRIT +# undef CRIT +#endif +#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_ipc_log_dom, __VA_ARGS__) + +#define ECORE_MAGIC_IPC_SERVER 0x87786556 +#define ECORE_MAGIC_IPC_CLIENT 0x78875665 + +typedef struct _Ecore_Ipc_Msg_Head Ecore_Ipc_Msg_Head; + + +#if defined (_MSC_VER) || (defined (__SUNPRO_C) && __SUNPRO_C < 0x5100) +# pragma pack(1) +# define ECORE_IPC_STRUCT_PACKED +#elif defined (__GNUC__) || (defined (__SUNPRO_C) && __SUNPRO_C >= 0x5100) +# define ECORE_IPC_STRUCT_PACKED __attribute__((packed)) +#else +# define ECORE_IPC_STRUCT_PACKED +#endif + +#ifdef __sgi +#pragma pack 4 +#endif +struct _Ecore_Ipc_Msg_Head +{ + int major; + int minor; + int ref; + int ref_to; + int response; + int size; +} ECORE_IPC_STRUCT_PACKED; +#ifdef __sgi +#pragma pack 0 +#endif + +struct _Ecore_Ipc_Client +{ + ECORE_MAGIC; + Ecore_Con_Client *client; + void *data; + unsigned char *buf; + int buf_size; + int max_buf_size; + + struct { + Ecore_Ipc_Msg_Head i, o; + } prev; + + int event_count; + char delete_me : 1; +}; + +struct _Ecore_Ipc_Server +{ + ECORE_MAGIC; + Ecore_Con_Server *server; + Eina_List *clients; + Eina_List *client_list; + void *data; + unsigned char *buf; + int buf_size; + int max_buf_size; + + struct { + Ecore_Ipc_Msg_Head i, o; + } prev; + + int event_count; + char delete_me : 1; +}; + +#endif diff --git a/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h b/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h new file mode 100644 index 0000000..39331f7 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght.h @@ -0,0 +1,124 @@ +#ifndef _ECORE_PSL1GHT_H +#define _ECORE_PSL1GHT_H + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +#else +# define EAPI +#endif + +/** + * @file + * @brief Ecore PSL1GHT system functions. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +EAPI extern int ECORE_PSL1GHT_EVENT_KEY_MODIFIERS; +EAPI extern int ECORE_PSL1GHT_EVENT_GOT_FOCUS; +EAPI extern int ECORE_PSL1GHT_EVENT_LOST_FOCUS; +EAPI extern int ECORE_PSL1GHT_EVENT_EXPOSE; + +typedef struct _Ecore_Psl1ght_Event_Key_Modifiers Ecore_Psl1ght_Event_Key_Modifiers; +struct _Ecore_Psl1ght_Event_Key_Modifiers /** PSL1GHT Key Modifier event */ +{ + unsigned int timestamp; + unsigned int modifiers; + int shift_changed : 1; + int shift : 1; + int alt_changed : 1; + int alt : 1; + int ctrl_changed : 1; + int ctrl : 1; + int win_changed : 1; + int win : 1; + int num_lock_changed : 1; + int num_lock : 1; + int caps_lock_changed : 1; + int caps_lock : 1; + int scroll_lock_changed : 1; + int scroll_lock : 1; +}; + +typedef struct _Ecore_Psl1ght_Event_Key_Down Ecore_Psl1ght_Event_Key_Down; +struct _Ecore_Psl1ght_Event_Key_Down /** PSL1GHT Key Down event */ +{ + const char *keyname; /**< The name of the key that was pressed */ + const char *keycompose; /**< The UTF-8 string conversion if any */ + unsigned int time; +}; + +typedef struct _Ecore_Psl1ght_Event_Key_Up Ecore_Psl1ght_Event_Key_Up; +struct _Ecore_Psl1ght_Event_Key_Up /** PSL1GHT Key Up event */ +{ + const char *keyname; /**< The name of the key that was released */ + const char *keycompose; /**< The UTF-8 string conversion if any */ + unsigned int time; +}; + +typedef struct _Ecore_Psl1ght_Event_Mouse_Button_Down Ecore_Psl1ght_Event_Mouse_Button_Down; +struct _Ecore_Psl1ght_Event_Mouse_Button_Down /** PSL1GHT Mouse Down event */ +{ + int button; /**< Mouse button that was pressed (1 - 32) */ + int x; /**< Mouse co-ordinates when mouse button was pressed */ + int y; /**< Mouse co-ordinates when mouse button was pressed */ + int double_click : 1; /**< Set if click was a double click */ + int triple_click : 1; /**< Set if click was a triple click */ + unsigned int time; +}; + +typedef struct _Ecore_Psl1ght_Event_Mouse_Button_Up Ecore_Psl1ght_Event_Mouse_Button_Up; +struct _Ecore_Psl1ght_Event_Mouse_Button_Up /** PSL1GHT Mouse Up event */ +{ + int button; /**< Mouse button that was released (1 - 32) */ + int x; /**< Mouse co-ordinates when mouse button was raised */ + int y; /**< Mouse co-ordinates when mouse button was raised */ + int double_click : 1; /**< Set if click was a double click */ + int triple_click : 1; /**< Set if click was a triple click */ + unsigned int time; +}; + +typedef struct _Ecore_Psl1ght_Event_Mouse_Move Ecore_Psl1ght_Event_Mouse_Move; +struct _Ecore_Psl1ght_Event_Mouse_Move /** PSL1GHT Mouse Move event */ +{ + int x; /**< Mouse co-ordinates where the mouse cursor moved to */ + int y; /**< Mouse co-ordinates where the mouse cursor moved to */ + unsigned int time; +}; + +typedef struct _Ecore_Psl1ght_Event_Mouse_Wheel Ecore_Psl1ght_Event_Mouse_Wheel; +struct _Ecore_Psl1ght_Event_Mouse_Wheel /** PSL1GHT Mouse Wheel event */ +{ + int x, y; + int direction; /* 0 = vertical, 1 = horizontal */ + int wheel; /* value 1 (left/up), -1 (right/down) */ + unsigned int time; +}; + +EAPI int + ecore_psl1ght_init(const char *name); +EAPI int + ecore_psl1ght_shutdown(void); +EAPI void + ecore_psl1ght_resolution_set(int width, int height); +EAPI void + ecore_psl1ght_poll_events(void); + +EAPI void ecore_psl1ght_screen_resolution_get(int *w, int *h); +EAPI void ecore_psl1ght_optimal_screen_resolution_get(int *w, int *h); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght_Keys.h b/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght_Keys.h new file mode 100644 index 0000000..e385af8 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_psl1ght/Ecore_Psl1ght_Keys.h @@ -0,0 +1,78 @@ +#ifndef ECORE_PSL1GHT_KEYS_H__ +# define ECORE_PSL1GHT_KEYS_H__ + +struct _ecore_psl1ght_keys_s +{ + int code; + const char *name; + const char *compose; +}; + +static const struct _ecore_psl1ght_keys_s keystable[] = +{ + { KB_RAWKEY_NO_EVENT, "0x00", "" }, + { KB_RAWKEY_BS, "BackSpace", "\010" }, + { KB_RAWKEY_TAB, "Tab", "\011" }, + { KB_RAWKEY_ENTER, "Return", "\015" }, + { KB_RAWKEY_PAUSE, "Pause", "Pause" }, + { KB_RAWKEY_ESCAPE, "Escape", "\033" }, + { KB_RAWKEY_SPACE, "space", " " }, + + /* Skip uppercase letters */ + { KB_RAWKEY_LEFT_BRACKET_101, "bracketleft", "[" }, + { KB_RAWKEY_BACKSLASH_101, "backslash", "\\" }, + { KB_RAWKEY_RIGHT_BRACKET_101, "bracketright", "]" }, + { KB_RAWKEY_ACCENT_CIRCONFLEX_106, "asciicircumm", "^" }, + { KB_RAWKEY_DELETE, "Delete", "\177" }, + /* End of ASCII mapped keysyms */ + + /* Numeric keypad */ + { KB_RAWKEY_KPAD_0, "KP0", "0" }, + { KB_RAWKEY_KPAD_1, "KP1", "1" }, + { KB_RAWKEY_KPAD_2, "KP2", "2" }, + { KB_RAWKEY_KPAD_3, "KP3", "3" }, + { KB_RAWKEY_KPAD_4, "KP4", "4" }, + { KB_RAWKEY_KPAD_5, "KP5", "5" }, + { KB_RAWKEY_KPAD_6, "KP6", "6" }, + { KB_RAWKEY_KPAD_7, "KP7", "7" }, + { KB_RAWKEY_KPAD_8, "KP8", "8" }, + { KB_RAWKEY_KPAD_9, "KP9", "9" }, + { KB_RAWKEY_KPAD_PERIOD, "period", "." }, + { KB_RAWKEY_KPAD_SLASH, "KP_Divide", "/" }, + { KB_RAWKEY_KPAD_ASTERISK, "KP_Multiply", "*" }, + { KB_RAWKEY_KPAD_MINUS, "KP_Minus", "-" }, + { KB_RAWKEY_KPAD_PLUS, "KP_Plus", "+" }, + { KB_RAWKEY_KPAD_ENTER, "KP_Enter", "\015" }, + + /* Arrows + Home/End pad */ + { KB_RAWKEY_UP_ARROW, "Up", "Up" }, + { KB_RAWKEY_DOWN_ARROW, "Down", "Down" }, + { KB_RAWKEY_RIGHT_ARROW, "Right", "Right" }, + { KB_RAWKEY_LEFT_ARROW, "Left", "Left" }, + { KB_RAWKEY_INSERT, "Insert", "Insert" }, + { KB_RAWKEY_HOME, "Home", "Home" }, + { KB_RAWKEY_END, "End", "End" }, + { KB_RAWKEY_PAGE_UP, "Page_Up", "Page_Up" }, + { KB_RAWKEY_PAGE_DOWN, "Page_Down", "Page_Down" }, + + /* Function keys */ + { KB_RAWKEY_F1, "F1", "F1" }, + { KB_RAWKEY_F2, "F2", "F2" }, + { KB_RAWKEY_F3, "F3", "F3" }, + { KB_RAWKEY_F4, "F4", "F4" }, + { KB_RAWKEY_F5, "F5", "F5" }, + { KB_RAWKEY_F6, "F6", "F6" }, + { KB_RAWKEY_F7, "F7", "F7" }, + { KB_RAWKEY_F8, "F8", "F8" }, + { KB_RAWKEY_F9, "F9", "F9" }, + { KB_RAWKEY_F10, "F10", "F10" }, + { KB_RAWKEY_F11, "F11", "F11" }, + { KB_RAWKEY_F12, "F12", "F12" }, + + /* Key state modifier keys */ + { KB_RAWKEY_KPAD_NUMLOCK, "Num_Lock", "Num_Lock" }, + { KB_RAWKEY_CAPS_LOCK, "Caps_Lock", "Caps_Lock" }, + { KB_RAWKEY_SCROLL_LOCK, "Scroll_Lock", "Scroll_Lock" }, +}; + +#endif /* ECORE_PSL1GHT_KEYS_H__ */ diff --git a/libraries/ecore/src/lib/ecore_psl1ght/Makefile.am b/libraries/ecore/src/lib/ecore_psl1ght/Makefile.am new file mode 100644 index 0000000..8e7328a --- /dev/null +++ b/libraries/ecore/src/lib/ecore_psl1ght/Makefile.am @@ -0,0 +1,30 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_evas \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_evas \ +-I$(top_builddir)/src/lib/ecore_input \ +@EFL_ECORE_PSL1GHT_BUILD@ \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_psl1ght.la +includes_HEADERS = Ecore_Psl1ght.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_psl1ght_la_SOURCES = \ +ecore_psl1ght.c \ +moveutil.c \ +spursutil.c + +libecore_psl1ght_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@EINA_LIBS@ + +libecore_psl1ght_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ + +EXTRA_DIST = Ecore_Psl1ght_Keys.h ecore_psl1ght_private.h diff --git a/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in b/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in new file mode 100644 index 0000000..9b75b74 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_psl1ght/Makefile.in @@ -0,0 +1,826 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_psl1ght +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_psl1ght_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore/libecore.la \ + $(top_builddir)/src/lib/ecore_input/libecore_input.la +am_libecore_psl1ght_la_OBJECTS = ecore_psl1ght.lo moveutil.lo \ + spursutil.lo +libecore_psl1ght_la_OBJECTS = $(am_libecore_psl1ght_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_psl1ght_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libecore_psl1ght_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_psl1ght_la_SOURCES) +DIST_SOURCES = $(libecore_psl1ght_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_evas \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_evas \ +-I$(top_builddir)/src/lib/ecore_input \ +@EFL_ECORE_PSL1GHT_BUILD@ \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_psl1ght.la +includes_HEADERS = Ecore_Psl1ght.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_psl1ght_la_SOURCES = \ +ecore_psl1ght.c \ +moveutil.c \ +spursutil.c + +libecore_psl1ght_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@EINA_LIBS@ + +libecore_psl1ght_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ +EXTRA_DIST = Ecore_Psl1ght_Keys.h ecore_psl1ght_private.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_psl1ght/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_psl1ght/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_psl1ght.la: $(libecore_psl1ght_la_OBJECTS) $(libecore_psl1ght_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_psl1ght_la_LINK) -rpath $(libdir) $(libecore_psl1ght_la_OBJECTS) $(libecore_psl1ght_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_psl1ght.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/moveutil.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/spursutil.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c b/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c new file mode 100644 index 0000000..64cef9f --- /dev/null +++ b/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght.c @@ -0,0 +1,804 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "moveutil.h" + +#include "Eina.h" +#include "Ecore_Psl1ght.h" +#include "Ecore_Input.h" +#include "Ecore.h" +#include "ecore_psl1ght_private.h" +#include "ecore_private.h" +#include "Ecore_Psl1ght_Keys.h" + +/* Allocate 1MB stack to avoid overflows */ +SYS_PROCESS_PARAM(1001, 0x100000); + +int _ecore_psl1ght_log_dom = -1; + +EAPI int ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = 0; +EAPI int ECORE_PSL1GHT_EVENT_GOT_FOCUS = 0; +EAPI int ECORE_PSL1GHT_EVENT_LOST_FOCUS = 0; +EAPI int ECORE_PSL1GHT_EVENT_EXPOSE = 0; + +static int _ecore_psl1ght_init_count = 0; +static int window_width = 0; +static int window_height = 0; +/* Mouse support */ +static int mouse_connected = FALSE; +static u8 mouse_buttons = 0; +static int mouse_x = 0; +static int mouse_y = 0; +/* Keyboard support */ +static int keyboard_connected = FALSE; +static KbLed keyboard_leds = {{0}}; +static KbMkey keyboard_mods = {{0}}; +static u16 keyboard_old_key = 0; +/* Pad support */ +static padData pad_data; +static int pad_old_x = 0; +static int pad_old_o = 0; +/* Move support */ +static int move_connected = FALSE; +static moveContext *move_context = NULL; +u16 move_buttons = 0; + +static void xmb_event_handler(u64 status, u64 param, void *user_data); + +/** + * @defgroup Ecore_Psl1ght_Library_Group PSL1GHT Library Functions + * + * Functions used to set up and shut down the Ecore_Psl1ght functions. + */ + +/** + * Sets up the Ecore_Psl1ght library. + * @param name device target name + * @return @c 0 on failure. Otherwise, the number of times the library has + * been initialised without being shut down. + * @ingroup Ecore_PSL1GHT_Library_Group + */ +EAPI int +ecore_psl1ght_init(const char *name __UNUSED__) +{ + videoState state; + videoResolution resolution; + int ret, camera_loaded, gem_loaded; + + if (++_ecore_psl1ght_init_count != 1) + return _ecore_psl1ght_init_count; + _ecore_psl1ght_log_dom = eina_log_domain_register + ("ecore_psl1ght", ECORE_PSL1GHT_DEFAULT_LOG_COLOR); + if (_ecore_psl1ght_log_dom < 0) + { + EINA_LOG_ERR("Impossible to create a log domain for the Ecore PSL1GHT module."); + return --_ecore_psl1ght_init_count; + } + if (!ecore_event_init()) + { + eina_log_domain_unregister(_ecore_psl1ght_log_dom); + _ecore_psl1ght_log_dom = -1; + return --_ecore_psl1ght_init_count; + } + + if (videoGetState (0, 0, &state) == 0 && + videoGetResolution (state.displayMode.resolution, &resolution) == 0) + { + ecore_psl1ght_resolution_set (resolution.width, resolution.height); + } + else + { + ecore_event_shutdown(); + eina_log_domain_unregister(_ecore_psl1ght_log_dom); + _ecore_psl1ght_log_dom = -1; + return --_ecore_psl1ght_init_count; + } + + /* Pad support */ + ioPadInit (7); + /* Mouse support */ + ioMouseInit(2); + mouse_buttons = 0; + mouse_x = 0; + mouse_y = 0; + + /* Keyboard support */ + ioKbInit(2); + keyboard_leds._KbLedU.leds = 0; + keyboard_mods._KbMkeyU.mkeys = 0; + + /* Initialize Move */ + move_context = NULL; + move_buttons = 0; + + camera_loaded = !sysModuleIsLoaded (SYSMODULE_CAMERA); + if (!camera_loaded) + ret = sysModuleLoad (SYSMODULE_CAMERA); + else + ret = 0; + if (ret == 0) + { + gem_loaded = !sysModuleIsLoaded (SYSMODULE_GEM); + if (!gem_loaded) + ret = sysModuleLoad (SYSMODULE_GEM); + if (ret == 0) + { + move_context = initMove (); + } + else { + if (gem_loaded) + sysModuleUnload (SYSMODULE_CAMERA); + } + } + + sysUtilRegisterCallback (SYSUTIL_EVENT_SLOT0, xmb_event_handler, NULL); + + ECORE_PSL1GHT_EVENT_GOT_FOCUS = ecore_event_type_new(); + ECORE_PSL1GHT_EVENT_LOST_FOCUS = ecore_event_type_new(); + ECORE_PSL1GHT_EVENT_EXPOSE = ecore_event_type_new(); + ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = ecore_event_type_new(); + + mouse_x = 0; + mouse_y = 0; + + return _ecore_psl1ght_init_count; +} + +/** + * Shuts down the Ecore_Psl1ght library. + * @return @c The number of times the system has been initialised without + * being shut down. + * @ingroup Ecore_PSL1GHT_Library_Group + */ +EAPI int +ecore_psl1ght_shutdown(void) +{ + if (--_ecore_psl1ght_init_count != 0) + return _ecore_psl1ght_init_count; + + ecore_event_shutdown(); + eina_log_domain_unregister(_ecore_psl1ght_log_dom); + _ecore_psl1ght_log_dom = -1; + + ECORE_PSL1GHT_EVENT_GOT_FOCUS = 0; + ECORE_PSL1GHT_EVENT_LOST_FOCUS = 0; + ECORE_PSL1GHT_EVENT_EXPOSE = 0; + ECORE_PSL1GHT_EVENT_KEY_MODIFIERS = 0; + + ioPadEnd(); + ioMouseEnd(); + ioKbEnd(); + + if (move_context) + { + endMove (move_context); + move_context = NULL; + sysModuleUnload (SYSMODULE_CAMERA); + sysModuleUnload (SYSMODULE_GEM); + } + + sysUtilUnregisterCallback(SYSUTIL_EVENT_SLOT0); + + return _ecore_psl1ght_init_count; +} + +static unsigned int +_ecore_psl1ght_get_time(void) +{ + return (unsigned int)((unsigned long long) + (ecore_time_get() * 1000.0) & 0xffffffff); +} + +static unsigned int +_ecore_psl1ght_get_modifiers(void) +{ + unsigned int modifiers = 0; + + if (keyboard_mods._KbMkeyU._KbMkeyS.r_shift || + keyboard_mods._KbMkeyU._KbMkeyS.l_shift) + modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if (keyboard_mods._KbMkeyU._KbMkeyS.r_ctrl || + keyboard_mods._KbMkeyU._KbMkeyS.l_ctrl) + modifiers |= ECORE_EVENT_MODIFIER_CTRL; + if (keyboard_mods._KbMkeyU._KbMkeyS.r_alt || + keyboard_mods._KbMkeyU._KbMkeyS.l_alt) + modifiers |= ECORE_EVENT_MODIFIER_ALT; + if (keyboard_mods._KbMkeyU._KbMkeyS.r_win || + keyboard_mods._KbMkeyU._KbMkeyS.l_win) + modifiers |= ECORE_EVENT_MODIFIER_WIN; + + if (keyboard_leds._KbLedU._KbLedS.num_lock) + modifiers |= ECORE_EVENT_LOCK_NUM; + if (keyboard_leds._KbLedU._KbLedS.caps_lock) + modifiers |= ECORE_EVENT_LOCK_CAPS; + if (keyboard_leds._KbLedU._KbLedS.scroll_lock) + modifiers |= ECORE_EVENT_LOCK_SCROLL; + + return modifiers; +} + +static void +_ecore_psl1ght_key_modifiers(KbMkey *mods, KbLed *leds) +{ + Ecore_Psl1ght_Event_Key_Modifiers *ev; + Eina_Bool emit = EINA_FALSE; + + ev = malloc(sizeof(Ecore_Psl1ght_Event_Key_Modifiers)); + if (!ev) return; + + if (mods->_KbMkeyU._KbMkeyS.l_shift != + keyboard_mods._KbMkeyU._KbMkeyS.l_shift || + mods->_KbMkeyU._KbMkeyS.r_shift != + keyboard_mods._KbMkeyU._KbMkeyS.r_shift) + { + emit = EINA_TRUE; + ev->shift_changed = EINA_TRUE; + ev->shift = mods->_KbMkeyU._KbMkeyS.r_shift | + mods->_KbMkeyU._KbMkeyS.l_shift; + } + if (mods->_KbMkeyU._KbMkeyS.l_ctrl != + keyboard_mods._KbMkeyU._KbMkeyS.l_ctrl || + mods->_KbMkeyU._KbMkeyS.r_ctrl != + keyboard_mods._KbMkeyU._KbMkeyS.r_ctrl) + { + emit = EINA_TRUE; + ev->ctrl_changed = EINA_TRUE; + ev->ctrl = mods->_KbMkeyU._KbMkeyS.r_ctrl | + mods->_KbMkeyU._KbMkeyS.l_ctrl; + } + if (mods->_KbMkeyU._KbMkeyS.l_alt != + keyboard_mods._KbMkeyU._KbMkeyS.l_alt || + mods->_KbMkeyU._KbMkeyS.r_alt != + keyboard_mods._KbMkeyU._KbMkeyS.r_alt) + { + emit = EINA_TRUE; + ev->alt_changed = EINA_TRUE; + ev->alt = mods->_KbMkeyU._KbMkeyS.r_alt | + mods->_KbMkeyU._KbMkeyS.l_alt; + } + if (mods->_KbMkeyU._KbMkeyS.l_win != + keyboard_mods._KbMkeyU._KbMkeyS.l_win || + mods->_KbMkeyU._KbMkeyS.r_win != + keyboard_mods._KbMkeyU._KbMkeyS.r_win) + { + emit = EINA_TRUE; + ev->win_changed = EINA_TRUE; + ev->win = mods->_KbMkeyU._KbMkeyS.r_win | + mods->_KbMkeyU._KbMkeyS.l_win; + } + keyboard_mods = *mods; + + if (leds->_KbLedU._KbLedS.num_lock != + keyboard_leds._KbLedU._KbLedS.num_lock) + { + emit = EINA_TRUE; + ev->num_lock_changed = EINA_TRUE; + ev->num_lock = leds->_KbLedU._KbLedS.num_lock; + } + if (leds->_KbLedU._KbLedS.caps_lock != + keyboard_leds._KbLedU._KbLedS.caps_lock) + { + emit = EINA_TRUE; + ev->caps_lock_changed = EINA_TRUE; + ev->caps_lock = leds->_KbLedU._KbLedS.caps_lock; + } + if (leds->_KbLedU._KbLedS.scroll_lock != + keyboard_leds._KbLedU._KbLedS.scroll_lock) + { + emit = EINA_TRUE; + ev->scroll_lock_changed = EINA_TRUE; + ev->scroll_lock = leds->_KbLedU._KbLedS.scroll_lock; + } + keyboard_leds = *leds; + + if (emit) + { + ev->timestamp = _ecore_psl1ght_get_time (); + ev->modifiers = _ecore_psl1ght_get_modifiers(); + ecore_event_add(ECORE_PSL1GHT_EVENT_KEY_MODIFIERS, ev, NULL, NULL); + } + else + { + free(ev); + } +} + +static void +unicodeToUtf8(u16 w, char *utf8buf) +{ + unsigned char *utf8s = (unsigned char *)utf8buf; + + if ( w < 0x0080 ) + { + utf8s[0] = ( unsigned char )w; + utf8s[1] = 0; + } + else if ( w < 0x0800 ) + { + utf8s[0] = 0xc0 | ((w) >> 6); + utf8s[1] = 0x80 | ((w) & 0x3f); + utf8s[2] = 0; + } + else { + utf8s[0] = 0xe0 | ((w) >> 12); + utf8s[1] = 0x80 | (((w) >> 6) & 0x3f); + utf8s[2] = 0x80 | ((w) & 0x3f); + utf8s[3] = 0; + } +} + +static Ecore_Event_Key * +_ecore_psl1ght_event_key(u16 key) +{ + Ecore_Event_Key *ev; + char utf8[4]; + u16 utf16; + unsigned int i; + + ev = malloc(sizeof(Ecore_Event_Key)); + if (!ev) return NULL; + + ev->timestamp = _ecore_psl1ght_get_time (); + ev->window = 0; + ev->event_window = 0; + ev->modifiers = _ecore_psl1ght_get_modifiers(); + + printf ("Key is %X\n", key); + key &= ~KB_KEYPAD; + for (i = 0; i < sizeof(keystable) / sizeof(struct _ecore_psl1ght_keys_s); ++i) + if (keystable[i].code == key) + { + ev->keyname = keystable[i].name; + ev->key = keystable[i].name; + ev->string = keystable[i].compose; + ev->compose = keystable[i].compose; + + printf ("Found key '%s' in the table\n", ev->keyname); + return ev; + } + + utf16 = ioKbCnvRawCode (KB_MAPPING_101, keyboard_mods, keyboard_leds, key); + unicodeToUtf8(utf16, utf8); + printf ("Converting to utf16 : %X - utf8 : %s\n", utf16, utf8); + ev->keyname = ev->key = ev->string = ev->compose = strdup (utf8); + + return ev; +} + +static void +_ecore_psl1ght_mouse_move(s32 x_axis, s32 y_axis) +{ + Ecore_Event_Mouse_Move *ev; + + ev = malloc(sizeof(Ecore_Event_Mouse_Move)); + if (!ev) return; + + mouse_x += x_axis; + mouse_y += y_axis; + if (mouse_x < 0) mouse_x = 0; + if (mouse_y < 0) mouse_y = 0; + if (mouse_x > window_width) mouse_x = window_width; + if (mouse_y > window_height) mouse_y = window_height; + + ev->window = 0; + ev->root_window = 0; + ev->event_window = 0; + ev->same_screen = 0; + ev->timestamp = _ecore_psl1ght_get_time (); + ev->modifiers = _ecore_psl1ght_get_modifiers (); + ev->x = ev->root.x = mouse_x; + ev->y = ev->root.x = mouse_y; + + ev->multi.device = 0; + ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0; + ev->multi.pressure = ev->multi.angle = 0; + ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0; + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); +} + +static void +_ecore_psl1ght_mouse_button(int button, int pressed) +{ + Ecore_Event_Mouse_Button *ev; + static unsigned int previous_timestamp = 0; + + ev = malloc(sizeof(Ecore_Event_Mouse_Button)); + if (!ev) return; + + ev->window = 0; + ev->root_window = 0; + ev->event_window = 0; + ev->same_screen = 0; + ev->timestamp = _ecore_psl1ght_get_time (); + ev->modifiers = _ecore_psl1ght_get_modifiers (); + ev->buttons = button; + if (ev->timestamp - previous_timestamp <= 500) + ev->double_click = 1; + ev->triple_click = 0; + previous_timestamp = ev->timestamp; + + ev->x = ev->root.x = mouse_x; + ev->y = ev->root.y = mouse_y; + ev->multi.device = 0; + ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0; + ev->multi.pressure = ev->multi.angle = 0; + ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0; + + if (pressed) + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL); + else + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL); +} + +static void +_ecore_psl1ght_mouse_wheel(s8 wheel, s8 tilt) +{ + Ecore_Event_Mouse_Wheel *ev; + + ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)); + if (!ev) return; + + ev->timestamp = _ecore_psl1ght_get_time (); + ev->window = 0; + ev->event_window = 0; + ev->modifiers = _ecore_psl1ght_get_modifiers (); + ev->direction = 0; + ev->z = wheel; + + ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL); +} + +#define PAD_STICK_DEADZONE 0x20 + +static void +_ecore_psl1ght_poll_joypad(void) +{ + padInfo padinfo; + int i; + + /**/ + /* Check mouse events */ + ioPadGetInfo (&padinfo); + + for (i = 0; i < 4; i++) /* Ignore the move */ + { + if (padinfo.status[i]) + { + int analog_h, analog_v; + + if (ioPadGetData (i, &pad_data) != 0) + continue; + analog_h = pad_data.ANA_L_H - 0x80; + analog_v = pad_data.ANA_L_V - 0x80; + + if (analog_h > PAD_STICK_DEADZONE) + analog_h -= PAD_STICK_DEADZONE; + else if (analog_h < -PAD_STICK_DEADZONE) + analog_h += PAD_STICK_DEADZONE; + else + analog_h = 0; + analog_h /= 10; + + if (analog_v > PAD_STICK_DEADZONE) + analog_v -= PAD_STICK_DEADZONE; + else if (analog_v < -PAD_STICK_DEADZONE) + analog_v += PAD_STICK_DEADZONE; + else + analog_v = 0; + analog_v /= 10; + + if (analog_h != 0 || analog_v != 0) + _ecore_psl1ght_mouse_move (analog_h, analog_v); + + if (pad_old_x != pad_data.BTN_CROSS) + _ecore_psl1ght_mouse_button (1, pad_data.BTN_CROSS); + if (pad_old_o != pad_data.BTN_CIRCLE) + _ecore_psl1ght_mouse_button (3, pad_data.BTN_CIRCLE); + + pad_old_x = pad_data.BTN_CROSS; + pad_old_o = pad_data.BTN_CIRCLE; + + //pad_buttons = paddata.buttons; + } + } +} + +static void +_ecore_psl1ght_poll_mouse(void) +{ + mouseInfo mouseinfo; + u32 i; + + /**/ + /* Check mouse events */ + ioMouseGetInfo(&mouseinfo); + + if (mouseinfo.status[0] == 1 && !mouse_connected) // Connected + { + mouse_connected = TRUE; + mouse_buttons = 0; + + // Old events in the queue are discarded + ioMouseClearBuf(0); + } + else if (mouseinfo.status[0] != 1 && mouse_connected) // Disconnected + { + mouse_connected = FALSE; + mouse_buttons = 0; + } + + if (mouse_connected) + { + mouseDataList datalist; + + ioMouseGetDataList(0, &datalist); + + for (i = 0; i < datalist.count; i++) + { + u8 old_left = mouse_buttons & 1; + u8 new_left = datalist.list[i].buttons & 1; + u8 old_right = mouse_buttons & 2; + u8 new_right = datalist.list[i].buttons & 2; + u8 old_middle = mouse_buttons & 4; + u8 new_middle = datalist.list[i].buttons & 4; + + if (datalist.list[i].x_axis != 0 || + datalist.list[i].y_axis != 0) + _ecore_psl1ght_mouse_move (datalist.list[i].x_axis, + datalist.list[i].y_axis); + + if (old_left != new_left) + _ecore_psl1ght_mouse_button (1, new_left); + if (old_middle != new_middle) + _ecore_psl1ght_mouse_button (2, new_middle); + if (old_right != new_right) + _ecore_psl1ght_mouse_button (3, new_right); + + if (datalist.list[i].wheel != 0) + _ecore_psl1ght_mouse_wheel (datalist.list[i].wheel, + datalist.list[i].tilt); + + mouse_buttons = datalist.list[i].buttons; + } + } +} + +static void +_ecore_psl1ght_poll_move(void) +{ + int i; + u16 new_buttons; + static int t_pressed = 0; + static int calibrated = 0; + static float prev_x = 0; + static float prev_y = 0; + static int gyro = 0; + float x, y, z; + + /* Check move events */ + processMove (move_context); + new_buttons = move_context->state.paddata.buttons & (~move_buttons); + move_buttons = move_context->state.paddata.buttons; + + moveGet3DPosition (move_context, &x, &y, &z); + //printf ("Move 3D position is : %f, %f, %f\n", x,y,z); + + switch (new_buttons) { + case 1: + gyro = !gyro; + break; + + case 4: + // Move button + printf ("Calibrating\n"); + gemCalibrate (0); + calibrated = 1; + break; + + case 8: + // start button + _ecore_psl1ght_mouse_move ((window_width / 2) - mouse_x, (window_height / 2) - mouse_y); + break; + } + + if (calibrated) + { + float x_axis, y_axis; + + if (gyro) + { + gemInertialState gem_inert; + + gemGetInertialState (0, 0, 0, &gem_inert); + x_axis = -vec_array (gem_inert.gyro, 1) * 25; + y_axis = -vec_array (gem_inert.gyro, 0) * 25; + if (abs (x_axis) > 2 || abs (y_axis) > 2) + _ecore_psl1ght_mouse_move (x_axis, y_axis); + } + else { + x_axis = (x - prev_x) * 2.5; + y_axis = -(y - prev_y) * 2.5; + prev_x = x; + prev_y = y; + _ecore_psl1ght_mouse_move (x_axis, y_axis); + } + + if (!t_pressed && (move_buttons & 0x2)) + _ecore_psl1ght_mouse_button (1, 1); + else if (t_pressed && (move_buttons & 0x2) == 0) + _ecore_psl1ght_mouse_button (1, 0); + t_pressed = move_buttons & 0x2; + } +} + +static void +_ecore_psl1ght_poll_keyboard(void) +{ + KbInfo kbInfo; + int i; + + /* Check keyboard events */ + ioKbGetInfo(&kbInfo); + + if (kbInfo.status[0] == 1 && !keyboard_connected) + { + /* Connected */ + keyboard_connected = true; + + // Old events in the queue are discarded + ioKbClearBuf(0); + keyboard_leds._KbLedU.leds = 0; + keyboard_mods._KbMkeyU.mkeys = 0; + keyboard_old_key = 0; + + // Set raw keyboard code types to get scan codes + ioKbSetCodeType(0, KB_CODETYPE_RAW); + ioKbSetReadMode(0, KB_RMODE_INPUTCHAR); + } + else if (kbInfo.status[0] != 1 && keyboard_connected) + { + /* Disconnected keyboard */ + keyboard_connected = FALSE; + } + + if (keyboard_connected) + { + KbData Keys; + + // Read data from the keyboard buffer + if (ioKbRead(0, &Keys) == 0 && Keys.nb_keycode > 0) + { + Ecore_Event_Key *ev = NULL; + + _ecore_psl1ght_key_modifiers (&Keys.mkey, &Keys.led); + + if (Keys.nb_keycode == 0 && keyboard_old_key != 0) + { + ev = _ecore_psl1ght_event_key (keyboard_old_key); + if (ev) ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL); + } + for (i = 0; i < Keys.nb_keycode; i++) + { + if (Keys.keycode[i] != keyboard_old_key) + { + if (Keys.keycode[i] != 0) + { + ev = _ecore_psl1ght_event_key (Keys.keycode[i]); + if (ev) + ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, + NULL, NULL); + } + else + { + ev = _ecore_psl1ght_event_key (keyboard_old_key); + if (ev) + ecore_event_add(ECORE_EVENT_KEY_UP, ev, + NULL, NULL); + } + keyboard_old_key = Keys.keycode[0]; + } + } + } + } +} + +static void +xmb_event_handler(u64 status, u64 param, void *user_data) +{ + printf ("Received event %lX\n", status); + if (status == SYSUTIL_EXIT_GAME) + { + ecore_main_loop_quit(); + } + else if (status == SYSUTIL_MENU_OPEN) + { + } + else if (status == SYSUTIL_MENU_CLOSE) + { + } + else if (status == SYSUTIL_DRAW_BEGIN) + { + } + else if (status == SYSUTIL_DRAW_END) + { + } +} + +EAPI void +ecore_psl1ght_poll_events(void) +{ + _ecore_psl1ght_poll_joypad (); + _ecore_psl1ght_poll_mouse (); + if (move_context) + _ecore_psl1ght_poll_move (); + _ecore_psl1ght_poll_keyboard (); + + sysUtilCheckCallback (); +} + +EAPI void +ecore_psl1ght_resolution_set(int width, int height) +{ + window_width = width; + window_height = height; + if (mouse_x > window_width) mouse_x = window_width; + if (mouse_y > window_height) mouse_y = window_height; +} + +EAPI void +ecore_psl1ght_screen_resolution_get(int *w, int *h) +{ + videoState state; + videoResolution resolution; + + /* Get the state of the display */ + if (videoGetState (0, 0, &state) == 0 && + videoGetResolution (state.displayMode.resolution, &resolution) == 0) + { + if (w) *w = resolution.width; + if (h) *h = resolution.height; + } + else { + if (w) *w = 0; + if (h) *h = 0; + } +} + +EAPI void +ecore_psl1ght_optimal_screen_resolution_get(int *w, int *h) +{ + videoDeviceInfo info; + videoResolution res; + int area = 720 * 480; + int mode_area; + int i; + + if (w) *w = 720; + if (h) *h = 480; + + videoGetDeviceInfo(0, 0, &info); + + for (i = 0; i < info.availableModeCount; i++) { + videoGetResolution (info.availableModes[i].resolution, &res); + mode_area = res.width * res.height; + if (mode_area > area) + { + area = mode_area; + if (w) *w = res.width; + if (h) *h = res.height; + } + } +} + diff --git a/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght_private.h b/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght_private.h new file mode 100644 index 0000000..bd5a86e --- /dev/null +++ b/libraries/ecore/src/lib/ecore_psl1ght/ecore_psl1ght_private.h @@ -0,0 +1,36 @@ +#ifndef _ECORE_PSL1GHT_PRIVATE_H +# define _ECORE_PSL1GHT_PRIVATE_H + +extern int _ecore_psl1ght_log_dom; + +# ifdef ECORE_PSL1GHT_DEFAULT_LOG_COLOR +# undef ECORE_PSL1GHT_DEFAULT_LOG_COLOR +# endif +# define ECORE_PSL1GHT_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + +# ifdef ERR +# undef ERR +# endif +# define ERR(...) EINA_LOG_DOM_ERR(_ecore_psl1ght_log_dom, __VA_ARGS__) + +# ifdef DBG +# undef DBG +# endif +# define DBG(...) EINA_LOG_DOM_DBG(_ecore_psl1ght_log_dom, __VA_ARGS__) + +# ifdef INF +# undef INF +# endif +# define INF(...) EINA_LOG_DOM_INFO(_ecore_psl1ght_log_dom, __VA_ARGS__) + +# ifdef WRN +# undef WRN +# endif +# define WRN(...) EINA_LOG_DOM_WARN(_ecore_psl1ght_log_dom, __VA_ARGS__) + +# ifdef CRIT +# undef CRIT +# endif +# define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_psl1ght_log_dom, __VA_ARGS__) + +#endif diff --git a/libraries/ecore/src/lib/ecore_psl1ght/moveutil.c b/libraries/ecore/src/lib/ecore_psl1ght/moveutil.c new file mode 100644 index 0000000..1dadfbc --- /dev/null +++ b/libraries/ecore/src/lib/ecore_psl1ght/moveutil.c @@ -0,0 +1,245 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "spursutil.h" +#include "moveutil.h" + +u16 oldGemPad = 0; +u16 newGemPad = 0; +u16 newGemAnalogT = 0; + +static void +endCamera(moveContext *context) +{ + cameraStop (0); + + cameraClose (0); + cameraEnd (); + + sysMemContainerDestroy (context->camInfo.container); +} + +static int +initCamera(moveContext *context) +{ + int ret; + + context->camInfo.container = NULL; + + ret = cameraInit (); + printf ("cameraInit() returned %d\n", ret); + if (ret == 0) + { + cameraType type = CAM_TYPE_UNKNOWN; + + ret = cameraGetType (0, &type); + if (ret == 0 && type == CAM_TYPE_PLAYSTATION_EYE) + { + context->camInfo.format = CAM_FORM_RAW8; + context->camInfo.framerate = 60; + context->camInfo.resolution = CAM_RESO_VGA; + context->camInfo.info_ver = 0x0101; + ret = sysMemContainerCreate (&context->camInfo.container, 0x200000); + printf ("sysMemContainerCreate() for camera container returned %d\n", ret); + + ret = cameraOpenEx (0, &context->camInfo); + switch (ret) { + case 0: + printf ("Found me an eye, arrr!\n"); + printf ("cameraOpenEx returned %08X\n", ret); + printf ("Video dimensions: %dx%d\n", context->camInfo.width, context->camInfo.height); + printf ("Buffer at %08X\n", context->camInfo.buffer); + printf ("pbuf0 Buffer at %08X\n", context->camInfo.pbuf[0]); + printf ("pbuf0 Buffer at %08X\n", context->camInfo.pbuf[1]); + printf ("context->camInfo.info_ver %X\n", context->camInfo.info_ver); + + context->camRead.buffer = context->camInfo.buffer; + context->camRead.version = 0x0100; + printf ("Setting CameraReadEx %08X buffer to cameraInfoex buffer \n", + context->camRead.buffer); + break; + + default: + printf ("Error %X detected opening PlayStation Eye\n", ret); + goto error; + } + } + else { + printf ("Device detected is not a PlayStation Eye and this sample need it\n"); + goto error; + } + } + else { + goto error; + } + return ret; + +error: + if (context->camInfo.container) + sysMemContainerDestroy (context->camInfo.container); + return ret; +} + +static int +readCamera(moveContext *context) +{ + int ret; + + ret = cameraReadEx (0, &context->camRead); + switch (ret) { + case CAMERA_ERRO_NEED_START: + cameraReset (0); + ret = gemPrepareCamera (128, 0.5); + printf ("GemPrepareCamera return %d exposure set to 128 and quality to 0.5 before cameraStart\n", + ret); + printf ("lets go!! It's time to look your face in Sony Bravia :P\n"); + ret = cameraStart (0); + printf ("cameraStart return %d \n", ret); + printf ("*******************************************\n"); + printf ("* Now make sure you have a Move connected\n"); + printf ("* and point it towards the camera and press\n"); + printf ("* the action button to calibrate\n"); + printf ("*******************************************\n"); + break; + + case 0: + break; + + default: + printf ("error %08X ", ret); + ret = 1; + break; + } + // printf("despues de start return %d \n",ret); + if (ret == 0 && context->camRead.readcount != 0) + { + return context->camRead.readcount; + } + else { + return 0; + } +} + +moveContext * +initMove() +{ + moveContext *context = NULL; + Spurs *spurs; + gemAttribute gem_attr; + int ret; + int i; + + spurs = initSpurs ("gem_spurs"); + + if (spurs == NULL) + goto error; + + printf ("preparing GemAttribute structure with spurs\n"); + + gem_attr.version = 2; + gem_attr.max = 1; + gem_attr.spurs = spurs; + gem_attr.memory = NULL; + gem_attr.spu_priorities[0] = 1; + for (i = 1; i < 8; ++i) + gem_attr.spu_priorities[i] = 0; + + printf ("calling GemInit with GemAttribute structure version=%d max_connect=%d spurs=%X\n", + gem_attr.version, gem_attr.max, gem_attr.spurs); + ret = gemInit (&gem_attr); + printf ("return from GemInit %X \n", ret); + if (ret) + goto error; + + ret = gemPrepareCamera (128, 0.5); + printf ("GemPrepareCamera return %d exposure set to 128 and quality to 0.5\n", + ret); + if (ret) + goto error; + ret = gemReset (0); + printf ("GemReset return %X \n", ret); + if (ret) + goto error; + + context = (moveContext *)malloc (sizeof (moveContext)); + context->spurs = spurs; + ret = initCamera (context); + + if (ret == 0) + return context; + +error: + if (spurs) + endSpurs (spurs); + if (context) + free (context); + return NULL; +} + +void +endMove(moveContext *context) +{ + /* Stop Move */ + gemEnd (); + /* Stop Camera */ + endCamera (context); + /* Stop Spurs */ + endSpurs (context->spurs); + + free (context); +} + +int +processMove(moveContext *context) +{ + const unsigned int hues[] = { 4 << 24, 4 << 24, 4 << 24, 4 << 24 }; + int ret = -1; + + if (readCamera (context) > 0) + { + ret = gemUpdateStart (context->camRead.buffer, context->camRead.timestamp); + //printf ("Return from gemUpdateStart %X\n", ret); + if (ret == 0) + { + ret = gemUpdateFinish (); + //printf ("Return from gemUpdateFinish %X\n", ret); + if (ret == 0) + { + ret = gemGetState (0, STATE_LATEST_IMAGE_TIME, 0, &context->state); + switch (ret) { + case 2: + gemForceRGB (0, 0.5, 0.5, 0.5); + break; + + case 5: + gemTrackHues (hues, NULL); + break; + + default: + break; + } + } + } + } + + return ret; +} + +void +moveGet3DPosition(moveContext *context, float *x, float *y, float *z) +{ + if (x) + *x = vec_array (context->state.pos, 0); + if (y) + *y = vec_array (context->state.pos, 1); + if (z) + *z = vec_array (context->state.pos, 2); +} + diff --git a/libraries/ecore/src/lib/ecore_psl1ght/spursutil.c b/libraries/ecore/src/lib/ecore_psl1ght/spursutil.c new file mode 100644 index 0000000..27b5c1d --- /dev/null +++ b/libraries/ecore/src/lib/ecore_psl1ght/spursutil.c @@ -0,0 +1,62 @@ +#include "spursutil.h" +#include + +#define SPURS_DEFAULT_PREFIX_NAME "spursutil" + +Spurs * +initSpurs(const char *prefix_name) +{ + Spurs *spurs = NULL; + SpursAttribute attributeSpurs; + int ret; + int i; + + ret = sysSpuInitialize (6, 0); + printf ("sysSpuInitialize return %d\n", ret); + + /* initialize spurs */ + printf ("Initializing spurs\n"); + spurs = (void *)memalign (SPURS_ALIGN, sizeof (Spurs)); + printf ("Initializing spurs attribute\n"); + + ret = spursAttributeInitialize (&attributeSpurs, 5, 250, 1000, true); + if (ret) + { + printf ("error : spursAttributeInitialize failed %x\n", ret); + goto error; + } + + printf ("Setting name prefix\n"); + if (!prefix_name) + prefix_name = SPURS_DEFAULT_PREFIX_NAME; + ret = spursAttributeSetNamePrefix (&attributeSpurs, + prefix_name, strlen (prefix_name)); + if (ret) + { + printf ("error : spursAttributeInitialize failed %x\n", ret); + goto error; + } + + printf ("Initializing with attribute\n"); + ret = spursInitializeWithAttribute (spurs, &attributeSpurs); + if (ret) + { + printf ("error: spursInitializeWithAttribute failed %x\n", ret); + goto error; + } + + return spurs; + +error: + if (spurs) + free (spurs); + return NULL; +} + +void +endSpurs(Spurs *spurs) +{ + spursFinalize (spurs); + free (spurs); +} + diff --git a/libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl.h b/libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl.h new file mode 100644 index 0000000..359e974 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl.h @@ -0,0 +1,114 @@ +#ifndef _ECORE_SDL_H +#define _ECORE_SDL_H + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_ECORE_SDL_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_ECORE_SDL_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif /* ! _WIN32 */ + +/** + * @file + * @brief Ecore SDL system functions. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +EAPI extern int ECORE_SDL_EVENT_GOT_FOCUS; +EAPI extern int ECORE_SDL_EVENT_LOST_FOCUS; +EAPI extern int ECORE_SDL_EVENT_RESIZE; +EAPI extern int ECORE_SDL_EVENT_EXPOSE; + +typedef struct _Ecore_Sdl_Event_Key_Down Ecore_Sdl_Event_Key_Down; +struct _Ecore_Sdl_Event_Key_Down /** SDL Key Down event */ +{ + const char *keyname; /**< The name of the key that was pressed */ + const char *keycompose; /**< The UTF-8 string conversion if any */ + unsigned int time; +}; + +typedef struct _Ecore_Sdl_Event_Key_Up Ecore_Sdl_Event_Key_Up; +struct _Ecore_Sdl_Event_Key_Up /** SDL Key Up event */ +{ + const char *keyname; /**< The name of the key that was released */ + const char *keycompose; /**< The UTF-8 string conversion if any */ + unsigned int time; +}; + +typedef struct _Ecore_Sdl_Event_Mouse_Button_Down Ecore_Sdl_Event_Mouse_Button_Down; +struct _Ecore_Sdl_Event_Mouse_Button_Down /** SDL Mouse Down event */ +{ + int button; /**< Mouse button that was pressed (1 - 32) */ + int x; /**< Mouse co-ordinates when mouse button was pressed */ + int y; /**< Mouse co-ordinates when mouse button was pressed */ + int double_click : 1; /**< Set if click was a double click */ + int triple_click : 1; /**< Set if click was a triple click */ + unsigned int time; +}; + +typedef struct _Ecore_Sdl_Event_Mouse_Button_Up Ecore_Sdl_Event_Mouse_Button_Up; +struct _Ecore_Sdl_Event_Mouse_Button_Up /** SDL Mouse Up event */ +{ + int button; /**< Mouse button that was released (1 - 32) */ + int x; /**< Mouse co-ordinates when mouse button was raised */ + int y; /**< Mouse co-ordinates when mouse button was raised */ + int double_click : 1; /**< Set if click was a double click */ + int triple_click : 1; /**< Set if click was a triple click */ + unsigned int time; +}; + +typedef struct _Ecore_Sdl_Event_Mouse_Move Ecore_Sdl_Event_Mouse_Move; +struct _Ecore_Sdl_Event_Mouse_Move /** SDL Mouse Move event */ +{ + int x; /**< Mouse co-ordinates where the mouse cursor moved to */ + int y; /**< Mouse co-ordinates where the mouse cursor moved to */ + unsigned int time; +}; + +typedef struct _Ecore_Sdl_Event_Mouse_Wheel Ecore_Sdl_Event_Mouse_Wheel; +struct _Ecore_Sdl_Event_Mouse_Wheel /** SDL Mouse Wheel event */ +{ + int x,y; + int direction; /* 0 = vertical, 1 = horizontal */ + int wheel; /* value 1 (left/up), -1 (right/down) */ + unsigned int time; +}; + +typedef struct _Ecore_Sdl_Event_Video_Resize Ecore_Sdl_Event_Video_Resize; +struct _Ecore_Sdl_Event_Video_Resize +{ + int w; + int h; +}; + +EAPI int ecore_sdl_init(const char *name); +EAPI int ecore_sdl_shutdown(void); +EAPI void ecore_sdl_feed_events(void); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl_Keys.h b/libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl_Keys.h new file mode 100644 index 0000000..4d0b60b --- /dev/null +++ b/libraries/ecore/src/lib/ecore_sdl/Ecore_Sdl_Keys.h @@ -0,0 +1,266 @@ +#ifndef ECORE_SDL_KEYS_H__ +# define ECORE_SDL_KEYS_H__ + +struct _ecore_sdl_keys_s +{ + int code; + const char* name; + const char* compose; +}; + +static const struct _ecore_sdl_keys_s keystable[] = +{ + { SDLK_UNKNOWN, "0x00", "" }, +#ifndef BUILD_ECORE_EVAS_SDL_130 + { SDLK_FIRST, "First", "First" }, +#endif + { SDLK_BACKSPACE, "BackSpace", "\010" }, + { SDLK_TAB, "Tab", "\011" }, + { SDLK_CLEAR, "Clear", "Clear" }, + { SDLK_RETURN, "Return", "\015" }, + { SDLK_PAUSE, "Pause", "Pause" }, + { SDLK_ESCAPE, "Escape", "\033" }, + { SDLK_SPACE, "space", " " }, + { SDLK_EXCLAIM, "exclam", "!" }, + { SDLK_QUOTEDBL, "quotedbl", "\"" }, + { SDLK_HASH, "numbersign", "#" }, + { SDLK_DOLLAR, "dollar", "$" }, + { SDLK_AMPERSAND, "ampersand", "&" }, + { SDLK_QUOTE, "apostrophe", "'" }, + { SDLK_LEFTPAREN, "parenleft", "(" }, + { SDLK_RIGHTPAREN, "parenright", ")" }, + { SDLK_ASTERISK, "asterisk", "*" }, + { SDLK_PLUS, "plus", "+" }, + { SDLK_COMMA, "comma", "," }, + { SDLK_MINUS, "minus", "-" }, + { SDLK_PERIOD, "period", "." }, + { SDLK_SLASH, "slash", "/" }, + { SDLK_0, "0", "0" }, + { SDLK_1, "1", "1" }, + { SDLK_2, "2", "2" }, + { SDLK_3, "3", "3" }, + { SDLK_4, "4", "4" }, + { SDLK_5, "5", "5" }, + { SDLK_6, "6", "6" }, + { SDLK_7, "7", "7" }, + { SDLK_8, "8", "8" }, + { SDLK_9, "9", "9" }, + { SDLK_COLON, "colon", ":" }, + { SDLK_SEMICOLON, "semicolon", ";" }, + { SDLK_LESS, "less", "<" }, + { SDLK_EQUALS, "equal", "=" }, + { SDLK_GREATER, "greater", ">" }, + { SDLK_QUESTION, "question", "?" }, + { SDLK_AT, "at", "@" }, + + /* Skip uppercase letters */ + { SDLK_LEFTBRACKET, "bracketleft", "[" }, + { SDLK_BACKSLASH, "backslash", "\\" }, + { SDLK_RIGHTBRACKET, "bracketright", "]" }, + { SDLK_CARET, "asciicircumm", "^" }, + { SDLK_UNDERSCORE, "underscore", "_" }, + { SDLK_BACKQUOTE, "asciitilde", "`" }, + { SDLK_a, "a", "a" }, + { SDLK_b, "b", "b" }, + { SDLK_c, "c", "c" }, + { SDLK_d, "d", "d" }, + { SDLK_e, "e", "e" }, + { SDLK_f, "f", "f" }, + { SDLK_g, "g", "g" }, + { SDLK_h, "h", "h" }, + { SDLK_i, "i", "i" }, + { SDLK_j, "j", "j" }, + { SDLK_k, "k", "k" }, + { SDLK_l, "l", "l" }, + { SDLK_m, "m", "m" }, + { SDLK_n, "n", "n" }, + { SDLK_o, "o", "o" }, + { SDLK_p, "p", "p" }, + { SDLK_q, "q", "q" }, + { SDLK_r, "r", "r" }, + { SDLK_s, "s", "s" }, + { SDLK_t, "t", "t" }, + { SDLK_u, "u", "u" }, + { SDLK_v, "v", "v" }, + { SDLK_w, "w", "w" }, + { SDLK_x, "x", "x" }, + { SDLK_y, "y", "y" }, + { SDLK_z, "z", "z" }, + { SDLK_DELETE, "Delete", "\177" }, + /* End of ASCII mapped keysyms */ + +#ifndef BUILD_ECORE_EVAS_SDL_130 + /* International keyboard syms */ + { SDLK_WORLD_0, "w0", "" }, /* 0xA0 */ + { SDLK_WORLD_1, "w1", "" }, + { SDLK_WORLD_2, "w2", "" }, + { SDLK_WORLD_3, "w3", "" }, + { SDLK_WORLD_4, "w4", "" }, + { SDLK_WORLD_5, "w5", "" }, + { SDLK_WORLD_6, "w6", "" }, + { SDLK_WORLD_7, "w7", "" }, + { SDLK_WORLD_8, "w8", "" }, + { SDLK_WORLD_9, "w9", "" }, + { SDLK_WORLD_10, "w10", "" }, + { SDLK_WORLD_11, "w11", "" }, + { SDLK_WORLD_12, "w12", "" }, + { SDLK_WORLD_13, "w13", "" }, + { SDLK_WORLD_14, "w14", "" }, + { SDLK_WORLD_15, "w15", "" }, + { SDLK_WORLD_16, "w16", "" }, + { SDLK_WORLD_17, "w17", "" }, + { SDLK_WORLD_18, "w18", "" }, + { SDLK_WORLD_19, "w19", "" }, + { SDLK_WORLD_20, "w20", "" }, + { SDLK_WORLD_21, "w21", "" }, + { SDLK_WORLD_22, "w22", "" }, + { SDLK_WORLD_23, "w23", "" }, + { SDLK_WORLD_24, "w24", "" }, + { SDLK_WORLD_25, "w25", "" }, + { SDLK_WORLD_26, "w26", "" }, + { SDLK_WORLD_27, "w27", "" }, + { SDLK_WORLD_28, "w28", "" }, + { SDLK_WORLD_29, "w29", "" }, + { SDLK_WORLD_30, "w30", "" }, + { SDLK_WORLD_31, "w31", "" }, + { SDLK_WORLD_32, "w32", "" }, + { SDLK_WORLD_33, "w33", "" }, + { SDLK_WORLD_34, "w34", "" }, + { SDLK_WORLD_35, "w35", "" }, + { SDLK_WORLD_36, "w36", "" }, + { SDLK_WORLD_37, "w37", "" }, + { SDLK_WORLD_38, "w38", "" }, + { SDLK_WORLD_39, "w39", "" }, + { SDLK_WORLD_40, "w40", "" }, + { SDLK_WORLD_41, "w41", "" }, + { SDLK_WORLD_42, "w42", "" }, + { SDLK_WORLD_43, "w43", "" }, + { SDLK_WORLD_44, "w44", "" }, + { SDLK_WORLD_45, "w45", "" }, + { SDLK_WORLD_46, "w46", "" }, + { SDLK_WORLD_47, "w47", "" }, + { SDLK_WORLD_48, "w48", "" }, + { SDLK_WORLD_49, "w49", "" }, + { SDLK_WORLD_50, "w50", "" }, + { SDLK_WORLD_51, "w51", "" }, + { SDLK_WORLD_52, "w52", "" }, + { SDLK_WORLD_53, "w53", "" }, + { SDLK_WORLD_54, "w54", "" }, + { SDLK_WORLD_55, "w55", "" }, + { SDLK_WORLD_56, "w56", "" }, + { SDLK_WORLD_57, "w57", "" }, + { SDLK_WORLD_58, "w58", "" }, + { SDLK_WORLD_59, "w59", "" }, + { SDLK_WORLD_60, "w60", "" }, + { SDLK_WORLD_61, "w61", "" }, + { SDLK_WORLD_62, "w62", "" }, + { SDLK_WORLD_63, "w63", "" }, + { SDLK_WORLD_64, "w64", "" }, + { SDLK_WORLD_65, "w65", "" }, + { SDLK_WORLD_66, "w66", "" }, + { SDLK_WORLD_67, "w67", "" }, + { SDLK_WORLD_68, "w68", "" }, + { SDLK_WORLD_69, "w69", "" }, + { SDLK_WORLD_70, "w70", "" }, + { SDLK_WORLD_71, "w71", "" }, + { SDLK_WORLD_72, "w72", "" }, + { SDLK_WORLD_73, "w73", "" }, + { SDLK_WORLD_74, "w74", "" }, + { SDLK_WORLD_75, "w75", "" }, + { SDLK_WORLD_76, "w76", "" }, + { SDLK_WORLD_77, "w77", "" }, + { SDLK_WORLD_78, "w78", "" }, + { SDLK_WORLD_79, "w79", "" }, + { SDLK_WORLD_80, "w80", "" }, + { SDLK_WORLD_81, "w81", "" }, + { SDLK_WORLD_82, "w82", "" }, + { SDLK_WORLD_83, "w83", "" }, + { SDLK_WORLD_84, "w84", "" }, + { SDLK_WORLD_85, "w85", "" }, + { SDLK_WORLD_86, "w86", "" }, + { SDLK_WORLD_87, "w87", "" }, + { SDLK_WORLD_88, "w88", "" }, + { SDLK_WORLD_89, "w89", "" }, + { SDLK_WORLD_90, "w90", "" }, + { SDLK_WORLD_91, "w91", "" }, + { SDLK_WORLD_92, "w92", "" }, + { SDLK_WORLD_93, "w93", "" }, + { SDLK_WORLD_94, "w94", "" }, + { SDLK_WORLD_95, "w95", "" }, +#endif + /* Numeric keypad */ + { SDLK_KP0, "KP0", "0" }, + { SDLK_KP1, "KP1", "1" }, + { SDLK_KP2, "KP2", "2" }, + { SDLK_KP3, "KP3", "3" }, + { SDLK_KP4, "KP4", "4" }, + { SDLK_KP5, "KP5", "5" }, + { SDLK_KP6, "KP6", "6" }, + { SDLK_KP7, "KP7", "7" }, + { SDLK_KP8, "KP8", "8" }, + { SDLK_KP9, "KP9", "9" }, + { SDLK_KP_PERIOD, "period", "." }, + { SDLK_KP_DIVIDE, "KP_Divide", "/" }, + { SDLK_KP_MULTIPLY, "KP_Multiply", "*" }, + { SDLK_KP_MINUS, "KP_Minus", "-" }, + { SDLK_KP_PLUS, "KP_Plus", "+" }, + { SDLK_KP_ENTER, "KP_Enter", "\015" }, + { SDLK_KP_EQUALS, "KP_Equals", "=" }, + + /* Arrows + Home/End pad */ + { SDLK_UP, "Up", "Up" }, + { SDLK_DOWN, "Down", "Down" }, + { SDLK_RIGHT, "Right", "Right" }, + { SDLK_LEFT, "Left", "Left" }, + { SDLK_INSERT, "Insert", "Insert" }, + { SDLK_HOME, "Home", "Home" }, + { SDLK_END, "End", "End" }, + { SDLK_PAGEUP, "Page_Up", "Page_Up" }, + { SDLK_PAGEDOWN, "Page_Down", "Page_Down" }, + + /* Function keys */ + { SDLK_F1, "F1", "F1" }, + { SDLK_F2, "F2", "F2" }, + { SDLK_F3, "F3", "F3" }, + { SDLK_F4, "F4", "F4" }, + { SDLK_F5, "F5", "F5" }, + { SDLK_F6, "F6", "F6" }, + { SDLK_F7, "F7", "F7" }, + { SDLK_F8, "F8", "F8" }, + { SDLK_F9, "F9", "F9" }, + { SDLK_F10, "F10", "F10" }, + { SDLK_F11, "F11", "F11" }, + { SDLK_F12, "F12", "F12" }, + { SDLK_F13, "F13", "F13" }, + { SDLK_F14, "F14", "F14" }, + { SDLK_F15, "F15", "F15" }, + + /* Key state modifier keys */ + { SDLK_NUMLOCK, "Num_Lock", "Num_Lock" }, + { SDLK_CAPSLOCK, "Caps_Lock", "Caps_Lock" }, + { SDLK_SCROLLOCK, "Scroll_Lock", "Scroll_Lock" }, + { SDLK_RSHIFT, "Shift_R", "Shift_R" }, + { SDLK_LSHIFT, "Shift_L", "Shift_L" }, + { SDLK_RCTRL, "Control_R", "Control_R" }, + { SDLK_LCTRL, "Control_L", "Control_L" }, + { SDLK_RALT, "Alt_R", "Alt_R" }, + { SDLK_LALT, "Alt_L", "Alt_L" }, + { SDLK_RMETA, "Meta_R", "Meta_R" }, + { SDLK_LMETA, "Meta_L", "Meta_L" }, + { SDLK_LSUPER, "Super_L", "Super_L" }, /* Left "Windows" key */ + { SDLK_RSUPER, "Super_R", "Super_R" }, /* Right "Windows" key */ + { SDLK_MODE, "Mode", "Mode" }, /* "Alt Gr" key */ + { SDLK_COMPOSE, "Compose", "Compose" }, /* Multi-key compose key */ + + /* Miscellaneous function keys */ + { SDLK_HELP, "Help", "Help" }, + { SDLK_PRINT, "Print", "Print" }, + { SDLK_SYSREQ, "SysReq", "SysReq" }, + { SDLK_BREAK, "Break", "Break" }, + { SDLK_MENU, "Menu", "Menu" }, + { SDLK_POWER, "Power", "Power" }, /* Power Macintosh power key */ + { SDLK_EURO, "Euro", "\200" }, /* Some european keyboards */ + { SDLK_UNDO, "Undo", "Undo" } /* Atari keyboard has Undo */ +}; + +#endif /* ECORE_SDL_KEYS_H__ */ diff --git a/libraries/ecore/src/lib/ecore_sdl/Makefile.am b/libraries/ecore/src/lib/ecore_sdl/Makefile.am new file mode 100644 index 0000000..27210bb --- /dev/null +++ b/libraries/ecore/src/lib/ecore_sdl/Makefile.am @@ -0,0 +1,29 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_evas \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_evas \ +-I$(top_builddir)/src/lib/ecore_input \ +@EFL_ECORE_SDL_BUILD@ \ +@SDL_CFLAGS@ \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_sdl.la +includes_HEADERS = Ecore_Sdl.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_sdl_la_SOURCES = \ +ecore_sdl.c + +libecore_sdl_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@SDL_LIBS@ @EVIL_LIBS@ @EINA_LIBS@ + +libecore_sdl_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ + +EXTRA_DIST = Ecore_Sdl_Keys.h ecore_sdl_private.h diff --git a/libraries/ecore/src/lib/ecore_sdl/Makefile.in b/libraries/ecore/src/lib/ecore_sdl/Makefile.in new file mode 100644 index 0000000..0141ebe --- /dev/null +++ b/libraries/ecore/src/lib/ecore_sdl/Makefile.in @@ -0,0 +1,822 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_sdl +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_sdl_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore/libecore.la \ + $(top_builddir)/src/lib/ecore_input/libecore_input.la +am_libecore_sdl_la_OBJECTS = ecore_sdl.lo +libecore_sdl_la_OBJECTS = $(am_libecore_sdl_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_sdl_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libecore_sdl_la_LDFLAGS) $(LDFLAGS) \ + -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_sdl_la_SOURCES) +DIST_SOURCES = $(libecore_sdl_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_evas \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_evas \ +-I$(top_builddir)/src/lib/ecore_input \ +@EFL_ECORE_SDL_BUILD@ \ +@SDL_CFLAGS@ \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_sdl.la +includes_HEADERS = Ecore_Sdl.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_sdl_la_SOURCES = \ +ecore_sdl.c + +libecore_sdl_la_LIBADD = \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@SDL_LIBS@ @EVIL_LIBS@ @EINA_LIBS@ + +libecore_sdl_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ +EXTRA_DIST = Ecore_Sdl_Keys.h ecore_sdl_private.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_sdl/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_sdl/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_sdl.la: $(libecore_sdl_la_OBJECTS) $(libecore_sdl_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_sdl_la_LINK) -rpath $(libdir) $(libecore_sdl_la_OBJECTS) $(libecore_sdl_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_sdl.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_sdl/ecore_sdl.c b/libraries/ecore/src/lib/ecore_sdl/ecore_sdl.c new file mode 100644 index 0000000..3f28216 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_sdl/ecore_sdl.c @@ -0,0 +1,335 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "Eina.h" +#include "Ecore_Sdl.h" +#include "Ecore_Input.h" +#include "Ecore.h" +#include "ecore_sdl_private.h" +#include "ecore_private.h" +#include "Ecore_Sdl_Keys.h" + +#include + +int _ecore_sdl_log_dom = -1; + +typedef struct _Ecore_SDL_Pressed Ecore_SDL_Pressed; +struct _Ecore_SDL_Pressed +{ + EINA_RBTREE; + + SDLKey key; +}; + +EAPI int ECORE_SDL_EVENT_GOT_FOCUS = 0; +EAPI int ECORE_SDL_EVENT_LOST_FOCUS = 0; +EAPI int ECORE_SDL_EVENT_RESIZE = 0; +EAPI int ECORE_SDL_EVENT_EXPOSE = 0; + +static int _ecore_sdl_init_count = 0; +static Eina_Rbtree *repeat = NULL; + +static Eina_Rbtree_Direction +_ecore_sdl_pressed_key(const Ecore_SDL_Pressed *left, + const Ecore_SDL_Pressed *right, + __UNUSED__ void *data) +{ + return left->key < right->key ? EINA_RBTREE_LEFT : EINA_RBTREE_RIGHT; +} + +static int +_ecore_sdl_pressed_node(const Ecore_SDL_Pressed *node, + const SDLKey *key, + __UNUSED__ int length, + __UNUSED__ void *data) +{ + return node->key - *key; +} + +/** + * @defgroup Ecore_Sdl_Library_Group SDL Library Functions + * + * Functions used to set up and shut down the Ecore_Sdl functions. + */ + +/** + * Sets up the Ecore_Sdl library. + * @param name device target name + * @return @c 0 on failure. Otherwise, the number of times the library has + * been initialised without being shut down. + * @ingroup Ecore_SDL_Library_Group + */ +EAPI int +ecore_sdl_init(const char *name __UNUSED__) +{ + if(++_ecore_sdl_init_count != 1) + return _ecore_sdl_init_count; + _ecore_sdl_log_dom = eina_log_domain_register + ("ecore_sdl", ECORE_SDL_DEFAULT_LOG_COLOR); + if(_ecore_sdl_log_dom < 0) + { + EINA_LOG_ERR("Impossible to create a log domain for the Ecore SDL module."); + return --_ecore_sdl_init_count; + } + if (!ecore_event_init()) + return --_ecore_sdl_init_count; + + ECORE_SDL_EVENT_GOT_FOCUS = ecore_event_type_new(); + ECORE_SDL_EVENT_LOST_FOCUS = ecore_event_type_new(); + ECORE_SDL_EVENT_RESIZE = ecore_event_type_new(); + ECORE_SDL_EVENT_EXPOSE = ecore_event_type_new(); + + SDL_EnableKeyRepeat(200, 100); + + return _ecore_sdl_init_count; +} + +/** + * Shuts down the Ecore_Sdl library. + * @return @c The number of times the system has been initialised without + * being shut down. + * @ingroup Ecore_SDL_Library_Group + */ +EAPI int +ecore_sdl_shutdown(void) +{ + if (--_ecore_sdl_init_count != 0) + return _ecore_sdl_init_count; + + ecore_event_shutdown(); + eina_log_domain_unregister(_ecore_sdl_log_dom); + _ecore_sdl_log_dom = -1; + return _ecore_sdl_init_count; +} + +static unsigned int +_ecore_sdl_event_modifiers(int mod) +{ + unsigned int modifiers = 0; + + if(mod & KMOD_LSHIFT) modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if(mod & KMOD_RSHIFT) modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if(mod & KMOD_LCTRL) modifiers |= ECORE_EVENT_MODIFIER_CTRL; + if(mod & KMOD_RCTRL) modifiers |= ECORE_EVENT_MODIFIER_CTRL; + if(mod & KMOD_LALT) modifiers |= ECORE_EVENT_MODIFIER_ALT; + if(mod & KMOD_RALT) modifiers |= ECORE_EVENT_MODIFIER_ALT; + if(mod & KMOD_NUM) modifiers |= ECORE_EVENT_LOCK_NUM; + if(mod & KMOD_CAPS) modifiers |= ECORE_EVENT_LOCK_CAPS; + + return modifiers; +} + +static Ecore_Event_Key* +_ecore_sdl_event_key(SDL_Event *event, double time) +{ + Ecore_Event_Key *ev; + unsigned int i; + + ev = malloc(sizeof(Ecore_Event_Key)); + if (!ev) return NULL; + + ev->timestamp = time; + ev->window = 0; + ev->event_window = 0; + ev->modifiers = _ecore_sdl_event_modifiers(SDL_GetModState()); + ev->key = NULL; + ev->compose = NULL; + + for (i = 0; i < sizeof(keystable) / sizeof(struct _ecore_sdl_keys_s); ++i) + if (keystable[i].code == event->key.keysym.sym) + { + ev->keyname = keystable[i].name; + ev->string = keystable[i].compose; + + return ev; + } + + free(ev); + return NULL; +} + +EAPI void +ecore_sdl_feed_events(void) +{ + SDL_Event event; + unsigned int time; + + while(SDL_PollEvent(&event)) + { + time = (unsigned int)((unsigned long long)(ecore_time_get() * 1000.0) & 0xffffffff); + switch(event.type) + { + case SDL_MOUSEMOTION: + { + Ecore_Event_Mouse_Move *ev; + + ev = malloc(sizeof(Ecore_Event_Mouse_Move)); + if (!ev) return ; + + ev->timestamp = time; + ev->window = 0; + ev->event_window = 0; + ev->modifiers = 0; /* FIXME: keep modifier around. */ + ev->x = event.motion.x; + ev->y = event.motion.y; + ev->root.x = ev->x; + ev->root.y = ev->y; + + /* Must set multi touch device to 0 or it will get ignored */ + ev->multi.device = 0; + ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0; + ev->multi.pressure = ev->multi.angle = 0; + ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0; + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, ev, NULL, NULL); + break; + } + case SDL_MOUSEBUTTONDOWN: + { + if (event.button.button == SDL_BUTTON_WHEELUP || + event.button.button == SDL_BUTTON_WHEELDOWN) + { + Ecore_Event_Mouse_Wheel *ev; + + ev = malloc(sizeof(Ecore_Event_Mouse_Wheel)); + if (!ev) return ; + + ev->timestamp = time; + ev->window = 0; + ev->event_window = 0; + ev->modifiers = 0; /* FIXME: keep modifier around. */ + ev->direction = 0; + ev->z = event.button.button == SDL_BUTTON_WHEELDOWN ? -1 : 1; + + ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, ev, NULL, NULL); + } + else + { + Ecore_Event_Mouse_Button *ev; + + ev = malloc(sizeof(Ecore_Event_Mouse_Button)); + if (!ev) return ; + + ev->timestamp = time; + ev->window = 0; + ev->event_window = 0; + ev->modifiers = 0; /* FIXME: keep modifier around. */ + ev->buttons = event.button.button; + ev->double_click = 0; + ev->triple_click = 0; + + /* Must set multi touch device to 0 or it will get ignored */ + ev->multi.device = 0; + ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0; + ev->multi.pressure = ev->multi.angle = 0; + ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0; + + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, ev, NULL, NULL); + } + break; + } + case SDL_MOUSEBUTTONUP: + { + Ecore_Event_Mouse_Button *ev; + + ev = malloc(sizeof(Ecore_Event_Mouse_Button)); + if (!ev) return ; + ev->timestamp = time; + ev->window = 0; + ev->event_window = 0; + ev->modifiers = 0; /* FIXME: keep modifier around. */ + ev->buttons = event.button.button; + ev->double_click = 0; + ev->triple_click = 0; + + /* Must set multi touch device to 0 or it will get ignored */ + ev->multi.device = 0; + ev->multi.radius = ev->multi.radius_x = ev->multi.radius_y = 0; + ev->multi.pressure = ev->multi.angle = 0; + ev->multi.x = ev->multi.y = ev->multi.root.x = ev->multi.root.y = 0; + + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, ev, NULL, NULL); + break; + } + case SDL_VIDEORESIZE: + { + Ecore_Sdl_Event_Video_Resize *ev; + + ev = malloc(sizeof (Ecore_Sdl_Event_Video_Resize)); + ev->w = event.resize.w; + ev->h = event.resize.h; + + ecore_event_add(ECORE_SDL_EVENT_RESIZE, ev, NULL, NULL); + break; + } + case SDL_VIDEOEXPOSE: + ecore_event_add(ECORE_SDL_EVENT_EXPOSE, NULL, NULL, NULL); + break; + case SDL_QUIT: + ecore_main_loop_quit(); + break; + + case SDL_KEYDOWN: + { + Ecore_SDL_Pressed *entry; + Ecore_Event_Key *ev; + + entry = (Ecore_SDL_Pressed*) eina_rbtree_inline_lookup(repeat, &event.key.keysym.sym, sizeof (event.key.keysym.sym), + EINA_RBTREE_CMP_KEY_CB(_ecore_sdl_pressed_node), NULL); + if (entry) + { + ev = _ecore_sdl_event_key(&event, time); + if (ev) ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL); + } + + ev = _ecore_sdl_event_key(&event, time); + if (ev) ecore_event_add(ECORE_EVENT_KEY_DOWN, ev, NULL, NULL); + + if (!entry) + { + entry = malloc(sizeof (Ecore_SDL_Pressed)); + if (!entry) break; + + entry->key = event.key.keysym.sym; + + repeat = eina_rbtree_inline_insert(repeat, EINA_RBTREE_GET(entry), + EINA_RBTREE_CMP_NODE_CB(_ecore_sdl_pressed_key), NULL); + } + break; + } + case SDL_KEYUP: + { + Ecore_Event_Key *ev; + Ecore_SDL_Pressed *entry; + + entry = (Ecore_SDL_Pressed*) eina_rbtree_inline_lookup(repeat, &event.key.keysym.sym, sizeof (event.key.keysym.sym), + EINA_RBTREE_CMP_KEY_CB(_ecore_sdl_pressed_node), NULL); + if (entry) + { + repeat = eina_rbtree_inline_remove(repeat, EINA_RBTREE_GET(entry), + EINA_RBTREE_CMP_NODE_CB(_ecore_sdl_pressed_key), NULL); + free(entry); + } + + ev = _ecore_sdl_event_key(&event, time); + if (ev) ecore_event_add(ECORE_EVENT_KEY_UP, ev, NULL, NULL); + break; + } + case SDL_ACTIVEEVENT: + /* FIXME: Focus gain. */ + break; + case SDL_SYSWMEVENT: + case SDL_USEREVENT: + case SDL_JOYAXISMOTION: + case SDL_JOYBALLMOTION: + case SDL_JOYHATMOTION: + case SDL_JOYBUTTONDOWN: + case SDL_JOYBUTTONUP: + default: + break; + } + } +} diff --git a/libraries/ecore/src/lib/ecore_sdl/ecore_sdl_private.h b/libraries/ecore/src/lib/ecore_sdl/ecore_sdl_private.h new file mode 100644 index 0000000..37e9570 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_sdl/ecore_sdl_private.h @@ -0,0 +1,36 @@ +#ifndef _ECORE_SDL_PRIVATE_H +# define _ECORE_SDL_PRIVATE_H + +extern int _ecore_sdl_log_dom; + +# ifdef ECORE_SDL_DEFAULT_LOG_COLOR +# undef ECORE_SDL_DEFAULT_LOG_COLOR +# endif +# define ECORE_SDL_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + +# ifdef ERR +# undef ERR +# endif +# define ERR(...) EINA_LOG_DOM_ERR(_ecore_sdl_log_dom, __VA_ARGS__) + +# ifdef DBG +# undef DBG +# endif +# define DBG(...) EINA_LOG_DOM_DBG(_ecore_sdl_log_dom, __VA_ARGS__) + +# ifdef INF +# undef INF +# endif +# define INF(...) EINA_LOG_DOM_INFO(_ecore_sdl_log_dom, __VA_ARGS__) + +# ifdef WRN +# undef WRN +# endif +# define WRN(...) EINA_LOG_DOM_WARN(_ecore_sdl_log_dom, __VA_ARGS__) + +# ifdef CRIT +# undef CRIT +# endif +# define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_sdl_log_dom, __VA_ARGS__) + +#endif diff --git a/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h b/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h new file mode 100644 index 0000000..bdfb1c8 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/Ecore_Win32.h @@ -0,0 +1,529 @@ +#ifndef __ECORE_WIN32_H__ +#define __ECORE_WIN32_H__ + +/* + * DO NOT USE THIS HEADER. IT IS WORK IN PROGRESS. IT IS NOT FINAL AND + * THE API MAY CHANGE. + */ + +#ifndef ECORE_WIN32_WIP_POZEFLKSD +# ifdef _MSC_VER +# pragma message ("You are using a work in progress API. This API is not stable") +# pragma message ("and is subject to change. You use this at your own risk.") +# else +# warning "You are using a work in progress API. This API is not stable" +# warning "and is subject to change. You use this at your own risk." +# endif +#endif + +#include + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_ECORE_WIN32_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_ECORE_WIN32_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif /* ! _WIN32 */ + + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup Ecore_Win32_Group Ecore_Win32 library + * + * @{ + */ + +/** + * @typedef Ecore_Win32_Window_State + * State of a window. + */ +typedef enum +{ + ECORE_WIN32_WINDOW_STATE_ICONIFIED, /**< iconified window */ + ECORE_WIN32_WINDOW_STATE_MODAL, /**< modal dialog box */ + ECORE_WIN32_WINDOW_STATE_STICKY, /**< sticky window */ + ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT, /**< maximum vertical sized window */ + ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ, /**< maximum horizontal sized window */ + ECORE_WIN32_WINDOW_STATE_MAXIMIZED, /**< maximum sized window */ + ECORE_WIN32_WINDOW_STATE_SHADED, /**< shaded window */ + ECORE_WIN32_WINDOW_STATE_HIDDEN, /**< hidden (minimized or iconified) window */ + ECORE_WIN32_WINDOW_STATE_FULLSCREEN, /**< fullscreen window */ + ECORE_WIN32_WINDOW_STATE_ABOVE, /**< above window */ + ECORE_WIN32_WINDOW_STATE_BELOW, /**< below window */ + ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION, /**< To document */ + ECORE_WIN32_WINDOW_STATE_UNKNOWN /**< Unknown state */ +} Ecore_Win32_Window_State; + +/** + * @typedef Ecore_Win32_Window_Type + * Type of a window. + */ +typedef enum +{ + ECORE_WIN32_WINDOW_TYPE_DESKTOP, /**< Desktop feature */ + ECORE_WIN32_WINDOW_TYPE_DOCK, /**< Dock window (should be on top of other windows) */ + ECORE_WIN32_WINDOW_TYPE_TOOLBAR, /**< Toolbar window */ + ECORE_WIN32_WINDOW_TYPE_MENU, /**< Menu window */ + ECORE_WIN32_WINDOW_TYPE_UTILITY, /**< Small persistent utility window, such as a palette or toolbox */ + ECORE_WIN32_WINDOW_TYPE_SPLASH, /**< Splash screen window displayed as an application is starting up */ + ECORE_WIN32_WINDOW_TYPE_DIALOG, /**< Dialog window */ + ECORE_WIN32_WINDOW_TYPE_NORMAL, /**< Normal top-level window */ + ECORE_WIN32_WINDOW_TYPE_UNKNOWN /**< Unknown type */ +} Ecore_Win32_Window_Type; + +/** + * @typedef Ecore_Win32_Cursor_Shape + * Shape of a cursor. + */ +typedef enum +{ + ECORE_WIN32_CURSOR_SHAPE_APP_STARTING, /**< Standard arrow and small hourglass */ + ECORE_WIN32_CURSOR_SHAPE_ARROW, /**< Standard arrow */ + ECORE_WIN32_CURSOR_SHAPE_CROSS, /**< Crosshair */ + ECORE_WIN32_CURSOR_SHAPE_HAND, /**< Hand */ + ECORE_WIN32_CURSOR_SHAPE_HELP, /**< Arrow and question mark */ + ECORE_WIN32_CURSOR_SHAPE_I_BEAM, /**< I-beam */ + ECORE_WIN32_CURSOR_SHAPE_NO, /**< Slashed circle */ + ECORE_WIN32_CURSOR_SHAPE_SIZE_ALL, /**< Four-pointed arrow pointing north, south, east, and west */ + ECORE_WIN32_CURSOR_SHAPE_SIZE_NESW, /**< Double-pointed arrow pointing northeast and southwest */ + ECORE_WIN32_CURSOR_SHAPE_SIZE_NS, /**< Double-pointed arrow pointing north and south */ + ECORE_WIN32_CURSOR_SHAPE_SIZE_NWSE, /**< Double-pointed arrow pointing northwest and southeast */ + ECORE_WIN32_CURSOR_SHAPE_SIZE_WE, /**< Double-pointed arrow pointing west and east */ + ECORE_WIN32_CURSOR_SHAPE_UP_ARROW, /**< Vertical arrow */ + ECORE_WIN32_CURSOR_SHAPE_WAIT /**< Hourglass */ +} Ecore_Win32_Cursor_Shape; + +/** + * @typedef Ecore_Win32_DnD_State + * State of a DnD operation. + */ +typedef enum +{ + ECORE_WIN32_DND_EVENT_DRAG_ENTER = 1, /**< Drag enter */ + ECORE_WIN32_DND_EVENT_DRAG_OVER = 2, /**< Drag over */ + ECORE_WIN32_DND_EVENT_DRAG_LEAVE = 3, /**< Drag leave */ + ECORE_WIN32_DND_EVENT_DROP = 4 /**< Drop */ +} Ecore_Win32_DnD_State; + +/** + * @typedef Ecore_Win32_Window + * Abstract type for a window. + */ +typedef struct _Ecore_Win32_Window Ecore_Win32_Window; + +/** + * @typedef Ecore_Win32_Cursor + * Abstract type for a cursor. + */ +typedef void Ecore_Win32_Cursor; + + +/** + * @typedef Ecore_Win32_Event_Mouse_In + * Event sent when the mouse enters the window. + */ +typedef struct _Ecore_Win32_Event_Mouse_In Ecore_Win32_Event_Mouse_In; + +/** + * @typedef Ecore_Win32_Event_Mouse_Out + * Event sent when the mouse leaves the window. + */ +typedef struct _Ecore_Win32_Event_Mouse_Out Ecore_Win32_Event_Mouse_Out; + +/** + * @typedef Ecore_Win32_Event_Window_Focus_In + * Event sent when the window gets the focus. + */ +typedef struct _Ecore_Win32_Event_Window_Focus_In Ecore_Win32_Event_Window_Focus_In; + +/** + * @typedef Ecore_Win32_Event_Window_Focus_Out + * Event sent when the window looses the focus. + */ +typedef struct _Ecore_Win32_Event_Window_Focus_Out Ecore_Win32_Event_Window_Focus_Out; + +/** + * @typedef Ecore_Win32_Event_Window_Damage + * Event sent when the window is damaged. + */ +typedef struct _Ecore_Win32_Event_Window_Damage Ecore_Win32_Event_Window_Damage; + +/** + * @typedef Ecore_Win32_Event_Window_Create + * Event sent when the window is created. + */ +typedef struct _Ecore_Win32_Event_Window_Create Ecore_Win32_Event_Window_Create; + +/** + * @typedef Ecore_Win32_Event_Window_Destroy + * Event sent when the window is destroyed. + */ +typedef struct _Ecore_Win32_Event_Window_Destroy Ecore_Win32_Event_Window_Destroy; + +/** + * @typedef Ecore_Win32_Event_Window_Hide + * Event sent when the window is hidden. + */ +typedef struct _Ecore_Win32_Event_Window_Hide Ecore_Win32_Event_Window_Hide; + +/** + * @typedef Ecore_Win32_Event_Window_Show + * Event sent when the window is shown. + */ +typedef struct _Ecore_Win32_Event_Window_Show Ecore_Win32_Event_Window_Show; + +/** + * @typedef Ecore_Win32_Event_Window_Configure + * Event sent when the window is configured. + */ +typedef struct _Ecore_Win32_Event_Window_Configure Ecore_Win32_Event_Window_Configure; + +/** + * @typedef Ecore_Win32_Event_Window_Resize + * Event sent when the window is resized. + */ +typedef struct _Ecore_Win32_Event_Window_Resize Ecore_Win32_Event_Window_Resize; + +/** + * @typedef Ecore_Win32_Event_Window_Delete_Request + * Event sent when the window is deleted. + */ +typedef struct _Ecore_Win32_Event_Window_Delete_Request Ecore_Win32_Event_Window_Delete_Request; + +/** + * @struct _Ecore_Win32_Event_Mouse_In + * Event sent when the mouse enters the window. + */ +struct _Ecore_Win32_Event_Mouse_In +{ + Ecore_Win32_Window *window; /**< The window that received the event */ + int x; /**< The x coordinate where the mouse leaved */ + int y; /**< The y coordinate where the mouse entered */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_Win32_Event_Mouse_Out + * Event sent when the mouse leaves the window. + */ +struct _Ecore_Win32_Event_Mouse_Out +{ + Ecore_Win32_Window *window; /**< The window that received the event */ + int x; /**< The x coordinate where the mouse leaved */ + int y; /**< The y coordinate where the mouse leaved */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_Win32_Event_Window_Focus_In + * Event sent when the window gets the focus. + */ +struct _Ecore_Win32_Event_Window_Focus_In +{ + Ecore_Win32_Window *window; /**< The window that received the event */ + long long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_Win32_Event_Window_Focus_Out + * Event sent when the window looses the focus. + */ +struct _Ecore_Win32_Event_Window_Focus_Out +{ + Ecore_Win32_Window *window; /**< The window that received the event */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_Win32_Event_Window_Damage + * Event sent when the window is damaged. + */ +struct _Ecore_Win32_Event_Window_Damage +{ + Ecore_Win32_Window *window; /**< The window that received the event */ + int x; /**< The x coordinate of the top left corner of the damaged region */ + int y; /**< The y coordinate of the top left corner of the damaged region */ + int width; /**< The width of the damaged region */ + int height; /**< The time the event occurred */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_Win32_Event_Window_Create + * Event sent when the window is created. + */ +struct _Ecore_Win32_Event_Window_Create +{ + Ecore_Win32_Window *window; /**< The window that received the event */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_Win32_Event_Window_Destroy + * Event sent when the window is destroyed. + */ +struct _Ecore_Win32_Event_Window_Destroy +{ + Ecore_Win32_Window *window; /**< The window that received the event */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_Win32_Event_Window_Hide + * Event sent when the window is hidden. + */ +struct _Ecore_Win32_Event_Window_Hide +{ + Ecore_Win32_Window *window; /**< The window that received the event */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_Win32_Event_Window_Show + * Event sent when the window is shown. + */ +struct _Ecore_Win32_Event_Window_Show +{ + Ecore_Win32_Window *window; /**< The window that received the event */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_Win32_Event_Window_Configure + * Event sent when the window is configured. + */ +struct _Ecore_Win32_Event_Window_Configure +{ + Ecore_Win32_Window *window; /**< The window that received the event */ + Ecore_Win32_Window *abovewin; + int x; /**< The new x coordinate of the top left corner */ + int y; /**< The new y coordinate of the top left corner */ + int width; /**< The new width */ + int height; /**< The new height */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_Win32_Event_Window_Resize + * Event sent when the window is resized. + */ +struct _Ecore_Win32_Event_Window_Resize +{ + Ecore_Win32_Window *window; /**< The window that received the event */ + int width; /**< The new width */ + int height; /**< The new height */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_Win32_Event_Window_Delete_Request + * Event sent when the window is deleted. + */ +struct _Ecore_Win32_Event_Window_Delete_Request +{ + Ecore_Win32_Window *window; /**< The window that received the event */ + long time; /**< The time the event occurred */ +}; + +/** + * @typedef Ecore_Win32_Dnd_DropTarget_Callback + * Callback type for Drop operations. See ecore_win32_dnd_register_drop_target(). + */ +typedef int (*Ecore_Win32_Dnd_DropTarget_Callback)(void *window, int event, int pt_x, int pt_y, void *data, int size); + +EAPI extern int ECORE_WIN32_EVENT_MOUSE_IN; /**< Ecore_Event for the #Ecore_Win32_Event_Mouse_In event */ +EAPI extern int ECORE_WIN32_EVENT_MOUSE_OUT; /**< Ecore_Event for the #Ecore_Win32_Event_Mouse_Out event */ +EAPI extern int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN; /**< Ecore_Event for the #Ecore_Win32_Event_Window_Focus_In event */ +EAPI extern int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT; /**< Ecore_Event for the #Ecore_Win32_Event_Window_Focus_Out event */ +EAPI extern int ECORE_WIN32_EVENT_WINDOW_DAMAGE; /**< Ecore_Event for the #Ecore_Win32_Event_Damage event */ +EAPI extern int ECORE_WIN32_EVENT_WINDOW_CREATE; /**< Ecore_Event for the #Ecore_Win32_Event_Create event */ +EAPI extern int ECORE_WIN32_EVENT_WINDOW_DESTROY; /**< Ecore_Event for the #Ecore_Win32_Event_Destroy event */ +EAPI extern int ECORE_WIN32_EVENT_WINDOW_HIDE; /**< Ecore_Event for the #Ecore_Win32_Event_Hide event */ +EAPI extern int ECORE_WIN32_EVENT_WINDOW_SHOW; /**< Ecore_Event for the #Ecore_Win32_Event_Show event */ +EAPI extern int ECORE_WIN32_EVENT_WINDOW_CONFIGURE; /**< Ecore_Event for the #Ecore_Win32_Event_Configure event */ +EAPI extern int ECORE_WIN32_EVENT_WINDOW_RESIZE; /**< Ecore_Event for the #Ecore_Win32_Event_Resize event */ +EAPI extern int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST; /**< Ecore_Event for the #Ecore_Win32_Event_Window_Delete_Request event */ + + +/* Core */ + +EAPI int ecore_win32_init(); +EAPI int ecore_win32_shutdown(); +EAPI int ecore_win32_screen_depth_get(); +EAPI void ecore_win32_double_click_time_set(double t); +EAPI double ecore_win32_double_click_time_get(void); +EAPI long ecore_win32_current_time_get(void); + +/* Window */ + +EAPI Ecore_Win32_Window *ecore_win32_window_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height); +EAPI Ecore_Win32_Window *ecore_win32_window_override_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height); + +EAPI void ecore_win32_window_free(Ecore_Win32_Window *window); + +EAPI void *ecore_win32_window_hwnd_get(Ecore_Win32_Window *window); + +EAPI void ecore_win32_window_move(Ecore_Win32_Window *window, + int x, + int y); + +EAPI void ecore_win32_window_resize(Ecore_Win32_Window *window, + int width, + int height); + +EAPI void ecore_win32_window_move_resize(Ecore_Win32_Window *window, + int x, + int y, + int width, + int height); + +EAPI void ecore_win32_window_geometry_get(Ecore_Win32_Window *window, + int *x, + int *y, + int *width, + int *height); + +EAPI void ecore_win32_window_size_get(Ecore_Win32_Window *window, + int *width, + int *height); + +EAPI void ecore_win32_window_size_min_set(Ecore_Win32_Window *window, + unsigned int min_width, + unsigned int min_height); + +EAPI void ecore_win32_window_size_min_get(Ecore_Win32_Window *window, + unsigned int *min_width, + unsigned int *min_height); + +EAPI void ecore_win32_window_size_max_set(Ecore_Win32_Window *window, + unsigned int max_width, + unsigned int max_height); + +EAPI void ecore_win32_window_size_max_get(Ecore_Win32_Window *window, + unsigned int *max_width, + unsigned int *max_height); + +EAPI void ecore_win32_window_size_base_set(Ecore_Win32_Window *window, + unsigned int base_width, + unsigned int base_height); + +EAPI void ecore_win32_window_size_base_get(Ecore_Win32_Window *window, + unsigned int *base_width, + unsigned int *base_height); + +EAPI void ecore_win32_window_size_step_set(Ecore_Win32_Window *window, + unsigned int step_width, + unsigned int step_height); + +EAPI void ecore_win32_window_size_step_get(Ecore_Win32_Window *window, + unsigned int *step_width, + unsigned int *step_height); + +EAPI void ecore_win32_window_show(Ecore_Win32_Window *window); + +EAPI void ecore_win32_window_hide(Ecore_Win32_Window *window); + +EAPI void ecore_win32_window_raise(Ecore_Win32_Window *window); + +EAPI void ecore_win32_window_lower(Ecore_Win32_Window *window); + +EAPI void ecore_win32_window_title_set(Ecore_Win32_Window *window, + const char *title); + +EAPI void ecore_win32_window_focus_set(Ecore_Win32_Window *window); + +EAPI void ecore_win32_window_iconified_set(Ecore_Win32_Window *window, + Eina_Bool on); + +EAPI void ecore_win32_window_borderless_set(Ecore_Win32_Window *window, + Eina_Bool on); + +EAPI void ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, + Eina_Bool on); + +EINA_DEPRECATED EAPI void ecore_win32_window_shape_set(Ecore_Win32_Window *window, + unsigned short width, + unsigned short height, + unsigned char *mask); + +EAPI void ecore_win32_window_cursor_set(Ecore_Win32_Window *window, + Ecore_Win32_Cursor *cursor); + +EAPI void ecore_win32_window_state_set(Ecore_Win32_Window *window, + Ecore_Win32_Window_State *state, + unsigned int num); + +EAPI void ecore_win32_window_state_request_send(Ecore_Win32_Window *window, + Ecore_Win32_Window_State state, + unsigned int set); + +EAPI void ecore_win32_window_type_set(Ecore_Win32_Window *window, + Ecore_Win32_Window_Type type); + +/* Cursor */ + +EAPI Ecore_Win32_Cursor *ecore_win32_cursor_new(const void *pixels_and, + const void *pixels_xor, + int width, + int height, + int hot_x, + int hot_y); + +EAPI void ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor); + +EAPI Ecore_Win32_Cursor *ecore_win32_cursor_shaped_new(Ecore_Win32_Cursor_Shape shape); + +EAPI void ecore_win32_cursor_size_get(int *width, int *height); + + + +/* Drag and drop */ +EAPI int ecore_win32_dnd_init(); +EAPI int ecore_win32_dnd_shutdown(); +EAPI Eina_Bool ecore_win32_dnd_begin(const char *data, + int size); +EAPI Eina_Bool ecore_win32_dnd_register_drop_target(Ecore_Win32_Window *window, + Ecore_Win32_Dnd_DropTarget_Callback callback); +EAPI void ecore_win32_dnd_unregister_drop_target(Ecore_Win32_Window *window); + +/** + * @} + */ + + +#ifdef __cplusplus +} +#endif + + +#endif /* __ECORE_WIN32_H__ */ diff --git a/libraries/ecore/src/lib/ecore_win32/Makefile.am b/libraries/ecore/src/lib/ecore_win32/Makefile.am new file mode 100644 index 0000000..ce317c7 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/Makefile.am @@ -0,0 +1,42 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_input \ +@EFL_ECORE_WIN32_BUILD@ \ +@EINA_CFLAGS@ \ +@WIN32_CPPFLAGS@ + +lib_LTLIBRARIES = libecore_win32.la + +includes_HEADERS = Ecore_Win32.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_win32_la_SOURCES = \ +ecore_win32.c \ +ecore_win32_cursor.c \ +ecore_win32_dnd.c \ +ecore_win32_dnd_enumformatetc.cpp \ +ecore_win32_dnd_data_object.cpp \ +ecore_win32_dnd_drop_source.cpp \ +ecore_win32_dnd_drop_target.cpp \ +ecore_win32_event.c \ +ecore_win32_window.c + +libecore_win32_la_LIBADD = \ +@ecore_win32_libs@ \ +@WIN32_LIBS@ \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@EINA_LIBS@ + +libecore_win32_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ + +EXTRA_DIST = \ +ecore_win32_private.h \ +ecore_win32_dnd_enumformatetc.h \ +ecore_win32_dnd_data_object.h \ +ecore_win32_dnd_drop_source.h \ +ecore_win32_dnd_drop_target.h diff --git a/libraries/ecore/src/lib/ecore_win32/Makefile.in b/libraries/ecore/src/lib/ecore_win32/Makefile.in new file mode 100644 index 0000000..4e4f363 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/Makefile.in @@ -0,0 +1,887 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_win32 +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_win32_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore/libecore.la \ + $(top_builddir)/src/lib/ecore_input/libecore_input.la +am_libecore_win32_la_OBJECTS = ecore_win32.lo ecore_win32_cursor.lo \ + ecore_win32_dnd.lo ecore_win32_dnd_enumformatetc.lo \ + ecore_win32_dnd_data_object.lo ecore_win32_dnd_drop_source.lo \ + ecore_win32_dnd_drop_target.lo ecore_win32_event.lo \ + ecore_win32_window.lo +libecore_win32_la_OBJECTS = $(am_libecore_win32_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_win32_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CXXLD) \ + $(AM_CXXFLAGS) $(CXXFLAGS) $(libecore_win32_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_$(V)) +am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) +am__v_CXX_0 = @echo " CXX " $@; +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CXXLD = $(am__v_CXXLD_$(V)) +am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CXXLD_0 = @echo " CXXLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_win32_la_SOURCES) +DIST_SOURCES = $(libecore_win32_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_input \ +@EFL_ECORE_WIN32_BUILD@ \ +@EINA_CFLAGS@ \ +@WIN32_CPPFLAGS@ + +lib_LTLIBRARIES = libecore_win32.la +includes_HEADERS = Ecore_Win32.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_win32_la_SOURCES = \ +ecore_win32.c \ +ecore_win32_cursor.c \ +ecore_win32_dnd.c \ +ecore_win32_dnd_enumformatetc.cpp \ +ecore_win32_dnd_data_object.cpp \ +ecore_win32_dnd_drop_source.cpp \ +ecore_win32_dnd_drop_target.cpp \ +ecore_win32_event.c \ +ecore_win32_window.c + +libecore_win32_la_LIBADD = \ +@ecore_win32_libs@ \ +@WIN32_LIBS@ \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@EINA_LIBS@ + +libecore_win32_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ +EXTRA_DIST = \ +ecore_win32_private.h \ +ecore_win32_dnd_enumformatetc.h \ +ecore_win32_dnd_data_object.h \ +ecore_win32_dnd_drop_source.h \ +ecore_win32_dnd_drop_target.h + +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_win32/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_win32/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_win32.la: $(libecore_win32_la_OBJECTS) $(libecore_win32_la_DEPENDENCIES) + $(AM_V_CXXLD)$(libecore_win32_la_LINK) -rpath $(libdir) $(libecore_win32_la_OBJECTS) $(libecore_win32_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_cursor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd_data_object.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd_drop_source.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd_drop_target.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_dnd_enumformatetc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_event.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_win32_window.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +.cpp.o: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32.c new file mode 100644 index 0000000..19ca3ed --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32.c @@ -0,0 +1,788 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +#include + +#include +#include +#include + +#include "Ecore_Win32.h" +#include "ecore_win32_private.h" + +/*============================================================================* + * Local * + *============================================================================*/ + +/** + * @cond LOCAL + */ + +/* OLE IID for Drag'n Drop */ + +# define INITGUID +# include +DEFINE_OLEGUID(IID_IEnumFORMATETC, 0x00000103L, 0, 0); +DEFINE_OLEGUID(IID_IDataObject, 0x0000010EL, 0, 0); +DEFINE_OLEGUID(IID_IDropSource, 0x00000121L, 0, 0); +DEFINE_OLEGUID(IID_IDropTarget, 0x00000122L, 0, 0); +DEFINE_OLEGUID(IID_IUnknown, 0x00000000L, 0, 0); + +#define IDI_ICON 101 + +static int _ecore_win32_init_count = 0; + +static void +_ecore_win32_size_check(Ecore_Win32_Window *win, int w, int h, int *dx, int *dy) +{ + int minimal_width; + int minimal_height; + + minimal_width = GetSystemMetrics(SM_CXMIN); + minimal_height = GetSystemMetrics(SM_CYMIN); + if ((w) < MAX(minimal_width, (int)win->min_width)) + *dx = 0; + if ((w) > (int)win->max_width) + *dx = 0; + if ((h) < MAX(minimal_height, (int)win->min_height)) + *dy = 0; + if ((h) > (int)win->max_height) + *dy = 0; +} + +LRESULT CALLBACK +_ecore_win32_window_procedure(HWND window, + UINT message, + WPARAM window_param, + LPARAM data_param) +{ + Ecore_Win32_Callback_Data *data; + POINTS point; + DWORD coord; + + data = (Ecore_Win32_Callback_Data *)malloc(sizeof(Ecore_Win32_Callback_Data)); + if (!data) return DefWindowProc(window, message, window_param, data_param); + + data->window = window; + data->message = message; + data->window_param = window_param; + data->data_param = data_param; + data->time = GetMessageTime(); + coord = GetMessagePos(); + point = MAKEPOINTS(coord); + data->x = point.x; + data->y = point.y; + + switch (data->message) + { + /* Keyboard input notifications */ + case WM_KEYDOWN: + case WM_SYSKEYDOWN: + INF("keydown message"); + _ecore_win32_event_handle_key_press(data, 1); + return 0; + case WM_CHAR: + case WM_SYSCHAR: + INF("char message"); + _ecore_win32_event_handle_key_press(data, 0); + return 0; + case WM_KEYUP: + case WM_SYSKEYUP: + INF("keyup message"); + _ecore_win32_event_handle_key_release(data); + return 0; + case WM_SETFOCUS: + INF("setfocus message"); + _ecore_win32_event_handle_focus_in(data); + return 0; + case WM_KILLFOCUS: + INF("kill focus message"); + _ecore_win32_event_handle_focus_out(data); + return 0; + /* Mouse input notifications */ + case WM_LBUTTONDOWN: + INF("left button down message"); + SetCapture(window); + _ecore_win32_event_handle_button_press(data, 1); + return 0; + case WM_MBUTTONDOWN: + INF("middle button down message"); + _ecore_win32_event_handle_button_press(data, 2); + return 0; + case WM_RBUTTONDOWN: + INF("right button down message"); + _ecore_win32_event_handle_button_press(data, 3); + return 0; + case WM_LBUTTONUP: + { + Ecore_Win32_Window *w = NULL; + + INF("left button up message"); + + ReleaseCapture(); + w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA); + if (w->drag.dragging) + { + w->drag.dragging = 0; + return 0; + } + + _ecore_win32_event_handle_button_release(data, 1); + return 0; + } + case WM_MBUTTONUP: + INF("middle button up message"); + _ecore_win32_event_handle_button_release(data, 2); + return 0; + case WM_RBUTTONUP: + INF("right button up message"); + _ecore_win32_event_handle_button_release(data, 3); + return 0; + case WM_MOUSEMOVE: + { + RECT rect; + Ecore_Win32_Window *w = NULL; + + INF("moue move message"); + + w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA); + + if (w->drag.dragging) + { + POINT pt; + + pt.x = GET_X_LPARAM(data_param); + pt.y = GET_Y_LPARAM(data_param); + if (ClientToScreen(window, &pt)) + { + if (w->drag.type == HTCAPTION) + { + int dx; + int dy; + + dx = pt.x - w->drag.px; + dy = pt.y - w->drag.py; + ecore_win32_window_move(w, w->drag.x + dx, w->drag.y + dy); + w->drag.x += dx; + w->drag.y += dy; + w->drag.px = pt.x; + w->drag.py = pt.y; + return 0; + } + if (w->drag.type == HTLEFT) + { + int dw; + + dw = pt.x - w->drag.px; + ecore_win32_window_move_resize(w, w->drag.x + dw, w->drag.y, w->drag.w - dw, w->drag.h); + w->drag.x += dw; + w->drag.w -= dw; + w->drag.px = pt.x; + w->drag.py = pt.y; + return 0; + } + if (w->drag.type == HTRIGHT) + { + int dw; + + dw = pt.x - w->drag.px; + ecore_win32_window_resize(w, w->drag.w + dw, w->drag.h); + w->drag.w += dw; + w->drag.px = pt.x; + w->drag.py = pt.y; + return 0; + } + if (w->drag.type == HTTOP) + { + int dh; + + dh = pt.y - w->drag.py; + ecore_win32_window_move_resize(w, w->drag.x, w->drag.y + dh, w->drag.w, w->drag.h - dh); + w->drag.y += dh; + w->drag.h -= dh; + w->drag.px = pt.x; + w->drag.py = pt.y; + return 0; + } + if (w->drag.type == HTBOTTOM) + { + int dh; + + dh = pt.y - w->drag.py; + ecore_win32_window_resize(w, w->drag.w, w->drag.h + dh); + w->drag.h += dh; + w->drag.px = pt.x; + w->drag.py = pt.y; + return 0; + } + if (w->drag.type == HTTOPLEFT) + { + int dx; + int dy; + int dh; + int dw; + + dw = pt.x - w->drag.px; + dh = pt.y - w->drag.py; + dx = dw; + dy = dh; + _ecore_win32_size_check(w, + w->drag.w - dw, w->drag.h - dh, + &dx, &dy); + + ecore_win32_window_move_resize(w, w->drag.x + dx, w->drag.y + dy, w->drag.w - dw, w->drag.h - dh); + w->drag.x += dx; + w->drag.y += dy; + w->drag.w -= dw; + w->drag.h -= dh; + w->drag.px = pt.x; + w->drag.py = pt.y; + return 0; + } + if (w->drag.type == HTTOPRIGHT) + { + int dx; + int dy; + int dh; + int dw; + + dw = pt.x - w->drag.px; + dh = pt.y - w->drag.py; + dx = dw; + dy = dh; + _ecore_win32_size_check(w, + w->drag.w, w->drag.h - dh, + &dx, &dy); + ecore_win32_window_move_resize(w, w->drag.x, w->drag.y + dy, w->drag.w, w->drag.h - dh); + w->drag.y += dy; + w->drag.w += dw; + w->drag.h -= dh; + w->drag.px = pt.x; + w->drag.py = pt.y; + return 0; + } + if (w->drag.type == HTBOTTOMLEFT) + { + int dx; + int dy; + int dh; + int dw; + + dw = pt.x - w->drag.px; + dh = pt.y - w->drag.py; + dx = dw; + dy = dh; + _ecore_win32_size_check(w, + w->drag.w - dw, w->drag.h + dh, + &dx, &dy); + ecore_win32_window_move_resize(w, w->drag.x + dx, w->drag.y, w->drag.w - dw, w->drag.h + dh); + w->drag.x += dx; + w->drag.w -= dw; + w->drag.h += dh; + w->drag.px = pt.x; + w->drag.py = pt.y; + return 0; + } + if (w->drag.type == HTBOTTOMRIGHT) + { + int dh; + int dw; + + dw = pt.x - w->drag.px; + dh = pt.y - w->drag.py; + ecore_win32_window_resize(w, w->drag.w + dw, w->drag.h + dh); + w->drag.w += dw; + w->drag.h += dh; + w->drag.px = pt.x; + w->drag.py = pt.y; + return 0; + } + } + } + + if (GetClientRect(window, &rect)) + { + POINT pt; + + INF("mouse in window"); + + pt.x = GET_X_LPARAM(data_param); + pt.y = GET_Y_LPARAM(data_param); + if (!PtInRect(&rect, pt)) + { + if (w->pointer_is_in) + { + w->pointer_is_in = 0; + _ecore_win32_event_handle_leave_notify(data); + } + } + else + { + if (!w->pointer_is_in) + { + w->pointer_is_in = 1; + _ecore_win32_event_handle_enter_notify(data); + } + } + } + else + { + ERR("GetClientRect() failed"); + } + _ecore_win32_event_handle_motion_notify(data); + + return 0; + } + case WM_MOUSEWHEEL: + INF("mouse wheel message"); + _ecore_win32_event_handle_button_press(data, 4); + return 0; + /* Window notifications */ + case WM_CREATE: + INF("create window message"); + _ecore_win32_event_handle_create_notify(data); + return 0; + case WM_DESTROY: + INF("destroy window message"); + _ecore_win32_event_handle_destroy_notify(data); + return 0; + case WM_SHOWWINDOW: + INF("show window message"); + if ((data->data_param == SW_OTHERUNZOOM) || + (data->data_param == SW_OTHERZOOM)) + return 0; + + if (data->window_param) + _ecore_win32_event_handle_map_notify(data); + else + _ecore_win32_event_handle_unmap_notify(data); + + return 0; + case WM_CLOSE: + INF("close window message"); + _ecore_win32_event_handle_delete_request(data); + return 0; + case WM_GETMINMAXINFO: + INF("get min max info window message"); + return TRUE; + case WM_MOVING: + INF("moving window message"); + _ecore_win32_event_handle_configure_notify(data); + return TRUE; + case WM_MOVE: + INF("move window message"); + return 0; + case WM_SIZING: + INF("sizing window message"); + _ecore_win32_event_handle_resize(data); + _ecore_win32_event_handle_configure_notify(data); + return TRUE; + case WM_SIZE: + INF("size window message"); + return 0; +/* case WM_WINDOWPOSCHANGING: */ +/* { */ +/* RECT rect; */ +/* GetClientRect(window, &rect); */ +/* printf (" *** ecore message : WINDOWPOSCHANGING %ld %ld\n", */ +/* rect.right - rect.left, rect.bottom - rect.top); */ +/* } */ +/* _ecore_win32_event_handle_configure_notify(data); */ +/* return 0; */ + case WM_WINDOWPOSCHANGED: + INF("position changed window message"); + _ecore_win32_event_handle_configure_notify(data); + _ecore_win32_event_handle_expose(data); + return 0; + case WM_ENTERSIZEMOVE: + INF("enter size move window message"); + return 0; + case WM_EXITSIZEMOVE: + INF("exit size move window message"); + return 0; + case WM_NCLBUTTONDOWN: + INF("non client left button down window message"); + + if (((DWORD)window_param == HTCAPTION) || + ((DWORD)window_param == HTBOTTOM) || + ((DWORD)window_param == HTBOTTOMLEFT) || + ((DWORD)window_param == HTBOTTOMRIGHT) || + ((DWORD)window_param == HTLEFT) || + ((DWORD)window_param == HTRIGHT) || + ((DWORD)window_param == HTTOP) || + ((DWORD)window_param == HTTOPLEFT) || + ((DWORD)window_param == HTTOPRIGHT)) + { + Ecore_Win32_Window *w; + + w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA); + ecore_win32_window_geometry_get(w, + NULL, NULL, + &w->drag.w, &w->drag.h); + SetCapture(window); + w->drag.type = (DWORD)window_param; + w->drag.px = GET_X_LPARAM(data_param); + w->drag.py = GET_Y_LPARAM(data_param); + w->drag.dragging = 1; + return 0; + } + return DefWindowProc(window, message, window_param, data_param); + case WM_SYSCOMMAND: + INF("sys command window message %d", (int)window_param); + + if ((((DWORD)window_param & 0xfff0) == SC_MOVE) || + (((DWORD)window_param & 0xfff0) == SC_SIZE)) + { + Ecore_Win32_Window *w; + + INF("sys command MOVE or SIZE window message : %dx%d", GET_X_LPARAM(data_param), GET_Y_LPARAM(data_param)); + + w = (Ecore_Win32_Window *)GetWindowLongPtr(window, GWLP_USERDATA); + w->drag.dragging = 1; + return 0; + } + return DefWindowProc(window, message, window_param, data_param); + /* GDI notifications */ + case WM_ERASEBKGND: + return 1; + case WM_PAINT: + { + RECT rect; + + INF("paint message"); + + if (GetUpdateRect(window, &rect, FALSE)) + { + PAINTSTRUCT ps; + HDC hdc; + + hdc = BeginPaint(window, &ps); + data->update = rect; + _ecore_win32_event_handle_expose(data); + EndPaint(window, &ps); + } + return 0; + } + case WM_SETREDRAW: + INF("set redraw message"); + return 0; + case WM_SYNCPAINT: + INF("sync paint message"); + return 0; + default: + return DefWindowProc(window, message, window_param, data_param); + } +} + +/** + * @endcond + */ + + +/*============================================================================* + * Global * + *============================================================================*/ + + +HINSTANCE _ecore_win32_instance = NULL; +double _ecore_win32_double_click_time = 0.25; +long _ecore_win32_event_last_time = 0; +Ecore_Win32_Window *_ecore_win32_event_last_window = NULL; +int _ecore_win32_log_dom_global = -1; + +int ECORE_WIN32_EVENT_MOUSE_IN = 0; +int ECORE_WIN32_EVENT_MOUSE_OUT = 0; +int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN = 0; +int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT = 0; +int ECORE_WIN32_EVENT_WINDOW_DAMAGE = 0; +int ECORE_WIN32_EVENT_WINDOW_CREATE = 0; +int ECORE_WIN32_EVENT_WINDOW_DESTROY = 0; +int ECORE_WIN32_EVENT_WINDOW_SHOW = 0; +int ECORE_WIN32_EVENT_WINDOW_HIDE = 0; +int ECORE_WIN32_EVENT_WINDOW_CONFIGURE = 0; +int ECORE_WIN32_EVENT_WINDOW_RESIZE = 0; +int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST = 0; + +/*============================================================================* + * API * + *============================================================================*/ + +/** + * @addtogroup Ecore_Win32_Group Ecore_Win32 library + * + * Ecore_Win32 is a library that wraps Windows graphic functions + * and integrate them nicely into the Ecore main loop. + * + * @section Ecore_Win32_Sec_Init Initialisation / Shutdown + * + * To fill... + * + * @section Ecore_Win32_Sec_Icons How to set icons to an application + * + * It is possible to also sets the icon of the application easily: + * + * @li Create an icon with your favorite image creator. The Gimp is a + * good choice. Create several images of size 16, 32 and 48. You can + * also create images of size 24, 64, 128 and 256. Paste all of them + * in the image of size 16 as a layer. Save the image of size 16 with + * the name my_icon.ico. Put it where the source code of the + * application is located. + * @li Create my_icon_rc.rc file with your code editor and add in it: + * @code + * 101 ICON DISCARDABLE "my_icon.ico" + * @endcode + * @li With Visual Studio, put that file in the 'Resource file' part + * of the project. + * @li With MinGW, you have to compile it with windres: + * @code + * windres my_icon_rc.rc my_icon_rc.o + * @endcode + * and add my_icon_rc.o to the object files of the application. + * + * @note The value 101 must not be changed, it's the ID used + * internally by Ecore_Win32 to get the icons. + * + * @{ + */ + +/** + * @brief Initialize the Ecore_Win32 library. + * + * @return 1 or greater on success, 0 on error. + * + * This function sets up the Windows graphic system. It returns 0 on + * failure, otherwise it returns the number of times it has already been + * called. + * + * When Ecore_Win32 is not used anymore, call ecore_win32_shutdown() + * to shut down the Ecore_Win32 library. + */ +EAPI int +ecore_win32_init() +{ + WNDCLASSEX wc; + HICON icon; + HICON icon_sm; + + if (++_ecore_win32_init_count != 1) + return _ecore_win32_init_count; + + if (!eina_init()) + return --_ecore_win32_init_count; + + _ecore_win32_log_dom_global = eina_log_domain_register + ("ecore_win32", ECORE_WIN32_DEFAULT_LOG_COLOR); + if (_ecore_win32_log_dom_global < 0) + { + EINA_LOG_ERR("Ecore_Win32: Could not register log domain"); + goto shutdown_eina; + } + + if (!ecore_event_init()) + { + ERR("Ecore_Win32: Could not init ecore_event"); + goto unregister_log_domain; + } + + _ecore_win32_instance = GetModuleHandle(NULL); + if (!_ecore_win32_instance) + { + ERR("GetModuleHandle() failed"); + goto shutdown_ecore_event; + } + + icon = LoadImage(_ecore_win32_instance, + MAKEINTRESOURCE(IDI_ICON), + IMAGE_ICON, + GetSystemMetrics(SM_CXICON), + GetSystemMetrics(SM_CYICON), + LR_DEFAULTCOLOR); + icon_sm = LoadImage(_ecore_win32_instance, + MAKEINTRESOURCE(IDI_ICON), + IMAGE_ICON, + GetSystemMetrics(SM_CXSMICON), + GetSystemMetrics(SM_CYSMICON), + LR_DEFAULTCOLOR); + if (!icon) + icon = LoadIcon (NULL, IDI_APPLICATION); + if (!icon_sm) + icon_sm = LoadIcon (NULL, IDI_APPLICATION); + + memset (&wc, 0, sizeof (WNDCLASSEX)); + wc.cbSize = sizeof (WNDCLASSEX); + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = _ecore_win32_window_procedure; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = _ecore_win32_instance; + wc.hIcon = icon; + wc.hCursor = LoadCursor (NULL, IDC_ARROW); + wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE); + wc.lpszMenuName = NULL; + wc.lpszClassName = ECORE_WIN32_WINDOW_CLASS; + wc.hIconSm = icon_sm; + + if(!RegisterClassEx(&wc)) + { + ERR("RegisterClass() failed"); + goto free_library; + } + + if (!ecore_win32_dnd_init()) + { + ERR("ecore_win32_dnd_init() failed"); + goto unregister_class; + } + + if (!ECORE_WIN32_EVENT_MOUSE_IN) + { + ECORE_WIN32_EVENT_MOUSE_IN = ecore_event_type_new(); + ECORE_WIN32_EVENT_MOUSE_OUT = ecore_event_type_new(); + ECORE_WIN32_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new(); + ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new(); + ECORE_WIN32_EVENT_WINDOW_DAMAGE = ecore_event_type_new(); + ECORE_WIN32_EVENT_WINDOW_CREATE = ecore_event_type_new(); + ECORE_WIN32_EVENT_WINDOW_DESTROY = ecore_event_type_new(); + ECORE_WIN32_EVENT_WINDOW_SHOW = ecore_event_type_new(); + ECORE_WIN32_EVENT_WINDOW_HIDE = ecore_event_type_new(); + ECORE_WIN32_EVENT_WINDOW_CONFIGURE = ecore_event_type_new(); + ECORE_WIN32_EVENT_WINDOW_RESIZE = ecore_event_type_new(); + ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new(); + } + + return _ecore_win32_init_count; + + unregister_class: + UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance); + free_library: + FreeLibrary(_ecore_win32_instance); + shutdown_ecore_event: + ecore_event_shutdown(); + unregister_log_domain: + eina_log_domain_unregister(_ecore_win32_log_dom_global); + shutdown_eina: + eina_shutdown(); + + return --_ecore_win32_init_count; +} + +/** + * @brief Shut down the Ecore_Win32 library. + * + * @return 0 when the library is completely shut down, 1 or + * greater otherwise. + * + * This function shuts down the Ecore_Win32 library. It returns 0 when it has + * been called the same number of times than ecore_win32_init(). In that case + * it shuts down all the Windows graphic system. + */ +EAPI int +ecore_win32_shutdown() +{ + if (--_ecore_win32_init_count != 0) + return _ecore_win32_init_count; + + ecore_win32_dnd_shutdown(); + + if (!UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance)) + INF("UnregisterClass() failed"); + + if (!FreeLibrary(_ecore_win32_instance)) + INF("FreeLibrary() failed"); + + _ecore_win32_instance = NULL; + + ecore_event_shutdown(); + eina_log_domain_unregister(_ecore_win32_log_dom_global); + _ecore_win32_log_dom_global = -1; + eina_shutdown(); + + return _ecore_win32_init_count; +} + +/** + * @brief Retrieve the depth of the screen. + * + * @return The depth of the screen. + * + * This function returns the depth of the screen. If an error occurs, + * it returns 0. + */ +EAPI int +ecore_win32_screen_depth_get() +{ + HDC dc; + int depth; + + INF("getting screen depth"); + + dc = GetDC(NULL); + if (!dc) + { + ERR("GetDC() failed"); + return 0; + } + + depth = GetDeviceCaps(dc, BITSPIXEL); + if (!ReleaseDC(NULL, dc)) + { + ERR("ReleaseDC() failed (device context not released)"); + } + + return depth; +} + +/** + * @brief Sets the timeout for a double and triple clicks to be flagged. + * + * @param t The time in seconds. + * + * This function sets the time @p t between clicks before the + * double_click flag is set in a button down event. If 3 clicks occur + * within double this time, the triple_click flag is also set. + */ +EAPI void +ecore_win32_double_click_time_set(double t) +{ + if (t < 0.0) t = 0.0; + _ecore_win32_double_click_time = t; +} + +/** + * @brief Retrieve the double and triple click flag timeout. + * + * @return The timeout for double clicks in seconds. + * + * This function returns the double clicks in seconds. If + * ecore_win32_double_click_time_set() has not been called, the + * default value is returned. See ecore_win32_double_click_time_set() + * for more informations. + */ +EAPI double +ecore_win32_double_click_time_get(void) +{ + return _ecore_win32_double_click_time; +} + +/** + * @brief Return the last event time. + * + * @return The last envent time. + * + * This function returns the last event time. + */ +EAPI long +ecore_win32_current_time_get(void) +{ + return _ecore_win32_event_last_time; +} + +/** + * @} + */ diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_cursor.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32_cursor.c new file mode 100644 index 0000000..9a5a7eb --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_cursor.c @@ -0,0 +1,306 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN + +#include + +#include "Ecore_Win32.h" +#include "ecore_win32_private.h" + +/*============================================================================* + * Local * + *============================================================================*/ + + +/*============================================================================* + * Global * + *============================================================================*/ + + +/*============================================================================* + * API * + *============================================================================*/ + +/** + * @addtogroup Ecore_Win32_Group Ecore_Win32 library + * + * @{ + */ + +/** + * @brief Create a new cursor. + * + * @param pixels_and The array of bytes containing the bit values for + * the AND mask of the cursor. + * @param pixels_xor The array of bytes containing the bit values for + * the XOR mask of the cursor. + * @param width The width of the cursor. + * @param height The height of the cursor. + * @param hot_x The horizontal position of the cursor's hot spot. + * @param hot_y The vertical position of the cursor's hot spot. + * @return A newly user-defined cursor. + * + * This function creates a new cursor of size @p width and @p + * height. They must be valid size. To determine the valid size of a + * cursor, useecore_win32_cursor_size_get(). @p pixels_and is an array + * of bytes (unsigned char) containing the bits of the cursor that + * will be visible. @p pixels_xor is similar but will allow the cursor + * to have a shape. Here is the truth table for the masks: + * + * + * + * + * + * + * + *
AND maskXOR maskDisplay
0 0 Black
0 1 White
1 0 Screen
1 1 Reverse screen
+ * + * @p hot_x and @p hot_y are the position of the hot spot of the + * cursor. If @p pixels_and or @p pixels_xor are @c NULL, the function + * returns NULL. If @p width or @p height does not match the valid + * size of a cursor, the function returns @c NULL. On success, the + * function creates a user-defined cursor, otherwise it returns + * @c NULL. + * + * Once the cursor is not used anymore, use ecore_win32_cursor_free() + * to free the ressources. + * + * Example of use: + * + * @code + * unsigned char pixels_and[] ={ + * 0xFF, 0xFC, 0x3F, 0xFF, // line 1 + * 0xFF, 0xC0, 0x1F, 0xFF, // line 2 + * 0xFF, 0x00, 0x3F, 0xFF, // line 3 + * 0xFE, 0x00, 0xFF, 0xFF, // line 4 + * + * 0xF7, 0x01, 0xFF, 0xFF, // line 5 + * 0xF0, 0x03, 0xFF, 0xFF, // line 6 + * 0xF0, 0x03, 0xFF, 0xFF, // line 7 + * 0xE0, 0x07, 0xFF, 0xFF, // line 8 + * + * 0xC0, 0x07, 0xFF, 0xFF, // line 9 + * 0xC0, 0x0F, 0xFF, 0xFF, // line 10 + * 0x80, 0x0F, 0xFF, 0xFF, // line 11 + * 0x80, 0x0F, 0xFF, 0xFF, // line 12 + * + * 0x80, 0x07, 0xFF, 0xFF, // line 13 + * 0x00, 0x07, 0xFF, 0xFF, // line 14 + * 0x00, 0x03, 0xFF, 0xFF, // line 15 + * 0x00, 0x00, 0xFF, 0xFF, // line 16 + * + * 0x00, 0x00, 0x7F, 0xFF, // line 17 + * 0x00, 0x00, 0x1F, 0xFF, // line 18 + * 0x00, 0x00, 0x0F, 0xFF, // line 19 + * 0x80, 0x00, 0x0F, 0xFF, // line 20 + * + * 0x80, 0x00, 0x07, 0xFF, // line 21 + * 0x80, 0x00, 0x07, 0xFF, // line 22 + * 0xC0, 0x00, 0x07, 0xFF, // line 23 + * 0xC0, 0x00, 0x0F, 0xFF, // line 24 + * + * 0xE0, 0x00, 0x0F, 0xFF, // line 25 + * 0xF0, 0x00, 0x1F, 0xFF, // line 26 + * 0xF0, 0x00, 0x1F, 0xFF, // line 27 + * 0xF8, 0x00, 0x3F, 0xFF, // line 28 + * + * 0xFE, 0x00, 0x7F, 0xFF, // line 29 + * 0xFF, 0x00, 0xFF, 0xFF, // line 30 + * 0xFF, 0xC3, 0xFF, 0xFF, // line 31 + * 0xFF, 0xFF, 0xFF, 0xFF // line 32 + * }; + * + * unsigned char pixels_xor[] = + * { + * 0x00, 0x00, 0x00, 0x00, // line 1 + * 0x00, 0x03, 0xC0, 0x00, // line 2 + * 0x00, 0x3F, 0x00, 0x00, // line 3 + * 0x00, 0xFE, 0x00, 0x00, // line 4 + * + * 0x0E, 0xFC, 0x00, 0x00, // line 5 + * 0x07, 0xF8, 0x00, 0x00, // line 6 + * 0x07, 0xF8, 0x00, 0x00, // line 7 + * 0x0F, 0xF0, 0x00, 0x00, // line 8 + * + * 0x1F, 0xF0, 0x00, 0x00, // line 9 + * 0x1F, 0xE0, 0x00, 0x00, // line 10 + * 0x3F, 0xE0, 0x00, 0x00, // line 11 + * 0x3F, 0xE0, 0x00, 0x00, // line 12 + * + * 0x3F, 0xF0, 0x00, 0x00, // line 13 + * 0x7F, 0xF0, 0x00, 0x00, // line 14 + * 0x7F, 0xF8, 0x00, 0x00, // line 15 + * 0x7F, 0xFC, 0x00, 0x00, // line 16 + * + * 0x7F, 0xFF, 0x00, 0x00, // line 17 + * 0x7F, 0xFF, 0x80, 0x00, // line 18 + * 0x7F, 0xFF, 0xE0, 0x00, // line 19 + * 0x3F, 0xFF, 0xE0, 0x00, // line 20 + * + * 0x3F, 0xC7, 0xF0, 0x00, // line 21 + * 0x3F, 0x83, 0xF0, 0x00, // line 22 + * 0x1F, 0x83, 0xF0, 0x00, // line 23 + * 0x1F, 0x83, 0xE0, 0x00, // line 24 + * + * 0x0F, 0xC7, 0xE0, 0x00, // line 25 + * 0x07, 0xFF, 0xC0, 0x00, // line 26 + * 0x07, 0xFF, 0xC0, 0x00, // line 27 + * 0x01, 0xFF, 0x80, 0x00, // line 28 + * + * 0x00, 0xFF, 0x00, 0x00, // line 29 + * 0x00, 0x3C, 0x00, 0x00, // line 30 + * 0x00, 0x00, 0x00, 0x00, // line 31 + * 0x00, 0x00, 0x00, 0x00 // line 32 + * }; + * + * Ecore_Win32_Cursor cursor = ecore_win32_cursor_new(pixels_and, pixels_xor, 32, 32, 19, 2); + * @endcode + */ +EAPI Ecore_Win32_Cursor * +ecore_win32_cursor_new(const void *pixels_and, + const void *pixels_xor, + int width, + int height, + int hot_x, + int hot_y) +{ + Ecore_Win32_Cursor *cursor = NULL; + int cursor_width; + int cursor_height; + + INF("creating cursor"); + + if (!pixels_and || !pixels_xor) + return NULL; + + cursor_width = GetSystemMetrics(SM_CXCURSOR); + cursor_height = GetSystemMetrics(SM_CYCURSOR); + + if ((cursor_width != width) || + (cursor_height != height)) + return NULL; + + if (!(cursor = CreateCursor(_ecore_win32_instance, + hot_x, hot_y, + width, height, + pixels_and, + pixels_xor))) + return NULL; + + return cursor; +} + +/** + * @brief Free the given cursor. + * + * @param cursor The cursor to free. + * + * This function free @p cursor. @p cursor must have been obtained + * with ecore_win32_cursor_new(). + */ +EAPI void +ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor) +{ + INF("destroying cursor"); + + DestroyCursor(cursor); +} + +/** + * @brief Create a cursor from a Windows ressource. + * + * @param shape The pre-defined shape of the cursor. + * @return The new cursor. + * + * This function returns a pre-defined cursor with a specified + * @p shape. This cursor does not need to be freed, as it is loaded + * from an existing resource. + */ +EAPI Ecore_Win32_Cursor * +ecore_win32_cursor_shaped_new(Ecore_Win32_Cursor_Shape shape) +{ + Ecore_Win32_Cursor *cursor = NULL; + const char *cursor_name; + + INF("geting shape cursor"); + + switch (shape) + { + case ECORE_WIN32_CURSOR_SHAPE_APP_STARTING: + cursor_name = IDC_APPSTARTING; + break; + case ECORE_WIN32_CURSOR_SHAPE_ARROW: + cursor_name = IDC_ARROW; + break; + case ECORE_WIN32_CURSOR_SHAPE_CROSS: + cursor_name = IDC_CROSS; + break; + case ECORE_WIN32_CURSOR_SHAPE_HAND: + cursor_name = IDC_HAND; + break; + case ECORE_WIN32_CURSOR_SHAPE_HELP: + cursor_name = IDC_HELP; + break; + case ECORE_WIN32_CURSOR_SHAPE_I_BEAM: + cursor_name = IDC_IBEAM; + break; + case ECORE_WIN32_CURSOR_SHAPE_NO: + cursor_name = IDC_NO; + break; + case ECORE_WIN32_CURSOR_SHAPE_SIZE_ALL: + cursor_name = IDC_SIZEALL; + break; + case ECORE_WIN32_CURSOR_SHAPE_SIZE_NESW: + cursor_name = IDC_SIZENESW; + break; + case ECORE_WIN32_CURSOR_SHAPE_SIZE_NS: + cursor_name = IDC_SIZENS; + break; + case ECORE_WIN32_CURSOR_SHAPE_SIZE_NWSE: + cursor_name = IDC_SIZENWSE; + break; + case ECORE_WIN32_CURSOR_SHAPE_SIZE_WE: + cursor_name = IDC_SIZEWE; + break; + case ECORE_WIN32_CURSOR_SHAPE_UP_ARROW: + cursor_name = IDC_UPARROW; + break; + case ECORE_WIN32_CURSOR_SHAPE_WAIT: + cursor_name = IDC_WAIT; + break; + default: + return NULL; + } + + if (!(cursor = LoadCursor(NULL, cursor_name))) + return NULL; + + return cursor; +} + +/** + * @brief Retrieve the size of a valid cursor. + * + * @param width The width of a valid cursor. + * @param height The height of a valid cursor. + * + * This function returns the size of a cursor that must be passed to + * ecore_win32_cursor_new(). @p width and @p height are buffers that + * will be filled with the correct size. They can be @c NULL. + */ +EAPI void +ecore_win32_cursor_size_get(int *width, int *height) +{ + INF("geting size cursor"); + + if (*width) *width = GetSystemMetrics(SM_CXCURSOR); + if (*height) *height = GetSystemMetrics(SM_CYCURSOR); +} + +/** + * @} + */ diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd.c new file mode 100755 index 0000000..a629c8b --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd.c @@ -0,0 +1,221 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "Ecore_Win32.h" +#include "ecore_win32_private.h" + +/*============================================================================* + * Local * + *============================================================================*/ + +/** + * @cond LOCAL + */ + + +static int _ecore_win32_dnd_init_count = 0; + +static HANDLE DataToHandle(const char *data, int size) +{ + char *ptr; + ptr = (char *)GlobalAlloc(GMEM_FIXED, size); + memcpy(ptr, data, size); + return ptr; +} + +/** + * @endcond + */ + + +/*============================================================================* + * Global * + *============================================================================*/ + + +/*============================================================================* + * API * + *============================================================================*/ + +/** + * @addtogroup Ecore_Win32_Group Ecore_Win32 library + * + * @{ + */ + +/** + * @brief Initialize the Ecore_Win32 Drag and Drop module. + * + * @return 1 or greater on success, 0 on error. + * + * This function initialize the Drag and Drop module. It returns 0 on + * failure, otherwise it returns the number of times it has already + * been called. + * + * When the Drag and Drop module is not used anymore, call + * ecore_win32_dnd_shutdown() to shut down the module. + */ +EAPI int +ecore_win32_dnd_init() +{ + if (_ecore_win32_dnd_init_count > 0) + { + _ecore_win32_dnd_init_count++; + return _ecore_win32_dnd_init_count; + } + + if (OleInitialize(NULL) != S_OK) + return 0; + + _ecore_win32_dnd_init_count++; + + return _ecore_win32_dnd_init_count; +} + +/** + * @brief Shut down the Ecore_Win32 Drag and Drop module. + * + * @return 0 when the module is completely shut down, 1 or + * greater otherwise. + * + * This function shuts down the Drag and Drop module. It returns 0 when it has + * been called the same number of times than ecore_win32_dnd_init(). In that case + * it shut down the module. + */ +EAPI int +ecore_win32_dnd_shutdown() +{ + _ecore_win32_dnd_init_count--; + if (_ecore_win32_dnd_init_count > 0) return _ecore_win32_dnd_init_count; + + OleUninitialize(); + + if (_ecore_win32_dnd_init_count < 0) _ecore_win32_dnd_init_count = 0; + + return _ecore_win32_dnd_init_count; +} + +/** + * @brief Begin a DnD operation. + * + * @param data The name pf the Drag operation. + * @param size The size of the name. + * @return EINA_TRUE on success, EINA_FALSE otherwise. + * + * This function start a Drag operation with the name @p data. If + * @p data is @c NULL, EINA_FALSE is returned. if @p size is less than + * 0, it is set to the length (as strlen()) of @p data. On success the + * function returns EINA_TRUE, otherwise it returns EINA_FALSE. + */ +EAPI Eina_Bool +ecore_win32_dnd_begin(const char *data, + int size) +{ + IDataObject *pDataObject = NULL; + IDropSource *pDropSource = NULL; + FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; + STGMEDIUM stgmed = { TYMED_HGLOBAL, { 0 }, 0 }; + Eina_Bool res = EINA_FALSE; + + if (!data) + return EINA_FALSE; + + if (size < 0) + size = strlen(data) + 1; + + stgmed.hGlobal = DataToHandle(data, size); + + // create the data object + pDataObject = (IDataObject *)_ecore_win32_dnd_data_object_new((void *)&fmtetc, + (void *)&stgmed, + 1); + pDropSource = (IDropSource *)_ecore_win32_dnd_drop_source_new(); + + if (pDataObject && pDropSource) + { + DWORD dwResult; + DWORD dwEffect = DROPEFFECT_COPY; + + // do the drag-drop! + dwResult = DoDragDrop(pDataObject, pDropSource, DROPEFFECT_COPY, &dwEffect); + + // finished. Check the return values to see if we need to do anything else + if (dwResult == DRAGDROP_S_DROP) + { + //printf(">>> \"%s\" Dropped <<<\n", str); + if(dwEffect == DROPEFFECT_MOVE) + { + // remove the data we just dropped from active document + } + } + //else if (dwResult == DRAGDROP_S_CANCEL) + // printf("DND cancelled\n"); + //else + // printf("DND error\n"); + + res = EINA_TRUE; + } + + _ecore_win32_dnd_data_object_free(pDataObject); + _ecore_win32_dnd_drop_source_free(pDropSource); + + // cleanup + ReleaseStgMedium(&stgmed); + + return res; +} + +/** + * @brief Register a Drop operation. + * + * @param window The destination of the Drop operation. + * @param callback The callback called when the Drop operation + * finishes. + * @return EINA_TRUE on success, EINA_FALSE otherwise. + * + * This function register a Drop operation on @p window. Once the Drop + * operation finishes, @p callback is called. If @p window is @c NULL, + * the function returns EINA_FALSE. On success, it returns EINA_TRUE, + * otherwise it returns EINA_FALSE. + */ +EAPI Eina_Bool +ecore_win32_dnd_register_drop_target(Ecore_Win32_Window *window, + Ecore_Win32_Dnd_DropTarget_Callback callback) +{ + Ecore_Win32_Window *wnd = (Ecore_Win32_Window *)window; + + if (!window) + return EINA_FALSE; + + wnd->dnd_drop_target = _ecore_win32_dnd_register_drop_window(wnd->window, + callback, + (void *)wnd); + return wnd->dnd_drop_target ? EINA_TRUE : EINA_FALSE; +} + +/** + * @brief Unregister a Drop operation. + * + * @param window The destination of the Drop operation. + * + * This function unregister a Drop operation on @p window. If + * @p window is @c NULL, the function does nothing. + */ +EAPI void +ecore_win32_dnd_unregister_drop_target(Ecore_Win32_Window *window) +{ + Ecore_Win32_Window *wnd = (Ecore_Win32_Window *)window; + + if (!window) + return; + + if (wnd->dnd_drop_target) + _ecore_win32_dnd_unregister_drop_window(wnd->window, wnd->dnd_drop_target); +} + +/** + * @} + */ diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.cpp b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.cpp new file mode 100644 index 0000000..75e26f5 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.cpp @@ -0,0 +1,209 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +#include + +#include "Ecore_Win32.h" +#include "ecore_win32_private.h" + +#include "ecore_win32_dnd_enumformatetc.h" +#include "ecore_win32_dnd_data_object.h" + + +static HGLOBAL DupGlobalMem(HGLOBAL hMem) +{ + DWORD len = (DWORD)GlobalSize(hMem); + PVOID source = GlobalLock(hMem); + PVOID dest = GlobalAlloc(GMEM_FIXED, len); + memcpy(dest, source, len); + GlobalUnlock(hMem); + return dest; +} + +// structors + +DataObject::DataObject(FORMATETC *fmtetc, STGMEDIUM *stgmed, int count) +{ + assert(fmtetc != NULL); + assert(stgmed != NULL); + assert(count > 0); + + // reference count must ALWAYS start at 1 + ref_count_ = 1; + formats_num_ = count; + + format_etc_ = new FORMATETC[count]; + stg_medium_ = new STGMEDIUM[count]; + + for(int i = 0; i < count; i++) + { + format_etc_[i] = fmtetc[i]; + stg_medium_[i] = stgmed[i]; + } +} + +DataObject::~DataObject() +{ + delete[] format_etc_; + delete[] stg_medium_; +} + + +// IUnknown + +HRESULT DataObject::QueryInterface(REFIID iid, void **ppvObject) +{ + // check to see what interface has been requested + if ((iid == IID_IDataObject) || (iid == IID_IUnknown)) + { + AddRef(); + *ppvObject = this; + return S_OK; + } + *ppvObject = 0; + return E_NOINTERFACE; +} + +ULONG DataObject::AddRef() +{ + return InterlockedIncrement(&ref_count_); +} + +ULONG DataObject::Release() +{ + LONG count = InterlockedDecrement(&ref_count_); + if(count == 0) + { + delete this; + return 0; + } + return count; +} + +// IDataObject + +HRESULT DataObject::GetData(FORMATETC *pFormatEtc, STGMEDIUM *pMedium) +{ + assert(pMedium != NULL); + int idx; + + // try to match the specified FORMATETC with one of our supported formats + if((idx = lookup_format_etc(pFormatEtc)) == -1) + return DV_E_FORMATETC; + + // found a match - transfer data into supplied storage medium + pMedium->tymed = format_etc_[idx].tymed; + pMedium->pUnkForRelease = 0; + + // copy the data into the caller's storage medium + switch(format_etc_[idx].tymed) + { + case TYMED_HGLOBAL: + pMedium->hGlobal = DupGlobalMem(stg_medium_[idx].hGlobal); + break; + + default: + return DV_E_FORMATETC; + } + + return S_OK; +} + +HRESULT DataObject::GetDataHere(FORMATETC *pFormatEtc __UNUSED__, STGMEDIUM *pmedium __UNUSED__) +{ + return DATA_E_FORMATETC; +} + +HRESULT DataObject::QueryGetData(FORMATETC *pFormatEtc) +{ + return (lookup_format_etc(pFormatEtc) == -1) ? DV_E_FORMATETC : S_OK; +} + +HRESULT DataObject::GetCanonicalFormatEtc(FORMATETC *pFormatEct __UNUSED__, FORMATETC *pFormatEtcOut) +{ + // Apparently we have to set this field to NULL even though we don't do anything else + pFormatEtcOut->ptd = NULL; + return E_NOTIMPL; +} + +HRESULT DataObject::SetData(FORMATETC *pFormatEtc __UNUSED__, STGMEDIUM *pMedium __UNUSED__, BOOL fRelease __UNUSED__) +{ + return E_NOTIMPL; +} + +HRESULT DataObject::EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc) +{ + // only the get direction is supported for OLE + if(dwDirection == DATADIR_GET) + { + // for Win2k+ you can use the SHCreateStdEnumFmtEtc API call, however + // to support all Windows platforms we need to implement IEnumFormatEtc ourselves. + return CreateEnumFormatEtc(formats_num_, format_etc_, ppEnumFormatEtc); + } + else + { + // the direction specified is not supported for drag+drop + return E_NOTIMPL; + } +} + +HRESULT DataObject::DAdvise(FORMATETC *pFormatEtc __UNUSED__, DWORD advf __UNUSED__, IAdviseSink *, DWORD *) +{ + return OLE_E_ADVISENOTSUPPORTED; +} + +HRESULT DataObject::DUnadvise(DWORD dwConnection __UNUSED__) +{ + return OLE_E_ADVISENOTSUPPORTED; +} + +HRESULT DataObject::EnumDAdvise(IEnumSTATDATA **ppEnumAdvise __UNUSED__) +{ + return OLE_E_ADVISENOTSUPPORTED; +} + +// internal helper function + +int DataObject::lookup_format_etc(FORMATETC *pFormatEtc) +{ + // check each of our formats in turn to see if one matches + for(int i = 0; i < formats_num_; i++) + { + if((format_etc_[i].tymed & pFormatEtc->tymed) && + (format_etc_[i].cfFormat == pFormatEtc->cfFormat) && + (format_etc_[i].dwAspect == pFormatEtc->dwAspect)) + { + // return index of stored format + return i; + } + } + + // error, format not found + return -1; +} + +void *_ecore_win32_dnd_data_object_new(void *fmtetc, void *stgmeds, int count) +{ + IDataObject *object = new DataObject((FORMATETC *)fmtetc, (STGMEDIUM *)stgmeds, (UINT)count); + assert(object != NULL); + return object; +} + +void _ecore_win32_dnd_data_object_free(void *data_object) +{ + if (!data_object) + return; + + IDataObject *object = (IDataObject *)data_object; + object->Release(); +} diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.h b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.h new file mode 100644 index 0000000..3d289cf --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_data_object.h @@ -0,0 +1,49 @@ +#ifndef __ECORE_WIN32_DND_DATA_OBJECT_H__ +#define __ECORE_WIN32_DND_DATA_OBJECT_H__ + + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +#include + + +class DataObject : public IDataObject +{ + private: + + LONG ref_count_; + int formats_num_; + FORMATETC *format_etc_; + STGMEDIUM *stg_medium_; + + private: // internal helper function + + int lookup_format_etc(FORMATETC *format_etc); + + public: // structors + + DataObject(FORMATETC *fmtetc, STGMEDIUM *stgmed, int count); + ~DataObject(); + + public: // IUnknown + + HRESULT __stdcall QueryInterface(REFIID iid, void **ppvObject); + ULONG __stdcall AddRef(); + ULONG __stdcall Release(); + + public: // IDataObject + + HRESULT __stdcall GetData(FORMATETC *pFormatEtc, STGMEDIUM *pmedium); + HRESULT __stdcall GetDataHere(FORMATETC *pFormatEtc, STGMEDIUM *pmedium); + HRESULT __stdcall QueryGetData(FORMATETC *pFormatEtc); + HRESULT __stdcall GetCanonicalFormatEtc(FORMATETC *pFormatEct, FORMATETC *pFormatEtcOut); + HRESULT __stdcall SetData(FORMATETC *pFormatEtc, STGMEDIUM *pMedium, BOOL fRelease); + HRESULT __stdcall EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppEnumFormatEtc); + HRESULT __stdcall DAdvise(FORMATETC *pFormatEtc, DWORD advf, IAdviseSink *, DWORD *); + HRESULT __stdcall DUnadvise(DWORD dwConnection); + HRESULT __stdcall EnumDAdvise(IEnumSTATDATA **ppEnumAdvise); +}; + + +#endif /* __ECORE_WIN32_DND_DATA_OBJECT_H__ */ diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.cpp b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.cpp new file mode 100644 index 0000000..bea7736 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.cpp @@ -0,0 +1,92 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "ecore_win32_dnd_drop_source.h" + +#include "ecore_win32_private.h" + +// structors + +// reference count must ALWAYS start at 1 +DropSource::DropSource() : ref_count_(1) +{ } + + +// IUnknown + +HRESULT DropSource::QueryInterface(REFIID iid, void **ppvObject) +{ + // check to see what interface has been requested + if (iid == IID_IDropSource || iid == IID_IUnknown) + { + AddRef(); + *ppvObject = this; + return S_OK; + } + *ppvObject = 0; + return E_NOINTERFACE; +} + +ULONG DropSource::AddRef() +{ + return InterlockedIncrement(&ref_count_); +} + +ULONG DropSource::Release() +{ + LONG count = InterlockedDecrement(&ref_count_); + if(count == 0) + { + delete this; + return 0; + } + return count; +} + + +// IDropSource + +HRESULT DropSource::QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) +{ + // if the Escape key has been pressed since the last call, cancel the drop + if(fEscapePressed == TRUE) + return DRAGDROP_S_CANCEL; + + // if the LeftMouse button has been released, then do the drop! + if((grfKeyState & MK_LBUTTON) == 0) + return DRAGDROP_S_DROP; + + // continue with the drag-drop + return S_OK; +} + +HRESULT DropSource::GiveFeedback(DWORD dwEffect __UNUSED__) +{ + return DRAGDROP_S_USEDEFAULTCURSORS; +} + + +// ecore_win32 private functions + +void *_ecore_win32_dnd_drop_source_new() +{ + IDropSource *object = new DropSource(); + assert(object != NULL); + return object; +} + +void _ecore_win32_dnd_drop_source_free(void *drop_source) +{ + if (!drop_source) + return; + + IDropSource *object = (IDropSource *)drop_source; + object->Release(); +} diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.h b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.h new file mode 100644 index 0000000..9081f46 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_source.h @@ -0,0 +1,36 @@ +#ifndef __ECORE_WIN32_DND_DROP_SOURCE_H__ +#define __ECORE_WIN32_DND_DROP_SOURCE_H__ + + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +#include + +#include "Ecore_Win32.h" + + +class DropSource : public IDropSource +{ + private: + + LONG ref_count_; + + public: // structors + + DropSource(); + + public: // IUnknown + + HRESULT __stdcall QueryInterface(REFIID iid, void ** ppvObject); + ULONG __stdcall AddRef(); + ULONG __stdcall Release(); + + public: // IDropSource + + HRESULT __stdcall QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState); + HRESULT __stdcall GiveFeedback(DWORD dwEffect); +}; + + +#endif /* __ECORE_WIN32_DND_DROP_SOURCE_H__ */ diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.cpp b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.cpp new file mode 100644 index 0000000..e19fb5d --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.cpp @@ -0,0 +1,232 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "ecore_win32_dnd_drop_target.h" + +#include "ecore_win32_private.h" + + +// structors + +DropTarget::DropTarget(HWND window, Ecore_Win32_Dnd_DropTarget_Callback callback, void *window_obj_ptr) + : ref_count_(1) + , window_(window) + , allow_drop_(false) + , drop_callback_(callback) + ,drop_callback_ptr_(window_obj_ptr) +{ } + + +// IUnknown + +HRESULT DropTarget::QueryInterface(REFIID iid, void **ppvObject) +{ + // check to see what interface has been requested + if (iid == IID_IDropTarget || iid == IID_IUnknown) + { + AddRef(); + *ppvObject = this; + return S_OK; + } + *ppvObject = 0; + + return E_NOINTERFACE; +} + +ULONG DropTarget::AddRef() +{ + return InterlockedIncrement(&ref_count_); +} + +ULONG DropTarget::Release() +{ + LONG count = InterlockedDecrement(&ref_count_); + if (count == 0) + { + delete this; + return 0; + } + + return count; +} + + +// IDropTarget + +HRESULT DropTarget::DragEnter(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) +{ + // does the dataobject contain data we want? + allow_drop_ = QueryDataObject(pDataObject) && + (drop_callback_ == NULL || + (drop_callback_(drop_callback_ptr_, ECORE_WIN32_DND_EVENT_DRAG_ENTER, pt.x, pt.y, NULL, 0) != 0)); + + if (allow_drop_) + { + // get the dropeffect based on keyboard state + *pdwEffect = DropEffect(grfKeyState, pt, *pdwEffect); + SetFocus(window_); + //PositionCursor(_hwnd, pt); + } + else + *pdwEffect = DROPEFFECT_NONE; + return S_OK; +} + +HRESULT DropTarget::DragOver(DWORD grfKeyState, POINTL pt, DWORD * pdwEffect) +{ + allow_drop_ = + (drop_callback_ == NULL) || + (drop_callback_(drop_callback_ptr_, ECORE_WIN32_DND_EVENT_DRAG_OVER, pt.x, pt.y, NULL, 0) != 0); + + if (allow_drop_) + { + *pdwEffect = DropEffect(grfKeyState, pt, *pdwEffect); + //PositionCursor(m_hWnd, pt); + } + else + { + *pdwEffect = DROPEFFECT_NONE; + } + + return S_OK; +} + +HRESULT DropTarget::DragLeave() +{ + POINT pt; + + GetCursorPos(&pt); + if (drop_callback_ != NULL) + drop_callback_(drop_callback_ptr_, ECORE_WIN32_DND_EVENT_DRAG_LEAVE, pt.x, pt.y, NULL, 0); + + return S_OK; +} + +HRESULT DropTarget::Drop(IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect) +{ + if (allow_drop_) + { + // construct a FORMATETC object + FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; + STGMEDIUM stgmed; + + // See if the dataobject contains any TEXT stored as a HGLOBAL + if (pDataObject->QueryGetData(&fmtetc) == S_OK) + { + // Yippie! the data is there, so go get it! + if (pDataObject->GetData(&fmtetc, &stgmed) == S_OK) + { + // we asked for the data as a HGLOBAL, so access it appropriately + PVOID data = GlobalLock(stgmed.hGlobal); + UINT size = GlobalSize(stgmed.hGlobal); + + if (drop_callback_ != NULL) + { + drop_callback_(drop_callback_ptr_, + ECORE_WIN32_DND_EVENT_DROP, + pt.x, pt.y, + data, size); + } + + GlobalUnlock(stgmed.hGlobal); + + // release the data using the COM API + ReleaseStgMedium(&stgmed); + } + } + *pdwEffect = DropEffect(grfKeyState, pt, *pdwEffect); + } + else + { + *pdwEffect = DROPEFFECT_NONE; + } + + return S_OK; +} + + +// internal helper function + +DWORD DropTarget::DropEffect(DWORD grfKeyState, POINTL pt __UNUSED__, DWORD dwAllowed) +{ + DWORD dwEffect = 0; + + // 1. check "pt" -> do we allow a drop at the specified coordinates? + + // 2. work out that the drop-effect should be based on grfKeyState + if (grfKeyState & MK_CONTROL) + { + dwEffect = dwAllowed & DROPEFFECT_COPY; + } + else if (grfKeyState & MK_SHIFT) + { + dwEffect = dwAllowed & DROPEFFECT_MOVE; + } + + // 3. no key-modifiers were specified (or drop effect not allowed), so + // base the effect on those allowed by the dropsource + if (dwEffect == 0) + { + if (dwAllowed & DROPEFFECT_COPY) dwEffect = DROPEFFECT_COPY; + if (dwAllowed & DROPEFFECT_MOVE) dwEffect = DROPEFFECT_MOVE; + } + + return dwEffect; +} + +bool DropTarget::QueryDataObject(IDataObject *pDataObject) +{ + FORMATETC fmtetc = { CF_TEXT, 0, DVASPECT_CONTENT, -1, TYMED_HGLOBAL }; + + // does the data object support CF_TEXT using a HGLOBAL? + return pDataObject->QueryGetData(&fmtetc) == S_OK; +} + + +// ecore_win32 private functions + +void *_ecore_win32_dnd_register_drop_window(HWND hwnd, Ecore_Win32_Dnd_DropTarget_Callback callback, void *ptr) +{ + DropTarget *pDropTarget = new DropTarget(hwnd, callback, ptr); + + if (pDropTarget == NULL) + return NULL; + + // acquire a strong lock + if (FAILED(CoLockObjectExternal(pDropTarget, TRUE, FALSE))) + { + delete pDropTarget; + return NULL; + } + + // tell OLE that the window is a drop target + if (FAILED(RegisterDragDrop(hwnd, pDropTarget))) + { + delete pDropTarget; + return NULL; + } + + return pDropTarget; +} + +void _ecore_win32_dnd_unregister_drop_window(HWND hwnd, void *drop_target) +{ + IDropTarget *pDropTarget = (IDropTarget *)drop_target; + + if (drop_target == NULL) + return; + + // remove drag+drop + RevokeDragDrop(hwnd); + + // remove the strong lock + CoLockObjectExternal(pDropTarget, FALSE, TRUE); + + // release our own reference + pDropTarget->Release(); +} diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.h b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.h new file mode 100644 index 0000000..24c3de3 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_drop_target.h @@ -0,0 +1,47 @@ +#ifndef __ECORE_WIN32_DND_DROP_TARGET_H__ +#define __ECORE_WIN32_DND_DROP_TARGET_H__ + + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +#include + +#include "Ecore_Win32.h" + + +class DropTarget : public IDropTarget +{ + private: + + LONG ref_count_; + HWND window_; + bool allow_drop_; + Ecore_Win32_Dnd_DropTarget_Callback drop_callback_; + void *drop_callback_ptr_; + + private: // internal helper function + + DWORD DropEffect(DWORD grfKeyState, POINTL pt, DWORD dwAllowed); + bool QueryDataObject(IDataObject *pDataObject); + + public: // structors + + DropTarget(HWND hwnd, Ecore_Win32_Dnd_DropTarget_Callback callback, void *window_obj_ptr); + +public: // IUnknown + + HRESULT __stdcall QueryInterface(REFIID iid, void ** ppvObject); + ULONG __stdcall AddRef(); + ULONG __stdcall Release(); + + public: // IDropTarget + + HRESULT __stdcall DragEnter(IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect); + HRESULT __stdcall DragOver(DWORD grfKeyState, POINTL pt, DWORD * pdwEffect); + HRESULT __stdcall DragLeave(); + HRESULT __stdcall Drop(IDataObject * pDataObject, DWORD grfKeyState, POINTL pt, DWORD * pdwEffect); +}; + + +#endif /* __ECORE_WIN32_DND_DROP_TARGET_H__ */ diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.cpp b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.cpp new file mode 100644 index 0000000..a3858bc --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.cpp @@ -0,0 +1,157 @@ + +#include + +#include "ecore_win32_dnd_enumformatetc.h" + + +// structors + +CEnumFormatEtc::CEnumFormatEtc(FORMATETC *format_etc, int formats_num) + : ref_count_(1) + , index_(0) + , formats_num_(formats_num) + , format_etc_(new FORMATETC[formats_num]) +{ + // make a new copy of each FORMATETC structure + for (unsigned int i = 0; i < formats_num_; i++) + { + DeepCopyFormatEtc(&format_etc_[i], &format_etc[i]); + } +} + +CEnumFormatEtc::~CEnumFormatEtc() +{ + if (format_etc_) + { + // first free any DVTARGETDEVICE structures + for (ULONG i = 0; i < formats_num_; i++) + { + if (format_etc_[i].ptd) + CoTaskMemFree(format_etc_[i].ptd); + } + + // now free the main array + delete[] format_etc_; + } +} + +// IUnknown + +ULONG __stdcall CEnumFormatEtc::AddRef(void) +{ + // increment object reference count + return InterlockedIncrement(&ref_count_); +} + +ULONG __stdcall CEnumFormatEtc::Release(void) +{ + // decrement object reference count + LONG count = InterlockedDecrement(&ref_count_); + + if (count == 0) + { + delete this; + return 0; + } + else + { + return count; + } +} + +HRESULT __stdcall CEnumFormatEtc::QueryInterface(REFIID iid, void **ppvObject) +{ + // check to see what interface has been requested + if ((iid == IID_IEnumFORMATETC) || (iid == IID_IUnknown)) + { + AddRef(); + *ppvObject = this; + return S_OK; + } + else + { + *ppvObject = 0; + return E_NOINTERFACE; + } +} + +// IEnumFormatEtc + +HRESULT CEnumFormatEtc::Reset(void) +{ + index_ = 0; + return S_OK; +} + +HRESULT CEnumFormatEtc::Skip(ULONG celt) +{ + index_ += celt; + return (index_ <= formats_num_) ? S_OK : S_FALSE; +} + +HRESULT CEnumFormatEtc::Clone(IEnumFORMATETC **ppEnumFormatEtc) +{ + HRESULT hResult; + + // make a duplicate enumerator + hResult = CreateEnumFormatEtc(formats_num_, format_etc_, ppEnumFormatEtc); + + if (hResult == S_OK) + { + // manually set the index state + ((CEnumFormatEtc *)*ppEnumFormatEtc)->index_ = index_; + } + + return hResult; +} + +HRESULT CEnumFormatEtc::Next(ULONG celt, FORMATETC *pFormatEtc, ULONG *pceltFetched) +{ + ULONG copied = 0; + + // validate arguments + if ((celt == 0) || (pFormatEtc == 0)) + return E_INVALIDARG; + + // copy the FORMATETC structures into the caller's buffer + while (index_ < formats_num_ && copied < celt) + { + DeepCopyFormatEtc(&pFormatEtc[copied], &format_etc_[index_]); + copied++; + index_++; + } + + // store result + if (pceltFetched != 0) + *pceltFetched = copied; + + // did we copy all that was requested? + return (copied == celt) ? S_OK : S_FALSE; +} + +// external functions + +void DeepCopyFormatEtc(FORMATETC *dest, FORMATETC *source) +{ + // copy the source FORMATETC into dest + *dest = *source; + + if (source->ptd) + { + // allocate memory for the DVTARGETDEVICE if necessary + dest->ptd = (DVTARGETDEVICE*)CoTaskMemAlloc(sizeof(DVTARGETDEVICE)); + + // copy the contents of the source DVTARGETDEVICE into dest->ptd + *(dest->ptd) = *(source->ptd); + } +} + +HRESULT CreateEnumFormatEtc(UINT cfmt, FORMATETC *afmt, IEnumFORMATETC **ppEnumFormatEtc) +{ + if((cfmt == 0) || (afmt == 0) || (ppEnumFormatEtc == 0)) + return E_INVALIDARG; + + *ppEnumFormatEtc = new CEnumFormatEtc(afmt, cfmt); + + return (*ppEnumFormatEtc) ? S_OK : E_OUTOFMEMORY; +} diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.h b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.h new file mode 100644 index 0000000..9f17f56 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_dnd_enumformatetc.h @@ -0,0 +1,50 @@ +#ifndef __ECORE_WIN32_DND_ENUMFORMATETC_H__ +#define __ECORE_WIN32_DND_ENUMFORMATETC_H__ + + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +#include + + +class CEnumFormatEtc : public IEnumFORMATETC +{ + private: + + LONG ref_count_; // Reference count for this COM interface + ULONG index_; // current enumerator index + ULONG formats_num_; // number of FORMATETC members + FORMATETC *format_etc_; // array of FORMATETC objects + + public: // structors + + CEnumFormatEtc(FORMATETC *pFormatEtc, int nNumFormats); + + ~CEnumFormatEtc(); + + public: // IUnknown + + HRESULT __stdcall QueryInterface (REFIID iid, void ** ppvObject); + + ULONG __stdcall AddRef (void); + + ULONG __stdcall Release (void); + + public: // IEnumFormatEtc + + HRESULT __stdcall Next (ULONG celt, FORMATETC * rgelt, ULONG * pceltFetched); + + HRESULT __stdcall Skip (ULONG celt); + + HRESULT __stdcall Reset (void); + + HRESULT __stdcall Clone (IEnumFORMATETC ** ppEnumFormatEtc); +}; + +void DeepCopyFormatEtc(FORMATETC *dest, FORMATETC *source); + +HRESULT CreateEnumFormatEtc(UINT cfmt, FORMATETC *afmt, IEnumFORMATETC **ppEnumFormatEtc); + + +#endif /* __ECORE_WIN32_DND_ENUMFORMATETC_H__ */ diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c new file mode 100644 index 0000000..63356d3 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c @@ -0,0 +1,1231 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include /* for printf */ + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN +#include + +#include +#include +#include + +#include "Ecore_Win32.h" +#include "ecore_win32_private.h" + + +typedef enum +{ + ECORE_WIN32_KEY_MASK_LSHIFT = 1 << 0, + ECORE_WIN32_KEY_MASK_RSHIFT = 1 << 1, + ECORE_WIN32_KEY_MASK_LCONTROL = 1 << 2, + ECORE_WIN32_KEY_MASK_RCONTROL = 1 << 3, + ECORE_WIN32_KEY_MASK_LMENU = 1 << 4, + ECORE_WIN32_KEY_MASK_RMENU = 1 << 5 +} Ecore_Win32_Key_Mask; + +/***** Private declarations *****/ + + +static Ecore_Win32_Window *_ecore_win32_mouse_down_last_window = NULL; +static Ecore_Win32_Window *_ecore_win32_mouse_down_last_last_window = NULL; +static long _ecore_win32_mouse_down_last_time = 0 ; +static long _ecore_win32_mouse_down_last_last_time = 0 ; +static int _ecore_win32_mouse_down_did_triple = 0; +static int _ecore_win32_mouse_up_count = 0; +static Ecore_Win32_Key_Mask _ecore_win32_key_mask = 0; + +static void _ecore_win32_event_free_key_down(void *data, + void *ev); + +static void _ecore_win32_event_free_key_up(void *data, + void *ev); + +static int _ecore_win32_event_keystroke_get(int key, + int is_extended, + Eina_Bool is_down, + char **keyname, + char **keysymbol, + char **keycompose, + unsigned int *modifiers); + +static int _ecore_win32_event_char_get(int key, + char **keyname, + char **keysymbol, + char **keycompose); + + +/***** Global functions definitions *****/ + +void +_ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, + int is_keystroke) +{ + Ecore_Event_Key *e; + + INF("key pressed"); + + e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key)); + if (!e) return; + + if (is_keystroke) + { + if (!_ecore_win32_event_keystroke_get(msg->window_param, + msg->data_param & 0x01000000, + EINA_TRUE, + (char **)&e->keyname, + (char **)&e->key, + (char **)&e->string, + &e->modifiers)) + { + free(e); + return; + } + } + else + { + if (!_ecore_win32_event_char_get(LOWORD(msg->window_param), + (char **)&e->keyname, + (char **)&e->key, + (char **)&e->string)) + { + free(e); + return; + } + } + + e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); + if (!e->window) + { + free(e); + return; + } + e->event_window = e->window; + e->timestamp = msg->time; + + _ecore_win32_event_last_time = e->timestamp; + + ecore_event_add(ECORE_EVENT_KEY_DOWN, e, _ecore_win32_event_free_key_down, NULL); +} + +void +_ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg) +{ + Ecore_Event_Key *e; + + INF("key released"); + + e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key)); + if (!e) return; + + if (!_ecore_win32_event_keystroke_get(LOWORD(msg->window_param), + msg->data_param & 0x01000000, + EINA_FALSE, + (char **)&e->keyname, + (char **)&e->key, + (char **)&e->string, + &e->modifiers)) + { + if (!_ecore_win32_event_char_get(LOWORD(msg->window_param), + (char **)&e->keyname, + (char **)&e->key, + (char **)&e->string)) + { + free(e); + return; + } + } + + e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); + if (!e->window) + { + free(e); + return; + } + e->event_window = e->window; + e->timestamp = msg->time; + + _ecore_win32_event_last_time = e->timestamp; + + ecore_event_add(ECORE_EVENT_KEY_UP, e, _ecore_win32_event_free_key_up, NULL); +} + +void +_ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, + int button) +{ + Ecore_Win32_Window *window; + + INF("mouse button pressed"); + + window = (Ecore_Win32_Window *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + + if (button > 3) + { + Ecore_Event_Mouse_Wheel *e; + + e = (Ecore_Event_Mouse_Wheel *)calloc(1, sizeof(Ecore_Event_Mouse_Wheel)); + if (!e) return; + + e->window = (Ecore_Window)window; + e->event_window = e->window; + e->direction = 0; + /* wheel delta is positive or negative, never 0 */ + e->z = GET_WHEEL_DELTA_WPARAM(msg->window_param) > 0 ? -1 : 1; + e->x = GET_X_LPARAM(msg->data_param); + e->y = GET_Y_LPARAM(msg->data_param); + e->timestamp = msg->time; + + _ecore_win32_event_last_time = e->timestamp; + _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; + + ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL); + } + else + { + { + Ecore_Event_Mouse_Move *e; + + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); + if (!e) return; + + e->window = (Ecore_Window)window; + e->event_window = e->window; + e->x = GET_X_LPARAM(msg->data_param); + e->y = GET_Y_LPARAM(msg->data_param); + e->timestamp = msg->time; + + _ecore_win32_event_last_time = e->timestamp; + _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); + } + + { + Ecore_Event_Mouse_Button *e; + + if (_ecore_win32_mouse_down_did_triple) + { + _ecore_win32_mouse_down_last_window = NULL; + _ecore_win32_mouse_down_last_last_window = NULL; + _ecore_win32_mouse_down_last_time = 0; + _ecore_win32_mouse_down_last_last_time = 0; + } + + e = (Ecore_Event_Mouse_Button *)calloc(1, sizeof(Ecore_Event_Mouse_Button)); + if (!e) return; + + e->window = (Ecore_Window)window; + e->event_window = e->window; + e->buttons = button; + e->x = GET_X_LPARAM(msg->data_param); + e->y = GET_Y_LPARAM(msg->data_param); + e->timestamp = msg->time; + + if (((e->timestamp - _ecore_win32_mouse_down_last_time) <= (unsigned long)(1000 * _ecore_win32_double_click_time)) && + (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window)) + e->double_click = 1; + + if (((e->timestamp - _ecore_win32_mouse_down_last_last_time) <= (unsigned long)(2 * 1000 * _ecore_win32_double_click_time)) && + (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window) && + (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_last_window)) + { + e->triple_click = 1; + _ecore_win32_mouse_down_did_triple = 1; + } + else + _ecore_win32_mouse_down_did_triple = 0; + + if (!e->double_click && !e->triple_click) + _ecore_win32_mouse_up_count = 0; + + _ecore_win32_event_last_time = e->timestamp; + _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; + + if (!_ecore_win32_mouse_down_did_triple) + { + _ecore_win32_mouse_down_last_last_window = _ecore_win32_mouse_down_last_window; + _ecore_win32_mouse_down_last_window = (Ecore_Win32_Window *)e->window; + _ecore_win32_mouse_down_last_last_time = _ecore_win32_mouse_down_last_time; + _ecore_win32_mouse_down_last_time = e->timestamp; + } + + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL); + } + } +} + +void +_ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, + int button) +{ + Ecore_Win32_Window *window; + + INF("mouse button released"); + + window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + + { + Ecore_Event_Mouse_Move *e; + + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); + if (!e) return; + + e->window = (Ecore_Window)window; + e->event_window = e->window; + e->x = GET_X_LPARAM(msg->data_param); + e->y = GET_Y_LPARAM(msg->data_param); + e->timestamp = msg->time; + + _ecore_win32_event_last_time = e->timestamp; + _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); + } + + { + Ecore_Event_Mouse_Button *e; + + e = (Ecore_Event_Mouse_Button *)calloc(1, sizeof(Ecore_Event_Mouse_Button)); + if (!e) return; + + e->window = (Ecore_Window)window; + e->event_window = e->window; + e->buttons = button; + e->x = GET_X_LPARAM(msg->data_param); + e->y = GET_Y_LPARAM(msg->data_param); + e->timestamp = msg->time; + + _ecore_win32_mouse_up_count++; + + if ((_ecore_win32_mouse_up_count >= 2) && + ((e->timestamp - _ecore_win32_mouse_down_last_time) <= (unsigned long)(1000 * _ecore_win32_double_click_time)) && + (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window)) + e->double_click = 1; + + if ((_ecore_win32_mouse_up_count >= 3) && + ((e->timestamp - _ecore_win32_mouse_down_last_last_time) <= (unsigned long)(2 * 1000 * _ecore_win32_double_click_time)) && + (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window) && + (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_last_window)) + e->triple_click = 1; + + _ecore_win32_event_last_time = e->timestamp; + _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; + + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL); + } +} + +void +_ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg) +{ + Ecore_Event_Mouse_Move *e; + + INF("mouse moved"); + + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); + if (!e) return; + + e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); + e->event_window = e->window; + e->x = GET_X_LPARAM(msg->data_param); + e->y = GET_Y_LPARAM(msg->data_param); + e->timestamp = msg->time; + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); +} + +void +_ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg) +{ + { + Ecore_Event_Mouse_Move *e; + + INF("mouse in"); + + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); + if (!e) return; + + e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); + e->event_window = e->window; + e->x = msg->x; + e->y = msg->y; + e->timestamp = msg->time; + + _ecore_win32_event_last_time = e->timestamp; + _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); + } + + { + Ecore_Win32_Event_Mouse_In *e; + + e = (Ecore_Win32_Event_Mouse_In *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_In)); + if (!e) return; + + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + e->x = msg->x; + e->y = msg->y; + e->time = msg->time ; + + _ecore_win32_event_last_time = e->time; + + ecore_event_add(ECORE_WIN32_EVENT_MOUSE_IN, e, NULL, NULL); + } +} + +void +_ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg) +{ + { + Ecore_Event_Mouse_Move *e; + + INF("mouse out"); + + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); + if (!e) return; + + e->window = (Ecore_Window)GetWindowLongPtr(msg->window, GWLP_USERDATA); + e->event_window = e->window; + e->x = msg->x; + e->y = msg->y; + e->timestamp = msg->time; + + _ecore_win32_event_last_time = e->timestamp; + _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); + } + + { + Ecore_Win32_Event_Mouse_Out *e; + + e = (Ecore_Win32_Event_Mouse_Out *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Out)); + if (!e) return; + + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + e->x = msg->x; + e->y = msg->y; + e->time = msg->time; + + _ecore_win32_event_last_time = e->time; + + ecore_event_add(ECORE_WIN32_EVENT_MOUSE_OUT, e, NULL, NULL); + } +} + +void +_ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg) +{ + Ecore_Win32_Event_Window_Focus_In *e; + + INF("focus in"); + + e = (Ecore_Win32_Event_Window_Focus_In *)calloc(1, sizeof(Ecore_Win32_Event_Window_Focus_In)); + if (!e) return; + + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + + e->time = _ecore_win32_event_last_time; + _ecore_win32_event_last_time = e->time; + + ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL); +} + +void +_ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg) +{ + Ecore_Win32_Event_Window_Focus_Out *e; + + INF("focus out"); + + e = (Ecore_Win32_Event_Window_Focus_Out *)calloc(1, sizeof(Ecore_Win32_Event_Window_Focus_Out)); + if (!e) return; + + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + + e->time = _ecore_win32_event_last_time; + _ecore_win32_event_last_time = e->time; + + ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL); +} + +void +_ecore_win32_event_handle_expose(Ecore_Win32_Callback_Data *msg) +{ + Ecore_Win32_Event_Window_Damage *e; + + INF("window expose"); + + e = (Ecore_Win32_Event_Window_Damage *)calloc(1, sizeof(Ecore_Win32_Event_Window_Damage)); + if (!e) return; + + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + + e->x = msg->update.left; + e->y = msg->update.top; + e->width = msg->update.right - msg->update.left; + e->height = msg->update.bottom - msg->update.top; + + e->time = _ecore_win32_event_last_time; + + ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, e, NULL, NULL); +} + +void +_ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg) +{ + Ecore_Win32_Event_Window_Create *e; + + INF("window create notify"); + + e = calloc(1, sizeof(Ecore_Win32_Event_Window_Create)); + if (!e) return; + + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + + e->time = _ecore_win32_event_last_time; + + ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CREATE, e, NULL, NULL); +} + +void +_ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg) +{ + Ecore_Win32_Event_Window_Destroy *e; + + INF("window destroy notify"); + + e = calloc(1, sizeof(Ecore_Win32_Event_Window_Destroy)); + if (!e) return; + + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + + e->time = _ecore_win32_event_last_time; + if (e->window == _ecore_win32_event_last_window) _ecore_win32_event_last_window = NULL; + + ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, e, NULL, NULL); +} + +void +_ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg) +{ + Ecore_Win32_Event_Window_Show *e; + + INF("window map notify"); + + e = calloc(1, sizeof(Ecore_Win32_Event_Window_Show)); + if (!e) return; + + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + + e->time = _ecore_win32_event_last_time; + + ecore_event_add(ECORE_WIN32_EVENT_WINDOW_SHOW, e, NULL, NULL); +} + +void +_ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg) +{ + Ecore_Win32_Event_Window_Hide *e; + + INF("window unmap notify"); + + e = calloc(1, sizeof(Ecore_Win32_Event_Window_Hide)); + if (!e) return; + + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + + e->time = _ecore_win32_event_last_time; + + ecore_event_add(ECORE_WIN32_EVENT_WINDOW_HIDE, e, NULL, NULL); +} + +void +_ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg) +{ + WINDOWINFO wi; + Ecore_Win32_Event_Window_Configure *e; + WINDOWPOS *window_pos; + + INF("window configure notify"); + + e = calloc(1, sizeof(Ecore_Win32_Event_Window_Configure)); + if (!e) return; + + window_pos = (WINDOWPOS *)msg->data_param; + wi.cbSize = sizeof(WINDOWINFO); + if (!GetWindowInfo(window_pos->hwnd, &wi)) + { + free(e); + return; + } + + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + e->abovewin = (void *)GetWindowLongPtr(window_pos->hwndInsertAfter, GWLP_USERDATA); + e->x = wi.rcClient.left; + e->y = wi.rcClient.top; + e->width = wi.rcClient.right - wi.rcClient.left; + e->height = wi.rcClient.bottom - wi.rcClient.top; + e->time = _ecore_win32_event_last_time; + + ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, e, NULL, NULL); +} + +void +_ecore_win32_event_handle_resize(Ecore_Win32_Callback_Data *msg) +{ + RECT rect; + Ecore_Win32_Event_Window_Resize *e; + + INF("window resize"); + + if (!GetClientRect(msg->window, &rect)) + return; + + e = calloc(1, sizeof(Ecore_Win32_Event_Window_Resize)); + if (!e) return; + + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + e->width = rect.right - rect.left; + e->height = rect.bottom - rect.top; + e->time = _ecore_win32_event_last_time; + + ecore_event_add(ECORE_WIN32_EVENT_WINDOW_RESIZE, e, NULL, NULL); +} + +void +_ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg) +{ + Ecore_Win32_Event_Window_Delete_Request *e; + + INF("window delete request"); + + e = calloc(1, sizeof(Ecore_Win32_Event_Window_Delete_Request)); + if (!e) return; + + e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); + e->time = _ecore_win32_event_last_time; + + ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL); +} + + +/***** Private functions definitions *****/ + +static void +_ecore_win32_event_free_key_down(void *data __UNUSED__, + void *ev) +{ + Ecore_Event_Key *e; + + e = ev; + if (e->keyname) free((char *)e->keyname); + if (e->key) free((char *)e->key); + if (e->string) free((char *)e->string); + free(e); +} + +static void +_ecore_win32_event_free_key_up(void *data __UNUSED__, + void *ev) +{ + Ecore_Event_Key *e; + + e = ev; + if (e->keyname) free((char *)e->keyname); + if (e->key) free((char *)e->key); + if (e->string) free((char *)e->string); + free(e); +} + +static int +_ecore_win32_event_keystroke_get(int key, + int is_extended, + Eina_Bool is_down, + char **keyname, + char **keysymbol, + char **keycompose, + unsigned int *modifiers) +{ + char *kn = NULL; + char *ks = NULL; + char *kc = NULL; + + *keyname = NULL; + *keysymbol = NULL; + *keycompose = NULL; + + + printf("vk key 0x%x\n", key); + switch (key) + { + /* Keystroke */ + case VK_PRIOR: + if (is_extended) + { + kn = "Prior"; + ks = "Prior"; + kc = NULL; + } + else + { + kn = "KP_Prior"; + ks = "KP_9"; + kc = "KP_Prior"; + } + break; + case VK_NEXT: + if (is_extended) + { + kn = "Next"; + ks = "Next"; + kc = NULL; + } + else + { + kn = "KP_Next"; + ks = "KP_3"; + kc = "KP_Next"; + } + break; + case VK_END: + if (is_extended) + { + kn = "End"; + ks = "End"; + kc = NULL; + } + else + { + kn = "KP_End"; + ks = "KP_1"; + kc = "KP_End"; + } + break; + case VK_HOME: + if (is_extended) + { + kn = "Home"; + ks = "Home"; + kc = NULL; + } + else + { + kn = "KP_Home"; + ks = "KP_7"; + kc = "KP_Home"; + } + break; + case VK_LEFT: + if (is_extended) + { + kn = "Left"; + ks = "Left"; + kc = NULL; + } + else + { + kn = "KP_Left"; + ks = "KP_4"; + kc = "KP_Left"; + } + break; + case VK_UP: + if (is_extended) + { + kn = "Up"; + ks = "Up"; + kc = NULL; + } + else + { + kn = "KP_Up"; + ks = "KP_8"; + kc = "KP_Up"; + } + break; + case VK_RIGHT: + printf("vk val 0x%x (right)\n", VK_RIGHT); + if (is_extended) + { + kn = "Right"; + ks = "Right"; + kc = NULL; + } + else + { + kn = "KP_Right"; + ks = "KP_6"; + kc = "KP_Right"; + } + break; + case VK_DOWN: + if (is_extended) + { + kn = "Down"; + ks = "Down"; + kc = NULL; + } + else + { + kn = "KP_Down"; + ks = "KP_2"; + kc = "KP_Down"; + } + break; + case VK_INSERT: + if (is_extended) + { + kn = "Insert"; + ks = "Insert"; + kc = NULL; + } + else + { + kn = "KP_Insert"; + ks = "KP_0"; + kc = "KP_Insert"; + } + break; + case VK_DELETE: + if (is_extended) + { + kn = "Delete"; + ks = "Delete"; + /* FIXME: kc is wrong, here */ + kc = "Delete"; + } + else + { + kn = "KP_Delete"; + ks = "KP_Decimal"; + kc = "KP_Delete"; + } + break; + case VK_SHIFT: + { + SHORT res; + + if (is_down) + { + res = GetKeyState(VK_LSHIFT); + if (res & 0x8000) + { + _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_LSHIFT; + kn = "Shift_L"; + ks = "Shift_L"; + kc = ""; + } + res = GetKeyState(VK_RSHIFT); + if (res & 0x8000) + { + _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_RSHIFT; + kn = "Shift_R"; + ks = "Shift_R"; + kc = ""; + } + *modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + } + else /* is_up */ + { + res = GetKeyState(VK_LSHIFT); + if (!(res & 0x8000) && + (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_LSHIFT)) + { + kn = "Shift_L"; + ks = "Shift_L"; + kc = ""; + _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_LSHIFT; + } + res = GetKeyState(VK_RSHIFT); + if (!(res & 0x8000) && + (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_RSHIFT)) + { + kn = "Shift_R"; + ks = "Shift_R"; + kc = ""; + _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RSHIFT; + } + *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT; + } + break; + } + case VK_CONTROL: + { + SHORT res; + + if (is_down) + { + res = GetKeyState(VK_LCONTROL); + if (res & 0x8000) + { + _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_LCONTROL; + kn = "Control_L"; + ks = "Control_L"; + kc = ""; + break; + } + res = GetKeyState(VK_RCONTROL); + if (res & 0x8000) + { + _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_RCONTROL; + kn = "Control_R"; + ks = "Control_R"; + kc = ""; + break; + } + *modifiers |= ECORE_EVENT_MODIFIER_CTRL; + } + else /* is_up */ + { + res = GetKeyState(VK_LCONTROL); + if (!(res & 0x8000) && + (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_LCONTROL)) + { + kn = "Control_L"; + ks = "Control_L"; + kc = ""; + _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_LCONTROL; + break; + } + res = GetKeyState(VK_RCONTROL); + if (!(res & 0x8000) && + (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_RCONTROL)) + { + kn = "Control_R"; + ks = "Control_R"; + kc = ""; + _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RCONTROL; + break; + } + *modifiers &= ~ECORE_EVENT_MODIFIER_CTRL; + } + break; + } + case VK_MENU: + { + SHORT res; + + if (is_down) + { + res = GetKeyState(VK_LMENU); + if (res & 0x8000) + { + _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_LMENU; + kn = "Alt_L"; + ks = "Alt_L"; + kc = ""; + } + res = GetKeyState(VK_RMENU); + if (res & 0x8000) + { + _ecore_win32_key_mask |= ECORE_WIN32_KEY_MASK_RMENU; + kn = "Alt_R"; + ks = "Alt_R"; + kc = ""; + } + *modifiers |= ECORE_EVENT_MODIFIER_ALT; + } + else /* is_up */ + { + res = GetKeyState(VK_LMENU); + if (!(res & 0x8000) && + (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_LMENU)) + { + kn = "Alt_L"; + ks = "Alt_L"; + kc = ""; + _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_LMENU; + } + res = GetKeyState(VK_RMENU); + if (!(res & 0x8000) && + (_ecore_win32_key_mask & ECORE_WIN32_KEY_MASK_RMENU)) + { + kn = "Alt_R"; + ks = "Alt_R"; + kc = ""; + _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RMENU; + } + *modifiers &= ~ECORE_EVENT_MODIFIER_ALT; + } + break; + } + case VK_LWIN: + { + if (is_down) + { + kn = "Super_L"; + ks = "Super_L"; + kc = ""; + *modifiers |= ECORE_EVENT_MODIFIER_WIN; + } + else /* is_up */ + { + kn = "Super_L"; + ks = "Super_L"; + kc = ""; + *modifiers &= ~ECORE_EVENT_MODIFIER_WIN; + } + break; + } + case VK_RWIN: + { + if (is_down) + { + kn = "Super_R"; + ks = "Super_R"; + kc = ""; + *modifiers |= ECORE_EVENT_MODIFIER_WIN; + } + else /* is_up */ + { + kn = "Super_R"; + ks = "Super_R"; + kc = ""; + *modifiers &= ~ECORE_EVENT_MODIFIER_WIN; + } + break; + } + case VK_F1: + kn = "F1"; + ks = "F1"; + kc = ""; + break; + case VK_F2: + kn = "F2"; + ks = "F2"; + kc = ""; + break; + case VK_F3: + kn = "F3"; + ks = "F3"; + kc = ""; + break; + case VK_F4: + kn = "F4"; + ks = "F4"; + kc = ""; + break; + case VK_F5: + kn = "F5"; + ks = "F5"; + kc = ""; + break; + case VK_F6: + kn = "F6"; + ks = "F6"; + kc = ""; + break; + case VK_F7: + kn = "F7"; + ks = "F7"; + kc = ""; + break; + case VK_F8: + kn = "F8"; + ks = "F8"; + kc = ""; + break; + case VK_F9: + kn = "F9"; + ks = "F9"; + kc = ""; + break; + case VK_F10: + kn = "F10"; + ks = "F10"; + kc = ""; + break; + case VK_F11: + kn = "F11"; + ks = "F11"; + kc = ""; + break; + case VK_F12: + kn = "F12"; + ks = "F12"; + kc = ""; + break; + case VK_F13: + kn = "F13"; + ks = "F13"; + kc = ""; + break; + case VK_F14: + kn = "F14"; + ks = "F14"; + kc = ""; + break; + case VK_F15: + kn = "F15"; + ks = "F15"; + kc = ""; + break; + case VK_F16: + kn = "F16"; + ks = "F16"; + kc = ""; + break; + case VK_F17: + kn = "F17"; + ks = "F17"; + kc = ""; + break; + case VK_F18: + kn = "F18"; + ks = "F18"; + kc = ""; + break; + case VK_F19: + kn = "F19"; + ks = "F19"; + kc = ""; + break; + case VK_F20: + kn = "F20"; + ks = "F20"; + kc = ""; + break; + case VK_F21: + kn = "F21"; + ks = "F21"; + kc = ""; + break; + case VK_F22: + kn = "F22"; + ks = "F22"; + kc = ""; + break; + case VK_F23: + kn = "F23"; + ks = "F23"; + kc = ""; + break; + case VK_F24: + kn = "F24"; + ks = "F24"; + kc = ""; + break; + default: + /* other non keystroke characters */ + return 0; + } + + printf("sortie...\n"); + *keyname = strdup(kn); + if (!*keyname) return 0; + *keysymbol = strdup(ks); + if (!*keysymbol) + { + free(*keyname); + *keyname = NULL; + return 0; + } + if (!kc) + *keycompose = NULL; + else + { + *keycompose = strdup(kc); + if (!*keycompose) + { + free(*keyname); + free(*keysymbol); + *keyname = NULL; + *keysymbol = NULL; + return 0; + } + } + printf("sortie 2 ...\n"); + + return 1; +} + +static int +_ecore_win32_event_char_get(int key, + char **keyname, + char **keysymbol, + char **keycompose) +{ + char *kn = NULL; + char *ks = NULL; + char *kc = NULL; + char buf[2]; + + *keyname = NULL; + *keysymbol = NULL; + *keycompose = NULL; + + printf("char key 0x%x\n", key); + + switch (key) + { + case VK_PROCESSKEY: + break; + case VK_BACK: + kn = "BackSpace"; + ks = "BackSpace"; + kc = "\b"; + break; + case VK_TAB: + kn = "Tab"; + ks = "Tab"; + kc = "\t"; + break; + case 0x0a: + /* Line feed (Shift + Enter) */ + kn = "LineFeed"; + ks = "LineFeed"; + kc = "LineFeed"; + break; + case VK_RETURN: + kn = "Return"; + ks = "Return"; + kc = "\n"; + break; + case VK_ESCAPE: + kn = "Escape"; + ks = "Escape"; + kc = "\e"; + break; + case VK_SPACE: + kn = "space"; + ks = "space"; + kc = " "; + break; + default: + /* displayable characters */ + printf (" * key : %d\n", key); + buf[0] = key; + buf[1] = '\0'; + kn = buf; + ks = buf; + kc = buf; + break; + } + *keyname = strdup(kn); + if (!*keyname) return 0; + *keysymbol = strdup(ks); + if (!*keysymbol) + { + free(*keyname); + *keyname = NULL; + return 0; + } + *keycompose = strdup(kc); + if (!*keycompose) + { + free(*keyname); + free(*keysymbol); + *keyname = NULL; + *keysymbol = NULL; + return 0; + } + + return 1; +} diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h b/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h new file mode 100644 index 0000000..4533169 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_private.h @@ -0,0 +1,169 @@ +#ifndef __ECORE_WIN32_PRIVATE_H__ +#define __ECORE_WIN32_PRIVATE_H__ + + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef MIN +# undef MIN +#endif +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) + +#ifdef MAX +# undef MAX +#endif +#define MAX(a,b) (((a) < (b)) ? (b) : (a)) + +/* logging messages macros */ +extern int _ecore_win32_log_dom_global; + +#ifdef ECORE_WIN32_DEFAULT_LOG_COLOR +# undef ECORE_WIN32_DEFAULT_LOG_COLOR +#endif +#define ECORE_WIN32_DEFAULT_LOG_COLOR EINA_COLOR_LIGHTBLUE + +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_ecore_win32_log_dom_global , __VA_ARGS__) +#ifdef DBG +#undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_ecore_win32_log_dom_global , __VA_ARGS__) + +#ifdef INF +#undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_ecore_win32_log_dom_global , __VA_ARGS__) + +#ifdef WRN +# undef WRN +#endif +#define WRN(...) EINA_LOG_DOM_WARN(_ecore_win32_log_dom_global, __VA_ARGS__) + +#define ECORE_WIN32_WINDOW_CLASS "Ecore_Win32_Window_Class" + +typedef struct _Ecore_Win32_Callback_Data Ecore_Win32_Callback_Data; + +struct _Ecore_Win32_Callback_Data +{ + RECT update; + HWND window; + unsigned int message; + WPARAM window_param; + LPARAM data_param; + long time; + int x; + int y; +}; + +struct _Ecore_Win32_Window +{ + HWND window; + + DWORD style; /* used to go fullscreen to normal */ + RECT rect; /* used to go fullscreen to normal */ + + unsigned int min_width; + unsigned int min_height; + unsigned int max_width; + unsigned int max_height; + unsigned int base_width; + unsigned int base_height; + unsigned int step_width; + unsigned int step_height; + + struct { + unsigned int iconified : 1; + unsigned int modal : 1; + unsigned int sticky : 1; + unsigned int maximized_vert : 1; + unsigned int maximized_horz : 1; + unsigned int shaded : 1; + unsigned int hidden : 1; + unsigned int fullscreen : 1; + unsigned int above : 1; + unsigned int below : 1; + unsigned int demands_attention : 1; + } state; + + struct { + unsigned int desktop : 1; + unsigned int dock : 1; + unsigned int toolbar : 1; + unsigned int menu : 1; + unsigned int utility : 1; + unsigned int splash : 1; + unsigned int dialog : 1; + unsigned int normal : 1; + } type; + + unsigned int pointer_is_in : 1; + unsigned int borderless : 1; + unsigned int iconified : 1; + unsigned int fullscreen : 1; + + struct { + unsigned short width; + unsigned short height; + unsigned char *mask; + unsigned int enabled : 1; + unsigned int layered : 1; + } shape; + + struct { + DWORD type; + int x; + int y; + int w; + int h; + int px; + int py; + unsigned int dragging : 1; + } drag; + + void *dnd_drop_target; +}; + + +extern HINSTANCE _ecore_win32_instance; +extern double _ecore_win32_double_click_time; +extern long _ecore_win32_event_last_time; +extern Ecore_Win32_Window *_ecore_win32_event_last_window; + + +void _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, int is_keystroke); +void _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg); +void _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, int button); +void _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, int button); +void _ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg); +void _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg); +void _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg); +void _ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg); +void _ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg); +void _ecore_win32_event_handle_expose(Ecore_Win32_Callback_Data *msg); +void _ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg); +void _ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg); +void _ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg); +void _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg); +void _ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg); +void _ecore_win32_event_handle_resize(Ecore_Win32_Callback_Data *msg); +void _ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg); + +void *_ecore_win32_dnd_data_object_new(void *fmtetc, void *stgmeds, int count); +void _ecore_win32_dnd_data_object_free(void *data_object); +void *_ecore_win32_dnd_drop_source_new(); +void _ecore_win32_dnd_drop_source_free(void *drop_source); +void *_ecore_win32_dnd_register_drop_window(HWND hwnd, + Ecore_Win32_Dnd_DropTarget_Callback callback, void *ptr); +void _ecore_win32_dnd_unregister_drop_window(HWND hwnd, void *drop_target); + + +#ifdef __cplusplus +} +#endif + + +#endif /* __ECORE_WIN32_PRIVATE_H__ */ diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c new file mode 100644 index 0000000..459f051 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_window.c @@ -0,0 +1,1519 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include /* for printf */ + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN + +#include + +#include "Ecore_Win32.h" +#include "ecore_win32_private.h" + +/*============================================================================* + * Local * + *============================================================================*/ + +/** + * @cond LOCAL + */ + + +typedef enum _Ecore_Win32_Window_Z_Order Ecore_Win32_Window_Z_Order; +enum _Ecore_Win32_Window_Z_Order +{ + ECORE_WIN32_WINDOW_Z_ORDER_BOTTOM, + ECORE_WIN32_WINDOW_Z_ORDER_NOTOPMOST, + ECORE_WIN32_WINDOW_Z_ORDER_TOP, + ECORE_WIN32_WINDOW_Z_ORDER_TOPMOST +}; + +static Ecore_Win32_Window * +ecore_win32_window_internal_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height, + DWORD style) +{ + RECT rect; + Ecore_Win32_Window *w; + int minimal_width; + int minimal_height; + + w = (Ecore_Win32_Window *)calloc(1, sizeof(Ecore_Win32_Window)); + if (!w) + { + ERR("malloc() failed"); + return NULL; + } + + rect.left = 0; + rect.top = 0; + rect.right = width; + rect.bottom = height; + if (!AdjustWindowRectEx(&rect, style, FALSE, 0)) + { + ERR("AdjustWindowRect() failed"); + free(w); + return NULL; + } + + minimal_width = GetSystemMetrics(SM_CXMIN); + minimal_height = GetSystemMetrics(SM_CYMIN); +/* if (((rect.right - rect.left) < minimal_width) || */ +/* ((rect.bottom - rect.top) < minimal_height)) */ +/* { */ +/* fprintf (stderr, "[Ecore] [Win32] ERROR !!\n"); */ +/* fprintf (stderr, " Wrong size %ld\n", rect.right - rect.left); */ +/* free(w); */ +/* return NULL; */ +/* } */ + if ((rect.right - rect.left) < minimal_width) + { + rect.right = rect.left + minimal_width; + } + + w->window = CreateWindowEx(0, + ECORE_WIN32_WINDOW_CLASS, "", + style, + x, y, + rect.right - rect.left, + rect.bottom - rect.top, + parent ? parent->window : NULL, + NULL, _ecore_win32_instance, NULL); + if (!w->window) + { + ERR("CreateWindowEx() failed"); + free(w); + return NULL; + } + + SetLastError(0); + if (!SetWindowLongPtr(w->window, GWLP_USERDATA, (LONG_PTR)w) && + (GetLastError() != 0)) + { + ERR("SetWindowLongPtr() failed"); + DestroyWindow(w->window); + free(w); + return NULL; + } + + w->min_width = 0; + w->min_height = 0; + w->max_width = 32767; + w->max_height = 32767; + w->base_width = 0; + w->base_height = 0; + w->step_width = 1; + w->step_height = 1; + + w->state.iconified = 0; + w->state.modal = 0; + w->state.sticky = 0; + w->state.maximized_vert = 0; + w->state.maximized_horz = 0; + w->state.shaded = 0; + w->state.hidden = 0; + w->state.fullscreen = 0; + w->state.above = 0; + w->state.below = 0; + w->state.demands_attention = 0; + + w->type.desktop = 0; + w->type.dock = 0; + w->type.toolbar = 0; + w->type.menu = 0; + w->type.utility = 0; + w->type.splash = 0; + w->type.dialog = 0; + w->type.normal = 0; + + w->pointer_is_in = 0; + w->borderless = 0; + w->iconified = 0; + w->fullscreen = 0; + + return w; +} + +/** + * @endcond + */ + + +/*============================================================================* + * Global * + *============================================================================*/ + +/*============================================================================* + * API * + *============================================================================*/ + +/** + * @addtogroup Ecore_Win32_Group Ecore_Win32 library + * + * @{ + */ + +/** + * @brief Creates a new window. + * + * @param parent The parent window. + * @param x The x coordinate of the top-left corner of the window. + * @param y The y coordinate of the top-left corner of the window. + * @param width The width of the window. + * @param height The height of hte window. + * @return A newly allocated window. + * + * This function creates a new window which parent is @p parent. @p width and + * @p height are the size of the window content (the client part), + * without the border and title bar. @p x and @p y are the system + * coordinates of the top left cerner of the window (that is, of the + * title bar). This function returns a newly created window on + * success, and @c NULL on failure. + */ +EAPI Ecore_Win32_Window * +ecore_win32_window_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height) +{ + INF("creating window with border"); + + return ecore_win32_window_internal_new(parent, + x, y, + width, height, + WS_OVERLAPPEDWINDOW | WS_SIZEBOX); +} + +/** + * @brief Creates a new borderless window. + * + * @param parent The parent window. + * @param x The x coordinate of the top-left corner of the window. + * @param y The y coordinate of the top-left corner of the window. + * @param width The width of the window. + * @param height The height of hte window. + * @return A newly allocated window. + * + * This function is the same than ecore_win32_window_override_new() + * but the returned window is borderless. + */ +EAPI Ecore_Win32_Window * +ecore_win32_window_override_new(Ecore_Win32_Window *parent, + int x, + int y, + int width, + int height) +{ + INF("creating window without border"); + + return ecore_win32_window_internal_new(parent, + x, y, + width, height, + WS_POPUP); +} + +/** + * @brief Free the given window. + * + * @param window The window to free. + * + * This function frees @p window. If @p window is @c NULL, this + * function does nothing. + */ +EAPI void +ecore_win32_window_free(Ecore_Win32_Window *window) +{ + if (!window) return; + + INF("destroying window"); + + if (window->shape.mask) + free(window->shape.mask); + + DestroyWindow(window->window); + free(window); +} + +/** + * @brief Return the window HANDLE associated to the given window. + * + * @param window The window to retrieve the HANDLE from. + * + * This function returns the window HANDLE associated to @p window. If + * @p window is @c NULL, this function returns @c NULL. + */ +EAPI void * +ecore_win32_window_hwnd_get(Ecore_Win32_Window *window) +{ + if (!window) return NULL; + + return window->window; +} + +/* +void +ecore_win32_window_configure(Ecore_Win32_Window *window, + Ecore_Win32_Window_Z_Order order, + int x, + int y, + int width, + int height) +{ + HWND w; + + switch (order) + { + case ECORE_WIN32_WINDOW_Z_ORDER_BOTTOM: + w = HWND_BOTTOM; + break; + case ECORE_WIN32_WINDOW_Z_ORDER_NOTOPMOST: + w = HWND_NOTOPMOST; + break; + case ECORE_WIN32_WINDOW_Z_ORDER_TOP: + w = HWND_TOP; + break; + case ECORE_WIN32_WINDOW_Z_ORDER_TOPMOST: + w = HWND_TOPMOST; + break; + default: + return; + } + SetWindowPos((Ecore_Win32_Window *)window->window, w, x, y, width, height, ???); +} +*/ + +/** + * @brief Move the given window to a given position. + * + * @param window The window to move. + * @param x The x coordinate of the destination position. + * @param y The y coordinate of the destination position. + * + * This function move @p window to the new position of coordinates @p x + * and @p y. If @p window is @c NULL, or if it is fullscreen, or on + * error, this function does nothing. + */ +EAPI void +ecore_win32_window_move(Ecore_Win32_Window *window, + int x, + int y) +{ + RECT rect; + + /* FIXME: on fullscreen, should not move it */ + if (!window) return; + + INF("moving window (%dx%d)", x, y); + + if (!GetWindowRect(window->window, &rect)) + { + ERR("GetWindowRect() failed"); + return; + } + + if (!MoveWindow(window->window, x, y, + rect.right - rect.left, + rect.bottom - rect.top, + TRUE)) + { + ERR("MoveWindow() failed"); + } +} + +/** + * @brief Resize the given window to a given size. + * + * @param window The window to resize. + * @param width The new width. + * @param height The new height. + * + * This function resize @p window to the new @p width and @p height. + * If @p window is @c NULL, or if it is fullscreen, or on error, this + * function does nothing. + */ +EAPI void +ecore_win32_window_resize(Ecore_Win32_Window *window, + int width, + int height) +{ + RECT rect; + DWORD style; + int x; + int y; + int minimal_width; + int minimal_height; + + /* FIXME: on fullscreen, should not resize it */ + if (!window) return; + + INF("resizing window (%dx%d)", width, height); + + minimal_width = MAX(GetSystemMetrics(SM_CXMIN), (int)window->min_width); + minimal_height = MAX(GetSystemMetrics(SM_CYMIN), (int)window->min_height); + + if (!GetWindowRect(window->window, &rect)) + { + ERR("GetWindowRect() failed"); + return; + } + + x = rect.left; + y = rect.top; + rect.left = 0; + rect.top = 0; + if (width < minimal_width) width = minimal_width; + if (width > (int)window->max_width) width = window->max_width; + if (height < minimal_height) height = minimal_height; + if (height > (int)window->max_height) height = window->max_height; + rect.right = width; + rect.bottom = height; + if (!(style = GetWindowLong(window->window, GWL_STYLE))) + { + ERR("GetWindowLong() failed"); + return; + } + if (!AdjustWindowRect(&rect, style, FALSE)) + { + ERR("AdjustWindowRect() failed"); + return; + } + + if (!MoveWindow(window->window, x, y, + rect.right - rect.left, + rect.bottom - rect.top, + TRUE)) + { + ERR("MoveWindow() failed"); + } +} + +/** + * @brief Move and resize the given window to a given position and size. + * + * @param window The window to move and resize. + * @param x The x coordinate of the destination position. + * @param y The x coordinate of the destination position. + * @param width The new width. + * @param height The new height. + * + * This function resize @p window to the new position of coordinates @p x + * and @p y and the new @p width and @p height. If @p window is @c NULL, + * or if it is fullscreen, or on error, this function does nothing. + */ +EAPI void +ecore_win32_window_move_resize(Ecore_Win32_Window *window, + int x, + int y, + int width, + int height) +{ + RECT rect; + DWORD style; + int minimal_width; + int minimal_height; + + /* FIXME: on fullscreen, should not move/resize it */ + if (!window) return; + + INF("moving and resizing window (%dx%d %dx%d)", x, y, width, height); + + minimal_width = MAX(GetSystemMetrics(SM_CXMIN), (int)window->min_width); + minimal_height = MAX(GetSystemMetrics(SM_CYMIN), (int)window->min_height); + + rect.left = 0; + rect.top = 0; + if (width < minimal_width) width = minimal_width; + if (width > (int)window->max_width) width = window->max_width; + if (height < minimal_height) height = minimal_height; + if (height > (int)window->max_height) height = window->max_height; + rect.right = width; + rect.bottom = height; + if (!(style = GetWindowLong(window->window, GWL_STYLE))) + { + ERR("GetWindowLong() failed"); + return; + } + if (!AdjustWindowRect(&rect, style, FALSE)) + { + ERR("AdjustWindowRect() failed"); + return; + } + + if (!MoveWindow(window->window, x, y, + rect.right - rect.left, + rect.bottom - rect.top, + TRUE)) + { + ERR("MoveWindow() failed"); + } +} + +/** + * @brief Get the geometry of the given window. + * + * @param window The window to retrieve the geometry from. + * @param x The x coordinate of the position. + * @param y The x coordinate of the position. + * @param width The width. + * @param height The height. + * + * This function retrieves the position and size of @p window. @p x, + * @p y, @p width and @p height can be buffers that will be filled with + * the corresponding values. If one of them is @c NULL, nothing will + * be done for that parameter. If @p window is @c NULL, and if the + * buffers are not @c NULL, they will be filled with respectively 0, + * 0, the size of the screen and the height of the screen. + */ +EAPI void +ecore_win32_window_geometry_get(Ecore_Win32_Window *window, + int *x, + int *y, + int *width, + int *height) +{ + RECT rect; + int w; + int h; + + INF("getting window geometry"); + + if (!window) + { + if (x) *x = 0; + if (y) *y = 0; + if (width) *width = GetSystemMetrics(SM_CXSCREEN); + if (height) *height = GetSystemMetrics(SM_CYSCREEN); + + return; + } + + if (!GetClientRect(window->window, &rect)) + { + ERR("GetClientRect() failed"); + + if (x) *x = 0; + if (y) *y = 0; + if (width) *width = 0; + if (height) *height = 0; + + return; + } + + w = rect.right - rect.left; + h = rect.bottom - rect.top; + + if (!GetWindowRect(window->window, &rect)) + { + ERR("GetWindowRect() failed"); + + if (x) *x = 0; + if (y) *y = 0; + if (width) *width = 0; + if (height) *height = 0; + + return; + } + + if (x) *x = rect.left; + if (y) *y = rect.top; + if (width) *width = w; + if (height) *height = h; +} + +/** + * @brief Get the size of the given window. + * + * @param window The window to retrieve the size from. + * @param width The width. + * @param height The height. + * + * This function retrieves the size of @p window. @p width and + * @p height can be buffers that will be filled with the corresponding + * values. If one of them is @c NULL, nothing will be done for that + * parameter. If @p window is @c NULL, and if the buffers are not + * @c NULL, they will be filled with respectively the size of the screen + * and the height of the screen. + */ +EAPI void +ecore_win32_window_size_get(Ecore_Win32_Window *window, + int *width, + int *height) +{ + RECT rect; + + INF("getting window size"); + + if (!window) + { + if (width) *width = GetSystemMetrics(SM_CXSCREEN); + if (height) *height = GetSystemMetrics(SM_CYSCREEN); + + return; + } + + if (!GetClientRect(window->window, &rect)) + { + ERR("GetClientRect() failed"); + + if (width) *width = 0; + if (height) *height = 0; + } + + if (width) *width = rect.right - rect.left; + if (height) *height = rect.bottom - rect.top; +} + +/** + * @brief Set the minimum size of the given window. + * + * @param window The window. + * @param min_width The minimal width. + * @param min_height The minimal height. + * + * This function sets the minimum size of @p window to @p min_width + * and *p min_height. If @p window is @c NULL, this functions does + * nothing. + */ +EAPI void +ecore_win32_window_size_min_set(Ecore_Win32_Window *window, + unsigned int min_width, + unsigned int min_height) +{ + if (!window) return; + + printf ("ecore_win32_window_size_min_set : %p %d %d\n", window, min_width, min_height); + window->min_width = min_width; + window->min_height = min_height; +} + +/** + * @brief Get the minimum size of the given window. + * + * @param window The window. + * @param min_width The minimal width. + * @param min_height The minimal height. + * + * This function fills the minimum size of @p window in the buffers + * @p min_width and *p min_height. They both can be @c NULL. If + * @p window is @c NULL, this functions does nothing. + */ +EAPI void +ecore_win32_window_size_min_get(Ecore_Win32_Window *window, + unsigned int *min_width, + unsigned int *min_height) +{ + if (!window) return; + + printf ("ecore_win32_window_size_min_get : %p %d %d\n", window, window->min_width, window->min_height); + if (min_width) *min_width = window->min_width; + if (min_height) *min_height = window->min_height; +} + +/** + * @brief Set the maximum size of the given window. + * + * @param window The window. + * @param max_width The maximal width. + * @param max_height The maximal height. + * + * This function sets the maximum size of @p window to @p max_width + * and *p max_height. If @p window is @c NULL, this functions does + * nothing. + */ +EAPI void +ecore_win32_window_size_max_set(Ecore_Win32_Window *window, + unsigned int max_width, + unsigned int max_height) +{ + if (!window) return; + + printf ("ecore_win32_window_size_max_set : %p %d %d\n", window, max_width, max_height); + window->max_width = max_width; + window->max_height = max_height; +} + +/** + * @brief Get the maximum size of the given window. + * + * @param window The window. + * @param max_width The maximal width. + * @param max_height The maximal height. + * + * This function fills the maximum size of @p window in the buffers + * @p max_width and *p max_height. They both can be @c NULL. If + * @p window is @c NULL, this functions does nothing. + */ +EAPI void +ecore_win32_window_size_max_get(Ecore_Win32_Window *window, + unsigned int *max_width, + unsigned int *max_height) +{ + if (!window) return; + + printf ("ecore_win32_window_size_max_get : %p %d %d\n", window, window->max_width, window->max_height); + if (max_width) *max_width = window->max_width; + if (max_height) *max_height = window->max_height; +} + +/** + * @brief Set the base size of the given window. + * + * @param window The window. + * @param base_width The base width. + * @param base_height The base height. + * + * This function sets the base size of @p window to @p base_width + * and *p base_height. If @p window is @c NULL, this functions does + * nothing. + */ +EAPI void +ecore_win32_window_size_base_set(Ecore_Win32_Window *window, + unsigned int base_width, + unsigned int base_height) +{ + printf ("ecore_win32_window_size_base_set : %p %d %d\n", window, base_width, base_height); + if (!window) return; + + window->base_width = base_width; + window->base_height = base_height; +} + +/** + * @brief Get the base size of the given window. + * + * @param window The window. + * @param base_width The base width. + * @param base_height The bas height. + * + * This function fills the base size of @p window in the buffers + * @p base_width and *p base_height. They both can be @c NULL. If + * @p window is @c NULL, this functions does nothing. + */ +EAPI void +ecore_win32_window_size_base_get(Ecore_Win32_Window *window, + unsigned int *base_width, + unsigned int *base_height) +{ + if (!window) return; + + printf ("ecore_win32_window_size_base_get : %p %d %d\n", window, window->base_width, window->base_height); + if (base_width) *base_width = window->base_width; + if (base_height) *base_height = window->base_height; +} + +/** + * @brief Set the step size of the given window. + * + * @param window The window. + * @param step_width The step width. + * @param step_height The step height. + * + * This function sets the step size of @p window to @p step_width + * and *p step_height. If @p window is @c NULL, this functions does + * nothing. + */ +EAPI void +ecore_win32_window_size_step_set(Ecore_Win32_Window *window, + unsigned int step_width, + unsigned int step_height) +{ + printf ("ecore_win32_window_size_step_set : %p %d %d\n", window, step_width, step_height); + if (!window) return; + + window->step_width = step_width; + window->step_height = step_height; +} + +/** + * @brief Get the step size of the given window. + * + * @param window The window. + * @param step_width The step width. + * @param step_height The bas height. + * + * This function fills the step size of @p window in the buffers + * @p step_width and *p step_height. They both can be @c NULL. If + * @p window is @c NULL, this functions does nothing. + */ +EAPI void +ecore_win32_window_size_step_get(Ecore_Win32_Window *window, + unsigned int *step_width, + unsigned int *step_height) +{ + if (!window) return; + + printf ("ecore_win32_window_size_step_get : %p %d %d\n", window, window->step_width, window->step_height); + if (step_width) *step_width = window->step_width; + if (step_height) *step_height = window->step_height; +} + +EAPI void +ecore_win32_window_shape_set(Ecore_Win32_Window *window, + unsigned short width, + unsigned short height, + unsigned char *mask) +{ + HRGN rgn; + int x; + int y; + OSVERSIONINFO version_info; + + if (!window) + return; + + if (!mask) + { + window->shape.enabled = 0; + if (window->shape.layered != 0) + { + window->shape.layered = 0; +#if defined(WS_EX_LAYERED) + SetLastError(0); + if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, + GetWindowLong(window->window, GWL_EXSTYLE) & (~WS_EX_LAYERED)) && + (GetLastError() != 0)) + { + ERR("SetWindowLongPtr() failed"); + return; + } + if (!RedrawWindow(window->window, NULL, NULL, + RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN)) + { + ERR("RedrawWindow() failed"); + return; + } +#endif + } + else + if (!SetWindowRgn(window->window, NULL, TRUE)) + { + ERR("SetWindowRgn() failed"); + } + return; + } + + if (width == 0 || height == 0) + return; + + window->shape.enabled = 1; + + if (width != window->shape.width || height != window->shape.height) + { + window->shape.width = width; + window->shape.height = height; + if (window->shape.mask) + { + free(window->shape.mask); + window->shape.mask = NULL; + } + window->shape.mask = malloc(width * height); + } + memcpy(window->shape.mask, mask, width * height); + + window->shape.layered = 0; + +#if defined(WS_EX_LAYERED) + version_info.dwOSVersionInfoSize = sizeof(version_info); + if (GetVersionEx(&version_info) == TRUE && version_info.dwMajorVersion == 5) + { + SetLastError(0); + if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, + GetWindowLong(window->window, GWL_EXSTYLE) | WS_EX_LAYERED) && + (GetLastError() != 0)) + { + ERR("SetWindowLongPtr() failed"); + return; + } + window->shape.layered = 1; + return; + } +#endif + + if (!(rgn = CreateRectRgn(0, 0, 0, 0))) + { + ERR("CreateRectRgn() failed"); + return; + } + for (y = 0; y < height; y++) + { + HRGN rgnLine; + + if (!(rgnLine = CreateRectRgn(0, 0, 0, 0))) + { + ERR("CreateRectRgn() failed"); + return; + } + for (x = 0; x < width; x++) + { + if (mask[y * width + x] > 0) + { + HRGN rgnDot; + + if (!(rgnDot = CreateRectRgn(x, y, x + 1, y + 1))) + { + ERR("CreateRectRgn() failed"); + return; + } + if (CombineRgn(rgnLine, rgnLine, rgnDot, RGN_OR) == ERROR) + { + ERR("CombineRgn() has not created a new region"); + } + if (!DeleteObject(rgnDot)) + { + ERR("DeleteObject() failed"); + return; + } + } + } + if (CombineRgn(rgn, rgn, rgnLine, RGN_OR) == ERROR) + { + ERR("CombineRgn() has not created a new region"); + } + if (!DeleteObject(rgnLine)) + { + ERR("DeleteObject() failed"); + return; + } + } + if (!SetWindowRgn(window->window, rgn, TRUE)) + { + ERR("SetWindowRgn() failed"); + } +} + +/** + * @brief Show the given window. + * + * @param window The window to show. + * + * This function shows @p window. If @p window is @c NULL, or on + * error, this function does nothing. + */ +EAPI void +ecore_win32_window_show(Ecore_Win32_Window *window) +{ + if (!window) return; + + INF("showing window"); + + ShowWindow(window->window, SW_SHOWNORMAL); + if (!UpdateWindow(window->window)) + { + ERR("UpdateWindow() failed"); + } +} + +/* FIXME: seems to block the taskbar */ +/** + * @brief Hide the given window. + * + * @param window The window to show. + * + * This function hides @p window. If @p window is @c NULL, or on + * error, this function does nothing. + */ +EAPI void +ecore_win32_window_hide(Ecore_Win32_Window *window) +{ + if (!window) return; + + INF("hiding window"); + + ShowWindow(window->window, SW_HIDE); +} + +/** + * @brief Place the given window at the top of the Z order. + * + * @param window The window to place at the top. + * + * This function places @p window at the top of the Z order. If + * @p window is @c NULL, this function does nothing. + */ +EAPI void +ecore_win32_window_raise(Ecore_Win32_Window *window) +{ + if (!window) return; + + INF("raising window"); + + if (!SetWindowPos(window->window, + HWND_TOP, 0, 0, 0, 0, + SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE)) + { + ERR("SetWindowPos() failed"); + } +} + +/** + * @brief Place the given window at the bottom of the Z order. + * + * @param window The window to place at the bottom. + * + * This function places @p window at the bottom of the Z order. If + * @p window is @c NULL, this function does nothing. + */ +EAPI void +ecore_win32_window_lower(Ecore_Win32_Window *window) +{ + if (!window) return; + + INF("lowering window"); + + if (!SetWindowPos(window->window, + HWND_BOTTOM, 0, 0, 0, 0, + SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE)) + { + ERR("SetWindowPos() failed"); + } +} + +/** + * @brief Set the title of the given window. + * + * @param window The window to set the title. + * @param title The new title. + * + * This function sets the title of @p window to @p title. If @p window + * is @c NULL, or if @p title is @c NULL or empty, or on error, this + * function does nothing. + */ +EAPI void +ecore_win32_window_title_set(Ecore_Win32_Window *window, + const char *title) +{ + if (!window) return; + + if (!title || !title[0]) return; + + INF("setting window title"); + + if (!SetWindowText(window->window, title)) + { + ERR("SetWindowText() failed"); + } +} + +/** + * @brief Set the focus to the given window. + * + * @param window The window to give focus to. + * + * This function gives the focus to @p window. If @p window is + * @c NULL, this function does nothing. + */ +EAPI void +ecore_win32_window_focus_set(Ecore_Win32_Window *window) +{ + if (!window) return; + + INF("focusing window"); + + if (!SetFocus(window->window)) + { + ERR("SetFocus() failed"); + } +} + +/** + * @brief Iconify or restore the given window. + * + * @param window The window. + * @param on EINA_TRUE to iconify the window, EINA_FALSE to restore it. + * + * This function iconify or restore @p window. If @p on + * is set to EINA_TRUE, the window will be iconified, if it is set to + * EINA_FALSE, it will be restored. If @p window is @c NULL or if the + * state does not change (like iconifying the window while it is + * already iconified), this function does nothing. + */ +EAPI void +ecore_win32_window_iconified_set(Ecore_Win32_Window *window, + Eina_Bool on) +{ + if (!window) return; + + if (((window->iconified) && (on)) || + ((!window->iconified) && (!on))) + return; + + INF("iconifying window: %s", on ? "yes" : "no"); + + ShowWindow(window->window, on ? SW_MINIMIZE : SW_RESTORE); + window->iconified = on; +} + +/** + * @brief Remove or restore the border of the given window. + * + * @param window The window. + * @param on EINA_TRUE to remove the border, EINA_FALSE to restore it. + * + * This function remove or restore the border of @p window. If @p on + * is set to EINA_TRUE, the window will have no border, if it is set to + * EINA_FALSE, it will have a border. If @p window is @c NULL or if the + * state does not change (like setting to borderless while the window + * has no border), this function does nothing. + */ +EAPI void +ecore_win32_window_borderless_set(Ecore_Win32_Window *window, + Eina_Bool on) +{ + RECT rect; + DWORD style; + + if (!window) return; + + if (((window->borderless) && (on)) || + ((!window->borderless) && (!on))) + return; + + INF("setting window without border: %s", on ? "yes" : "no"); + + style = GetWindowLong(window->window, GWL_STYLE); + if (on) + { + if (!GetClientRect(window->window, &rect)) + { + ERR("GetClientRect() failed"); + return; + } + SetLastError(0); + if (!SetWindowLongPtr(window->window, GWL_STYLE, style & ~(WS_CAPTION | WS_THICKFRAME)) && + (GetLastError() != 0)) + { + ERR("SetWindowLongPtr() failed"); + return; + } + } + else + { + if (!GetWindowRect(window->window, &rect)) + { + ERR("GetWindowRect() failed"); + return; + } + style |= WS_CAPTION | WS_THICKFRAME; + if (!AdjustWindowRect (&rect, style, FALSE)) + { + ERR("AdjustWindowRect() failed"); + return; + } + SetLastError(0); + if (!SetWindowLongPtr(window->window, GWL_STYLE, style) && + (GetLastError() != 0)) + { + ERR("SetWindowLongPtr() failed"); + return; + } + } + if (!SetWindowPos(window->window, HWND_TOPMOST, + rect.left, rect.top, + rect.right - rect.left, rect.bottom - rect.top, + SWP_NOMOVE | SWP_FRAMECHANGED)) + { + ERR("SetWindowPos() failed"); + return; + } + + window->borderless = on; +} + +/** + * @brief Set the given window to fullscreen. + * + * @param window The window. + * @param on EINA_TRUE for fullscreen mode, EINA_FALSE for windowed mode. + * + * This function set @p window to fullscreen or windowed mode. If @p on + * is set to EINA_TRUE, the window will be fullscreen, if it is set to + * EINA_FALSE, it will be windowed. If @p window is @c NULL or if the + * state does not change (like setting to fullscreen while the window + * is already fullscreen), this function does nothing. + */ +EAPI void +ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window, + Eina_Bool on) +{ + if (!window) return; + + if (((window->fullscreen) && (on)) || + ((!window->fullscreen) && (!on))) + return; + + INF("setting fullscreen: %s", on ? "yes" : "no"); + + window->fullscreen = !!on; + + if (on) + { + DWORD style; + + if (!GetWindowRect(window->window, &window->rect)) + { + ERR("GetWindowRect() failed"); + return; + } + if (!(window->style = GetWindowLong(window->window, GWL_STYLE))) + { + ERR("GetWindowLong() failed"); + return; + } + style = window->style & ~WS_OVERLAPPEDWINDOW & ~WS_SIZEBOX; + style |= WS_VISIBLE | WS_POPUP; + SetLastError(0); + if (!SetWindowLongPtr(window->window, GWL_STYLE, style) && + (GetLastError() != 0)) + { + ERR("SetWindowLongPtr() failed"); + return; + } + SetLastError(0); + if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, WS_EX_TOPMOST) && + (GetLastError() != 0)) + { + ERR("SetWindowLongPtr() failed"); + return; + } + if (!SetWindowPos(window->window, HWND_TOPMOST, 0, 0, + GetSystemMetrics (SM_CXSCREEN), + GetSystemMetrics (SM_CYSCREEN), + SWP_NOCOPYBITS | SWP_SHOWWINDOW)) + { + ERR("SetWindowPos() failed"); + return; + } + } + else + { + SetLastError(0); + if (!SetWindowLongPtr(window->window, GWL_STYLE, window->style) && + (GetLastError() != 0)) + { + ERR("SetWindowLongPtr() failed"); + return; + } + SetLastError(0); + if (!SetWindowLongPtr(window->window, GWL_EXSTYLE, 0) && + (GetLastError() != 0)) + { + ERR("SetWindowLongPtr() failed"); + return; + } + if (!SetWindowPos(window->window, HWND_NOTOPMOST, + window->rect.left, + window->rect.top, + window->rect.right - window->rect.left, + window->rect.bottom - window->rect.top, + SWP_NOCOPYBITS | SWP_SHOWWINDOW)) + { + ERR("SetWindowPos() failed"); + return; + } + } +} + +/** + * @brief Set the given cursor to the given window. + * + * @param window The window to modify the cursor. + * @param cursor The new cursor. + * + * This function sets @p cursor to @p window. @p cursor must have been + * obtained by ecore_win32_cursor_new() or + * ecore_win32_cursor_shaped_new(). If @p window or @p cursor is + * @c NULL, the function does nothing. + */ +EAPI void +ecore_win32_window_cursor_set(Ecore_Win32_Window *window, + Ecore_Win32_Cursor *cursor) +{ + INF("setting cursor"); + + if (!window || !cursor) + return; + + if (!SetClassLongPtr(window->window, + GCLP_HCURSOR, (LONG_PTR)cursor)) + { + ERR("SetClassLong() failed"); + } +} + +/** + * @brief Set the state of the given window. + * + * @param window The window to modify the state. + * @param state An array of the new states. + * @param num The number of states in the array. + * + * This function set the state of @p window. @p state is an array of + * states of size @p num. If @p window or @p state are @c NULL, or if + * @p num is less or equal than 0, the function does nothing. + */ +EAPI void +ecore_win32_window_state_set(Ecore_Win32_Window *window, + Ecore_Win32_Window_State *state, + unsigned int num) +{ + unsigned int i; + + if (!window || !state || (num <= 0)) + return; + + INF("setting cursor state"); + + for (i = 0; i < num; i++) + { + switch (state[i]) + { + case ECORE_WIN32_WINDOW_STATE_ICONIFIED: + window->state.iconified = 1; + break; + case ECORE_WIN32_WINDOW_STATE_MODAL: + window->state.modal = 1; + break; + case ECORE_WIN32_WINDOW_STATE_STICKY: + window->state.sticky = 1; + break; + case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT: + window->state.maximized_vert = 1; + break; + case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ: + window->state.maximized_horz = 1; + break; + case ECORE_WIN32_WINDOW_STATE_MAXIMIZED: + window->state.maximized_horz = 1; + window->state.maximized_vert = 1; + break; + case ECORE_WIN32_WINDOW_STATE_SHADED: + window->state.shaded = 1; + break; + case ECORE_WIN32_WINDOW_STATE_HIDDEN: + window->state.hidden = 1; + break; + case ECORE_WIN32_WINDOW_STATE_FULLSCREEN: + window->state.fullscreen = 1; + break; + case ECORE_WIN32_WINDOW_STATE_ABOVE: + window->state.above = 1; + break; + case ECORE_WIN32_WINDOW_STATE_BELOW: + window->state.below = 1; + break; + case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION: + window->state.demands_attention = 1; + break; + case ECORE_WIN32_WINDOW_STATE_UNKNOWN: + /* nothing to be done */ + break; + } + } +} + +/** + * @brief Apply the modification of the state to the given window. + * + * @param window The window. + * @param state The state to apply changes. + * @param set The value of the state change. + * + * This function applies the modification of the state @p state of + * @p window. @p set is used only for + * #ECORE_WIN32_WINDOW_STATE_ICONIFIED and + * #ECORE_WIN32_WINDOW_STATE_FULLSCREEN. If @p window is @c NULL, the + * function does nothing. + */ +EAPI void +ecore_win32_window_state_request_send(Ecore_Win32_Window *window, + Ecore_Win32_Window_State state, + unsigned int set) +{ + if (!window) return; + + INF("sending cursor state"); + + switch (state) + { + case ECORE_WIN32_WINDOW_STATE_ICONIFIED: + if (window->state.iconified) + ecore_win32_window_iconified_set(window, set); + break; + case ECORE_WIN32_WINDOW_STATE_MODAL: + window->state.modal = 1; + break; + case ECORE_WIN32_WINDOW_STATE_STICKY: + window->state.sticky = 1; + break; + case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT: + if (window->state.maximized_vert) + { + RECT rect; + int y; + int height; + + if (!SystemParametersInfo(SPI_GETWORKAREA, 0, + &rect, 0)) + { + ERR("SystemParametersInfo() failed"); + break; + } + y = rect.top; + height = rect.bottom - rect.top; + + if (!GetClientRect(window->window, &rect)) + { + ERR("GetClientRect() failed"); + break; + } + + if (!MoveWindow(window->window, rect.left, y, + rect.right - rect.left, + height, + TRUE)) + { + ERR("MoveWindow() failed"); + } + } + break; + case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ: + if (window->state.maximized_horz) + { + RECT rect; + + if (!GetClientRect(window->window, &rect)) + { + ERR("GetClientRect() failed"); + break; + } + + if (!MoveWindow(window->window, 0, rect.top, + GetSystemMetrics(SM_CXSCREEN), + rect.bottom - rect.top, + TRUE)) + { + ERR("MoveWindow() failed"); + } + } + break; + case ECORE_WIN32_WINDOW_STATE_MAXIMIZED: + if (window->state.maximized_vert && window->state.maximized_horz) + { + RECT rect; + + if (!SystemParametersInfo(SPI_GETWORKAREA, 0, + &rect, 0)) + { + ERR("SystemParametersInfo() failed"); + break; + } + + if (!MoveWindow(window->window, 0, 0, + GetSystemMetrics(SM_CXSCREEN), + rect.bottom - rect.top, + TRUE)) + { + ERR("MoveWindow() failed"); + } + } + break; + case ECORE_WIN32_WINDOW_STATE_SHADED: + window->state.shaded = 1; + break; + case ECORE_WIN32_WINDOW_STATE_HIDDEN: + window->state.hidden = 1; + break; + case ECORE_WIN32_WINDOW_STATE_FULLSCREEN: + if (window->state.fullscreen) + ecore_win32_window_fullscreen_set(window, set); + break; + case ECORE_WIN32_WINDOW_STATE_ABOVE: + if (window->state.above) + if (!SetWindowPos(window->window, HWND_TOP, + 0, 0, + 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW)) + { + ERR("SetWindowPos() failed"); + } + break; + case ECORE_WIN32_WINDOW_STATE_BELOW: + if (window->state.below) + if (!SetWindowPos(window->window, HWND_BOTTOM, + 0, 0, + 0, 0, + SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW)) + { + ERR("SetWindowPos() failed"); + } + break; + case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION: + window->state.demands_attention = 1; + break; + case ECORE_WIN32_WINDOW_STATE_UNKNOWN: + /* nothing to be done */ + break; + } +} + +/** + * @brief Set the type of the given window. + * + * @param window The window to modify the type. + * @param type The nwindow types. + * + * This function set the type of @p window to @p type. If + * @p window is @c NULL, the function does nothing. + */ +EAPI void +ecore_win32_window_type_set(Ecore_Win32_Window *window, + Ecore_Win32_Window_Type type) +{ + if (!window) + return; + + INF("setting window type"); + + switch (type) + { + case ECORE_WIN32_WINDOW_TYPE_DESKTOP: + window->type.desktop = 1; + break; + case ECORE_WIN32_WINDOW_TYPE_DOCK: + window->type.dock = 1; + break; + case ECORE_WIN32_WINDOW_TYPE_TOOLBAR: + window->type.toolbar = 1; + break; + case ECORE_WIN32_WINDOW_TYPE_MENU: + window->type.menu = 1; + break; + case ECORE_WIN32_WINDOW_TYPE_UTILITY: + window->type.utility = 1; + break; + case ECORE_WIN32_WINDOW_TYPE_SPLASH: + window->type.splash = 1; + break; + case ECORE_WIN32_WINDOW_TYPE_DIALOG: + window->type.dialog = 1; + break; + case ECORE_WIN32_WINDOW_TYPE_NORMAL: + window->type.normal = 1; + break; + case ECORE_WIN32_WINDOW_TYPE_UNKNOWN: + window->type.normal = 1; + break; + } +} + +/** + * @} + */ diff --git a/libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h b/libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h new file mode 100644 index 0000000..681b334 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_wince/Ecore_WinCE.h @@ -0,0 +1,310 @@ +#ifndef __ECORE_WINCE_H__ +#define __ECORE_WINCE_H__ + +/* + * DO NOT USE THIS HEADER. IT IS WORK IN PROGRESS. IT IS NOT FINAL AND + * THE API MAY CHANGE. + */ + +#ifndef ECORE_WINCE_WIP_OSXCKQSD +# warning "You are using a work in progress API. This API is not stable" +# warning "and is subject to change. You use this at your own risk." +#endif + +#include + +#ifdef EAPI +# undef EAPI +#endif + +#ifdef _WIN32 +# ifdef EFL_ECORE_WINCE_BUILD +# ifdef DLL_EXPORT +# define EAPI __declspec(dllexport) +# else +# define EAPI +# endif /* ! DLL_EXPORT */ +# else +# define EAPI __declspec(dllimport) +# endif /* ! EFL_ECORE_WINCE_BUILD */ +#else +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else +# define EAPI +# endif +# else +# define EAPI +# endif +#endif /* ! _WINCE */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @defgroup Ecore_WinCE_Group Ecore_WinCE library + * + * @{ + */ + + +/** + * @typedef Ecore_WinCE_Window + * Abstract type for a window. + */ +typedef struct _Ecore_WinCE_Window Ecore_WinCE_Window; + + +/** + * @typedef Ecore_WinCE_Event_Mouse_In + * Event sent when the mouse enters the window. + */ +typedef struct _Ecore_WinCE_Event_Mouse_In Ecore_WinCE_Event_Mouse_In; + +/** + * @typedef Ecore_WinCE_Event_Mouse_Out + * Event sent when the mouse leaves the window. + */ +typedef struct _Ecore_WinCE_Event_Mouse_Out Ecore_WinCE_Event_Mouse_Out; + +/** + * @typedef Ecore_WinCE_Event_Window_Focus_In + * Event sent when the window gets the focus. + */ +typedef struct _Ecore_WinCE_Event_Window_Focus_In Ecore_WinCE_Event_Window_Focus_In; + +/** + * @typedef Ecore_WinCE_Event_Window_Focus_Out + * Event sent when the window looses the focus. + */ +typedef struct _Ecore_WinCE_Event_Window_Focus_Out Ecore_WinCE_Event_Window_Focus_Out; + +/** + * @typedef Ecore_WinCE_Event_Window_Damage + * Event sent when the window is damaged. + */ +typedef struct _Ecore_WinCE_Event_Window_Damage Ecore_WinCE_Event_Window_Damage; + +/** + * @typedef Ecore_WinCE_Event_Window_Create + * Event sent when the window is created. + */ +typedef struct _Ecore_WinCE_Event_Window_Create Ecore_WinCE_Event_Window_Create; + +/** + * @typedef Ecore_WinCE_Event_Window_Destroy + * Event sent when the window is destroyed. + */ +typedef struct _Ecore_WinCE_Event_Window_Destroy Ecore_WinCE_Event_Window_Destroy; + +/** + * @typedef Ecore_WinCE_Event_Window_Hide + * Event sent when the window is hidden. + */ +typedef struct _Ecore_WinCE_Event_Window_Hide Ecore_WinCE_Event_Window_Hide; + +/** + * @typedef Ecore_WinCE_Event_Window_Show + * Event sent when the window is shown. + */ +typedef struct _Ecore_WinCE_Event_Window_Show Ecore_WinCE_Event_Window_Show; + +/** + * @typedef Ecore_WinCE_Event_Window_Delete_Request + * Event sent when the window is deleted. + */ +typedef struct _Ecore_WinCE_Event_Window_Delete_Request Ecore_WinCE_Event_Window_Delete_Request; + + +/** + * @struct _Ecore_WinCE_Event_Mouse_In + * Event sent when the mouse enters the window. + */ +struct _Ecore_WinCE_Event_Mouse_In +{ + Ecore_WinCE_Window *window; /**< The window that received the event */ + int x; /**< The x coordinate where the mouse entered */ + int y; /**< The y coordinate where the mouse entered */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_WinCE_Event_Mouse_Out + * Event sent when the mouse leaves the window. + */ +struct _Ecore_WinCE_Event_Mouse_Out +{ + Ecore_WinCE_Window *window; /**< The window that received the event */ + int x; /**< The x coordinate where the mouse leaved */ + int y; /**< The y coordinate where the mouse leaved */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_WinCE_Event_Window_Focus_In + * Event sent when the window gets the focus. + */ +struct _Ecore_WinCE_Event_Window_Focus_In +{ + Ecore_WinCE_Window *window; /**< The window that received the event */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_WinCE_Event_Window_Focus_Out + * Event sent when the window looses the focus. + */ +struct _Ecore_WinCE_Event_Window_Focus_Out +{ + Ecore_WinCE_Window *window; /**< The window that received the event */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_WinCE_Event_Window_Damage + * Event sent when the window is damaged. + */ +struct _Ecore_WinCE_Event_Window_Damage +{ + Ecore_WinCE_Window *window; /**< The window that received the event */ + int x; /**< The x coordinate of the top left corner of the damaged region */ + int y; /**< The y coordinate of the top left corner of the damaged region */ + int width; /**< The width of the damaged region */ + int height; /**< The height of the damaged region */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_WinCE_Event_Window_Create + * Event sent when the window is created. + */ +struct _Ecore_WinCE_Event_Window_Create +{ + Ecore_WinCE_Window *window; /**< The window that received the event */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_WinCE_Event_Window_Destroy + * Event sent when the window is destroyed. + */ +struct _Ecore_WinCE_Event_Window_Destroy +{ + Ecore_WinCE_Window *window; /**< The window that received the event */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_WinCE_Event_Window_Hide + * Event sent when the window is hidden. + */ +struct _Ecore_WinCE_Event_Window_Hide +{ + Ecore_WinCE_Window *window; /**< The window that received the event */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_WinCE_Event_Window_Show + * Event sent when the window is shown. + */ +struct _Ecore_WinCE_Event_Window_Show +{ + Ecore_WinCE_Window *window; /**< The window that received the event */ + long time; /**< The time the event occurred */ +}; + +/** + * @struct _Ecore_WinCE_Event_Window_Delete_Request + * Event sent when the window is deleted. + */ +struct _Ecore_WinCE_Event_Window_Delete_Request +{ + Ecore_WinCE_Window *window; /**< The window that received the event */ + long time; /**< The time the event occurred */ +}; + + +EAPI extern int ECORE_WINCE_EVENT_MOUSE_IN; /**< Ecore_Event for the #Ecore_WinCE_Event_Mouse_In event */ +EAPI extern int ECORE_WINCE_EVENT_MOUSE_OUT; /**< Ecore_Event for the #Ecore_WinCE_Event_Mouse_Out event */ +EAPI extern int ECORE_WINCE_EVENT_WINDOW_FOCUS_IN; /**< Ecore_Event for the #Ecore_WinCE_Event_Window_Focus_In event */ +EAPI extern int ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT; /**< Ecore_Event for the #Ecore_WinCE_Event_Window_Focus_Out event */ +EAPI extern int ECORE_WINCE_EVENT_WINDOW_DAMAGE; /**< Ecore_Event for the #Ecore_WinCE_Event_Damage event */ +EAPI extern int ECORE_WINCE_EVENT_WINDOW_CREATE; /**< Ecore_Event for the #Ecore_WinCE_Event_Create event */ +EAPI extern int ECORE_WINCE_EVENT_WINDOW_DESTROY; /**< Ecore_Event for the #Ecore_WinCE_Event_Destroy event */ +EAPI extern int ECORE_WINCE_EVENT_WINDOW_HIDE; /**< Ecore_Event for the #Ecore_WinCE_Event_Hide event */ +EAPI extern int ECORE_WINCE_EVENT_WINDOW_SHOW; /**< Ecore_Event for the #Ecore_WinCE_Event_Show event */ +EAPI extern int ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST; /**< Ecore_Event for the #Ecore_WinCE_Event_Window_Delete_Request event */ + + +/* Core */ + +EAPI int ecore_wince_init(); +EAPI int ecore_wince_shutdown(); +EAPI void ecore_wince_double_click_time_set(double t); +EAPI double ecore_wince_double_click_time_get(void); +EAPI long ecore_wince_current_time_get(void); + +/* Window */ + +EAPI Ecore_WinCE_Window *ecore_wince_window_new(Ecore_WinCE_Window *parent, + int x, + int y, + int width, + int height); + +EAPI void ecore_wince_window_free(Ecore_WinCE_Window *window); + +EAPI void *ecore_wince_window_hwnd_get(Ecore_WinCE_Window *window); + +EAPI void ecore_wince_window_move(Ecore_WinCE_Window *window, + int x, + int y); + +EAPI void ecore_wince_window_resize(Ecore_WinCE_Window *window, + int width, + int height); + +EAPI void ecore_wince_window_move_resize(Ecore_WinCE_Window *window, + int x, + int y, + int width, + int height); + +EAPI void ecore_wince_window_show(Ecore_WinCE_Window *window); + +EAPI void ecore_wince_window_hide(Ecore_WinCE_Window *window); + +EAPI void ecore_wince_window_title_set(Ecore_WinCE_Window *window, + const char *title); + +EAPI void ecore_wince_window_backend_set(Ecore_WinCE_Window *window, int backend); + +EAPI void ecore_wince_window_suspend_cb_set(Ecore_WinCE_Window *window, int (*suspend_cb)(int)); + +EAPI void ecore_wince_window_resume_cb_set(Ecore_WinCE_Window *window, int (*resume_cb)(int)); + +EAPI void ecore_wince_window_geometry_get(Ecore_WinCE_Window *window, + int *x, + int *y, + int *width, + int *height); + +EAPI void ecore_wince_window_size_get(Ecore_WinCE_Window *window, + int *width, + int *height); + +EAPI void ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window, + Eina_Bool on); + +/** + * @} + */ + +#ifdef __cplusplus +} +#endif + +#endif /* __ECORE_WINCE_H__ */ diff --git a/libraries/ecore/src/lib/ecore_wince/Makefile.am b/libraries/ecore/src/lib/ecore_wince/Makefile.am new file mode 100644 index 0000000..a264ffb --- /dev/null +++ b/libraries/ecore/src/lib/ecore_wince/Makefile.am @@ -0,0 +1,35 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_input \ +@EFL_ECORE_WINCE_BUILD@ \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ \ +@WIN32_CPPFLAGS@ + +AM_CFLAGS = @WIN32_CFLAGS@ + +lib_LTLIBRARIES = libecore_wince.la + +includes_HEADERS = Ecore_WinCE.h +includesdir = $(includedir)/ecore-@VMAJ@ + +libecore_wince_la_SOURCES = \ +ecore_wince.c \ +ecore_wince_event.c \ +ecore_wince_window.c + +libecore_wince_la_LIBADD = \ +@WIN32_LIBS@ \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EVAS_LIBS@ \ +@EINA_LIBS@ \ +@EVIL_LIBS@ + +libecore_wince_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ + +EXTRA_DIST = ecore_wince_private.h diff --git a/libraries/ecore/src/lib/ecore_wince/Makefile.in b/libraries/ecore/src/lib/ecore_wince/Makefile.in new file mode 100644 index 0000000..0610122 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_wince/Makefile.in @@ -0,0 +1,829 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_wince +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +libecore_wince_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore_input/libecore_input.la \ + $(top_builddir)/src/lib/ecore/libecore.la +am_libecore_wince_la_OBJECTS = ecore_wince.lo ecore_wince_event.lo \ + ecore_wince_window.lo +libecore_wince_la_OBJECTS = $(am_libecore_wince_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_wince_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libecore_wince_la_LDFLAGS) $(LDFLAGS) \ + -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_wince_la_SOURCES) +DIST_SOURCES = $(libecore_wince_la_SOURCES) +HEADERS = $(includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_input \ +@EFL_ECORE_WINCE_BUILD@ \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ \ +@WIN32_CPPFLAGS@ + +AM_CFLAGS = @WIN32_CFLAGS@ +lib_LTLIBRARIES = libecore_wince.la +includes_HEADERS = Ecore_WinCE.h +includesdir = $(includedir)/ecore-@VMAJ@ +libecore_wince_la_SOURCES = \ +ecore_wince.c \ +ecore_wince_event.c \ +ecore_wince_window.c + +libecore_wince_la_LIBADD = \ +@WIN32_LIBS@ \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +$(top_builddir)/src/lib/ecore/libecore.la \ +@EVAS_LIBS@ \ +@EINA_LIBS@ \ +@EVIL_LIBS@ + +libecore_wince_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -version-info @version_info@ @release_info@ +EXTRA_DIST = ecore_wince_private.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_wince/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_wince/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_wince.la: $(libecore_wince_la_OBJECTS) $(libecore_wince_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_wince_la_LINK) -rpath $(libdir) $(libecore_wince_la_OBJECTS) $(libecore_wince_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wince.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wince_event.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_wince_window.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-includesHEADERS install-info \ + install-info-am install-libLTLIBRARIES install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-includesHEADERS \ + uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_wince/ecore_wince.c b/libraries/ecore/src/lib/ecore_wince/ecore_wince.c new file mode 100644 index 0000000..5638ad3 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_wince/ecore_wince.c @@ -0,0 +1,400 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include /* for printf */ + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN + +#include +#include +#include + +#include "Ecore_WinCE.h" +#include "ecore_wince_private.h" + +/*============================================================================* + * Local * + *============================================================================*/ + +/** + * @cond LOCAL + */ + +static int _ecore_wince_init_count = 0; + +LRESULT CALLBACK +_ecore_wince_window_procedure(HWND window, + UINT message, + WPARAM window_param, + LPARAM data_param) +{ + Ecore_WinCE_Callback_Data *data; + POINTS pt; + DWORD coord; + + data = (Ecore_WinCE_Callback_Data *)malloc(sizeof(Ecore_WinCE_Callback_Data)); + if (!data) return DefWindowProc(window, message, window_param, data_param); + + data->window = window; + data->message = message; + data->window_param = window_param; + data->data_param = data_param; + data->time = GetTickCount(); + coord = GetMessagePos(); + pt = MAKEPOINTS(coord); + data->x = pt.x; + data->y = pt.y; + + switch (data->message) + { + /* Keyboard input notifications */ + case WM_CHAR: + _ecore_wince_event_handle_key_press(data, 0); + break; + case WM_HOTKEY: + _ecore_wince_event_handle_key_press(data, 1); + break; + case WM_KEYDOWN: + case WM_SYSKEYDOWN: + _ecore_wince_event_handle_key_press(data, 1); + break; + case WM_KEYUP: + case WM_SYSKEYUP: + _ecore_wince_event_handle_key_release(data, 1); + break; + case WM_SETFOCUS: + _ecore_wince_event_handle_focus_in(data); + break; + case WM_KILLFOCUS: + _ecore_wince_event_handle_focus_out(data); + break; + /* Mouse input notifications */ + case WM_LBUTTONDOWN: + _ecore_wince_event_handle_button_press(data, 1); + break; + case WM_LBUTTONUP: + _ecore_wince_event_handle_button_release(data, 1); + break; + case WM_MOUSEMOVE: + { + RECT rect; + Ecore_WinCE_Window *w = NULL; + + w = (Ecore_WinCE_Window *)GetWindowLong(window, GWL_USERDATA); + + if (GetClientRect(window, &rect)) + { + POINT pt; + + INF("mouse in window"); + + pt.x = LOWORD(data_param); + pt.y = HIWORD(data_param); + if (!PtInRect(&rect, pt)) + { + if (w->pointer_is_in) + { + w->pointer_is_in = 0; + _ecore_wince_event_handle_leave_notify(data); + } + } + else + { + if (!w->pointer_is_in) + { + w->pointer_is_in = 1; + _ecore_wince_event_handle_enter_notify(data); + } + } + } + else + { + ERR("GetClientRect() failed"); + } + _ecore_wince_event_handle_motion_notify(data); + + break; + } + /* Window notifications */ + case WM_CREATE: + _ecore_wince_event_handle_create_notify(data); + break; + case WM_DESTROY: + _ecore_wince_event_handle_destroy_notify(data); + break; + case WM_SHOWWINDOW: + if ((data->data_param == SW_OTHERUNZOOM) || + (data->data_param == SW_OTHERZOOM)) + break; + + if (data->window_param) + _ecore_wince_event_handle_map_notify(data); + else + _ecore_wince_event_handle_unmap_notify(data); + + break; + case WM_CLOSE: + _ecore_wince_event_handle_delete_request(data); + break; + /* GDI notifications */ + case WM_ERASEBKGND: + return 1; + case WM_PAINT: + { + PAINTSTRUCT paint; + + if (BeginPaint(window, &paint)) + { + data->update = paint.rcPaint; + _ecore_wince_event_handle_expose(data); + EndPaint(window, &paint); + } + break; + } + default: + return DefWindowProc(window, message, window_param, data_param); + } + + return 0; +} + +static void +_ecore_wince_error_print_cb(const Eina_Log_Domain *d __UNUSED__, + Eina_Log_Level level __UNUSED__, + const char *file __UNUSED__, + const char *fnc, + int line, + const char *fmt, + void *data __UNUSED__, + va_list args) +{ + fprintf(stderr, "[%s:%d] ", fnc, line); + vfprintf(stderr, fmt, args); +} + +/** + * @endcond + */ + + +/*============================================================================* + * Global * + *============================================================================*/ + + +double _ecore_wince_double_click_time = 0.25; +long _ecore_wince_event_last_time = 0; +Ecore_WinCE_Window *_ecore_wince_event_last_window = NULL; +HINSTANCE _ecore_wince_instance = NULL; +int _ecore_wince_log_dom_global = -1; + +int ECORE_WINCE_EVENT_MOUSE_IN = 0; +int ECORE_WINCE_EVENT_MOUSE_OUT = 0; +int ECORE_WINCE_EVENT_WINDOW_FOCUS_IN = 0; +int ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT = 0; +int ECORE_WINCE_EVENT_WINDOW_DAMAGE = 0; +int ECORE_WINCE_EVENT_WINDOW_CREATE = 0; +int ECORE_WINCE_EVENT_WINDOW_DESTROY = 0; +int ECORE_WINCE_EVENT_WINDOW_SHOW = 0; +int ECORE_WINCE_EVENT_WINDOW_HIDE = 0; +int ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = 0; + +/*============================================================================* + * API * + *============================================================================*/ + +/** + * @addtogroup Ecore_WinCE_Group Ecore_WinCE library + * + * Ecore_WinCE is a library that wraps Windows CE graphic functions + * and integrate them nicely into the Ecore main loop. + * + * @{ + */ + +/** + * @brief Initialize the Ecore_WinCE library. + * + * @return 1 or greater on success, 0 on error. + * + * This function sets up the Windows CE graphic system. It returns 0 on + * failure, otherwise it returns the number of times it has already been + * called. + * + * When Ecore_WinCE is not used anymore, call ecore_wince_shutdown() + * to shut down the Ecore_WinCE library. + */ +EAPI int +ecore_wince_init() +{ + WNDCLASS wc; + + if (++_ecore_wince_init_count != 1) + return _ecore_wince_init_count; + + if (!eina_init()) + return --_ecore_wince_init_count; + + eina_log_print_cb_set(_ecore_wince_error_print_cb, NULL); + _ecore_wince_log_dom_global = eina_log_domain_register + ("ecore_wince", ECORE_WINCE_DEFAULT_LOG_COLOR); + if (_ecore_wince_log_dom_global < 0) + { + EINA_LOG_ERR("Ecore_WinCE: Could not register log domain"); + goto shutdown_eina; + } + + if (!ecore_event_init()) + { + ERR("Ecore_WinCE: Could not init ecore_event"); + goto unregister_log_domain; + } + + _ecore_wince_instance = GetModuleHandle(NULL); + if (!_ecore_wince_instance) + { + ERR("GetModuleHandle() failed"); + goto shutdown_ecore_event; + } + + memset (&wc, 0, sizeof (wc)); + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = _ecore_wince_window_procedure; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = _ecore_wince_instance; + wc.hIcon = NULL; + wc.hCursor = LoadCursor (NULL, IDC_ARROW); + wc.hbrBackground = GetSysColorBrush(COLOR_BTNFACE); + wc.lpszMenuName = NULL; + wc.lpszClassName = ECORE_WINCE_WINDOW_CLASS; + + if(!RegisterClass(&wc)) + { + ERR("RegisterClass() failed"); + goto free_library; + } + + if (!ECORE_WINCE_EVENT_MOUSE_IN) + { + ECORE_WINCE_EVENT_MOUSE_IN = ecore_event_type_new(); + ECORE_WINCE_EVENT_MOUSE_OUT = ecore_event_type_new(); + ECORE_WINCE_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new(); + ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new(); + ECORE_WINCE_EVENT_WINDOW_DAMAGE = ecore_event_type_new(); + ECORE_WINCE_EVENT_WINDOW_CREATE = ecore_event_type_new(); + ECORE_WINCE_EVENT_WINDOW_DESTROY = ecore_event_type_new(); + ECORE_WINCE_EVENT_WINDOW_SHOW = ecore_event_type_new(); + ECORE_WINCE_EVENT_WINDOW_HIDE = ecore_event_type_new(); + ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new(); + } + + return _ecore_wince_init_count; + + free_library: + FreeLibrary(_ecore_wince_instance); + shutdown_ecore_event: + ecore_event_shutdown(); + unregister_log_domain: + eina_log_domain_unregister(_ecore_wince_log_dom_global); + shutdown_eina: + eina_shutdown(); + + return --_ecore_wince_init_count; +} + +/** + * @brief Shut down the Ecore_WinCE library. + * + * @return 0 when the library is completely shut down, 1 or + * greater otherwise. + * + * This function shuts down the Ecore_WinCE library. It returns 0 when it has + * been called the same number of times than ecore_wince_init(). In that case + * it shuts down all the Windows CE graphic system. + */ +EAPI int +ecore_wince_shutdown() +{ + HWND task_bar; + + if (--_ecore_wince_init_count != 0) + return _ecore_wince_init_count; + + /* force task bar to be shown (in case the application exits */ + /* while being fullscreen) */ + task_bar = FindWindow(L"HHTaskBar", NULL); + if (task_bar) + { + ShowWindow(task_bar, SW_SHOW); + EnableWindow(task_bar, TRUE); + } + + if (!UnregisterClass(ECORE_WINCE_WINDOW_CLASS, _ecore_wince_instance)) + ERR("UnregisterClass() failed"); + + if (!FreeLibrary(_ecore_wince_instance)) + ERR("FreeLibrary() failed"); + + _ecore_wince_instance = NULL; + + ecore_event_shutdown(); + eina_log_domain_unregister(_ecore_wince_log_dom_global); + _ecore_wince_log_dom_global = -1; + eina_shutdown(); + + return _ecore_wince_init_count; +} + +/** + * @brief Set the timeout for a double and triple clicks to be flagged. + * + * @param t The time in seconds. + * + * This function sets the time @p t between clicks before the + * double_click flag is set in a button down event. If 3 clicks occur + * within double this time, the triple_click flag is also set. + */ +EAPI void +ecore_wince_double_click_time_set(double t) +{ + if (t < 0.0) t = 0.0; + _ecore_wince_double_click_time = t; +} + +/** + * @brief Retrieve the double and triple click flag timeout. + * + * @return The timeout for double clicks in seconds. + * + * This function returns the double clicks in seconds. If + * ecore_wince_double_click_time_set() has not been called, the + * default value is returned. See ecore_wince_double_click_time_set() + * for more informations. + */ +EAPI double +ecore_wince_double_click_time_get(void) +{ + return _ecore_wince_double_click_time; +} + +/** + * @brief Return the last event time. + * + * @return The last envent time. + * + * This function returns the last event time. + */ +EAPI long +ecore_wince_current_time_get(void) +{ + return _ecore_wince_event_last_time; +} + +/** + * @} + */ diff --git a/libraries/ecore/src/lib/ecore_wince/ecore_wince_event.c b/libraries/ecore/src/lib/ecore_wince/ecore_wince_event.c new file mode 100644 index 0000000..41c355b --- /dev/null +++ b/libraries/ecore/src/lib/ecore_wince/ecore_wince_event.c @@ -0,0 +1,1074 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN + +#include +#include +#include + +#include "Ecore_WinCE.h" +#include "ecore_wince_private.h" + +/*============================================================================* + * Local * + *============================================================================*/ + +/** + * @cond LOCAL + */ + +typedef enum +{ + ECORE_WINCE_KEY_MASK_LSHIFT = 1 << 0, + ECORE_WINCE_KEY_MASK_RSHIFT = 1 << 1, + ECORE_WINCE_KEY_MASK_LCONTROL = 1 << 2, + ECORE_WINCE_KEY_MASK_RCONTROL = 1 << 3, + ECORE_WINCE_KEY_MASK_LMENU = 1 << 4, + ECORE_WINCE_KEY_MASK_RMENU = 1 << 5 +} Ecore_Wince_Key_Mask; + +static Ecore_WinCE_Window *_ecore_wince_mouse_down_last_window = NULL; +static Ecore_WinCE_Window *_ecore_wince_mouse_down_last_last_window = NULL; +static long _ecore_wince_mouse_down_last_time = 0; +static long _ecore_wince_mouse_down_last_last_time = 0; +static int _ecore_wince_mouse_down_did_triple = 0; +static int _ecore_wince_mouse_up_count = 0; +static Ecore_Wince_Key_Mask _ecore_wince_key_mask = 0; + +static void +_ecore_wince_event_free_key_down(void *data __UNUSED__, + void *ev) +{ + Ecore_Event_Key *e; + + e = ev; + if (e->keyname) free((char *)e->keyname); + if (e->key) free((char *)e->key); + if (e->string) free((char *)e->string); + free(e); +} + +static void +_ecore_wince_event_free_key_up(void *data __UNUSED__, + void *ev) +{ + Ecore_Event_Key *e; + + e = ev; + if (e->keyname) free((char *)e->keyname); + if (e->key) free((char *)e->key); + if (e->string) free((char *)e->string); + free(e); +} + +static int +_ecore_wince_event_keystroke_get(int key, + Eina_Bool is_down, + char **keyname, + char **keysymbol, + char **keycompose) +{ + char *kn; + char *ks; + char *kc; + + *keyname = NULL; + *keysymbol = NULL; + *keycompose = NULL; + + switch (key) + { + /* Keystroke */ + case VK_PRIOR: + kn = "Prior"; + ks = "Prior"; + kc = "Prior"; + break; + case VK_NEXT: + kn = "Next"; + ks = "Next"; + kc = "Next"; + break; + case VK_END: + kn = "End"; + ks = "End"; + kc = "End"; + break; + case VK_HOME: + kn = "Home"; + ks = "Home"; + kc = "Home"; + break; + case VK_LEFT: + kn = "Left"; + ks = "Left"; + kc = "Left"; + break; + case VK_UP: + kn = "Up"; + ks = "Up"; + kc = "Up"; + break; + case VK_RIGHT: + kn = "Right"; + ks = "Right"; + kc = "Right"; + break; + case VK_DOWN: + kn = "Down"; + ks = "Down"; + kc = "Down"; + break; + case VK_INSERT: + kn = "Insert"; + ks = "Insert"; + kc = "Insert"; + break; + case VK_DELETE: + kn = "Delete"; + ks = "Delete"; + kc = "Delete"; + break; + case VK_F1: + kn = "F1"; + ks = "F1"; + kc = ""; + break; + case VK_F2: + kn = "F2"; + ks = "F2"; + kc = ""; + break; + case VK_F3: + kn = "F3"; + ks = "F3"; + kc = ""; + break; + case VK_F4: + kn = "F4"; + ks = "F4"; + kc = ""; + break; + case VK_F5: + kn = "F5"; + ks = "F5"; + kc = ""; + break; + case VK_F6: + kn = "F6"; + ks = "F6"; + kc = ""; + break; + case VK_F7: + kn = "F7"; + ks = "F7"; + kc = ""; + break; + case VK_F8: + kn = "F8"; + ks = "F8"; + kc = ""; + break; + case VK_F9: + kn = "F9"; + ks = "F9"; + kc = ""; + break; + case VK_F10: + kn = "F10"; + ks = "F10"; + kc = ""; + break; + case VK_F11: + kn = "F11"; + ks = "F11"; + kc = ""; + break; + case VK_F12: + kn = "F12"; + ks = "F12"; + kc = ""; + break; + case VK_F13: + kn = "F13"; + ks = "F13"; + kc = ""; + break; + case VK_F14: + kn = "F14"; + ks = "F14"; + kc = ""; + break; + case VK_F15: + kn = "F15"; + ks = "F15"; + kc = ""; + break; + case VK_F16: + kn = "F16"; + ks = "F16"; + kc = ""; + break; + case VK_F17: + kn = "F17"; + ks = "F17"; + kc = ""; + break; + case VK_F18: + kn = "F18"; + ks = "F18"; + kc = ""; + break; + case VK_F19: + kn = "F19"; + ks = "F19"; + kc = ""; + break; + case VK_F20: + /* + * VK_F20 indicates that an arrow key came from a rocker. + * This can safely be ignored. + */ + return 0; + case VK_F21: + /* + * VK_F21 indicates that an arrow key came from a directional + * pad. This can safely be ignored. + */ + return 0; + case VK_F22: + kn = "F22"; + ks = "F22"; + kc = ""; + break; + case VK_F23: + /* + * Sent with VK_RETURN when doing an action (usually the middle + * button on a directional pad. This can safely be ignored. + */ + return 0; + case VK_F24: + kn = "F24"; + ks = "F24"; + kc = ""; + break; + case VK_APPS: + kn = "Application"; + ks = "Application"; + kc = ""; + break; + case VK_SHIFT: + { + SHORT res; + + if (is_down) + { + res = GetKeyState(VK_LSHIFT); + if (res & 0x8000) + { + _ecore_wince_key_mask |= ECORE_WINCE_KEY_MASK_LSHIFT; + kn = "Shift_L"; + ks = "Shift_L"; + kc = ""; + } + res = GetKeyState(VK_RSHIFT); + if (res & 0x8000) + { + _ecore_wince_key_mask |= ECORE_WINCE_KEY_MASK_RSHIFT; + kn = "Shift_R"; + ks = "Shift_R"; + kc = ""; + } + } + else /* is_up */ + { + res = GetKeyState(VK_LSHIFT); + if (!(res & 0x8000) && + (_ecore_wince_key_mask & ECORE_WINCE_KEY_MASK_LSHIFT)) + { + kn = "Shift_L"; + ks = "Shift_L"; + kc = ""; + _ecore_wince_key_mask &= ~ECORE_WINCE_KEY_MASK_LSHIFT; + } + res = GetKeyState(VK_RSHIFT); + if (!(res & 0x8000) && + (_ecore_wince_key_mask & ECORE_WINCE_KEY_MASK_RSHIFT)) + { + kn = "Shift_R"; + ks = "Shift_R"; + kc = ""; + _ecore_wince_key_mask &= ~ECORE_WINCE_KEY_MASK_RSHIFT; + } + } + break; + } + case VK_CONTROL: + { + SHORT res; + + if (is_down) + { + res = GetKeyState(VK_LCONTROL); + if (res & 0x8000) + { + _ecore_wince_key_mask |= ECORE_WINCE_KEY_MASK_LCONTROL; + kn = "Control_L"; + ks = "Control_L"; + kc = ""; + break; + } + res = GetKeyState(VK_RCONTROL); + if (res & 0x8000) + { + _ecore_wince_key_mask |= ECORE_WINCE_KEY_MASK_RCONTROL; + kn = "Control_R"; + ks = "Control_R"; + kc = ""; + break; + } + } + else /* is_up */ + { + res = GetKeyState(VK_LCONTROL); + if (!(res & 0x8000) && + (_ecore_wince_key_mask & ECORE_WINCE_KEY_MASK_LCONTROL)) + { + kn = "Control_L"; + ks = "Control_L"; + kc = ""; + _ecore_wince_key_mask &= ~ECORE_WINCE_KEY_MASK_LCONTROL; + break; + } + res = GetKeyState(VK_RCONTROL); + if (!(res & 0x8000) && + (_ecore_wince_key_mask & ECORE_WINCE_KEY_MASK_RCONTROL)) + { + kn = "Control_R"; + ks = "Control_R"; + kc = ""; + _ecore_wince_key_mask &= ~ECORE_WINCE_KEY_MASK_RCONTROL; + break; + } + } + break; + } + case VK_MENU: + { + SHORT res; + + if (is_down) + { + res = GetKeyState(VK_LMENU); + if (res & 0x8000) + { + _ecore_wince_key_mask |= ECORE_WINCE_KEY_MASK_LMENU; + kn = "Alt_L"; + ks = "Alt_L"; + kc = ""; + } + res = GetKeyState(VK_RMENU); + if (res & 0x8000) + { + _ecore_wince_key_mask |= ECORE_WINCE_KEY_MASK_RMENU; + kn = "Alt_R"; + ks = "Alt_R"; + kc = ""; + } + } + else /* is_up */ + { + res = GetKeyState(VK_LMENU); + if (!(res & 0x8000) && + (_ecore_wince_key_mask & ECORE_WINCE_KEY_MASK_LMENU)) + { + kn = "Alt_L"; + ks = "Alt_L"; + kc = ""; + _ecore_wince_key_mask &= ~ECORE_WINCE_KEY_MASK_LMENU; + } + res = GetKeyState(VK_RMENU); + if (!(res & 0x8000) && + (_ecore_wince_key_mask & ECORE_WINCE_KEY_MASK_RMENU)) + { + kn = "Alt_R"; + ks = "Alt_R"; + kc = ""; + _ecore_wince_key_mask &= ~ECORE_WINCE_KEY_MASK_RMENU; + } + } + break; + } + default: + /* other non keystroke characters */ + return 0; + } + *keyname = strdup(kn); + if (!*keyname) return 0; + *keysymbol = strdup(ks); + if (!*keysymbol) + { + free(*keyname); + *keyname = NULL; + return 0; + } + *keycompose = strdup(kc); + if (!*keycompose) + { + free(*keyname); + free(*keysymbol); + *keyname = NULL; + *keysymbol = NULL; + return 0; + } + + return 1; +} + +static int +_ecore_wince_event_char_get(int key, + char **keyname, + char **keysymbol, + char **keycompose) +{ + char kn[32]; + char ks[32]; + char kc[32]; + + *keyname = NULL; + *keysymbol = NULL; + *keycompose = NULL; + + switch (key) + { + case VK_APP3: + case VK_BACK: + strncpy(kn, "BackSpace", 32); + strncpy(ks, "BackSpace", 32); + strncpy(kc, "BackSpace", 32); + break; + case VK_APP4: + case VK_TAB: + strncpy(kn, "Tab", 32); + strncpy(ks, "Tab", 32); + strncpy(kc, "Tab", 32); + break; + case VK_APP5: + case 0x0a: + /* Line feed (Shift + Enter) */ + strncpy(kn, "LineFeed", 32); + strncpy(ks, "LineFeed", 32); + strncpy(kc, "LineFeed", 32); + break; + case VK_APP2: + case VK_RETURN: + strncpy(kn, "Return", 32); + strncpy(ks, "Return", 32); + strncpy(kc, "Return", 32); + break; + case VK_APP1: + case VK_ESCAPE: + strncpy(kn, "Escape", 32); + strncpy(ks, "Escape", 32); + strncpy(kc, "Escape", 32); + break; + case VK_SPACE: + strncpy(kn, "space", 32); + strncpy(ks, "space", 32); + strncpy(kc, " ", 32); + break; + default: + /* displayable characters */ + printf (" * key : %d\n", key); + kn[0] = (TCHAR)key; + kn[1] = '\0'; + ks[0] = (TCHAR)key; + ks[1] = '\0'; + kc[0] = (TCHAR)key; + kc[1] = '\0'; + break; + } + *keyname = strdup(kn); + if (!*keyname) return 0; + *keysymbol = strdup(ks); + if (!*keysymbol) + { + free(*keyname); + *keyname = NULL; + return 0; + } + *keycompose = strdup(kc); + if (!*keycompose) + { + free(*keyname); + free(*keysymbol); + *keyname = NULL; + *keysymbol = NULL; + return 0; + } + + return 1; +} + +/** + * @endcond + */ + + +/*============================================================================* + * Global * + *============================================================================*/ + +void +_ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg, + int is_keystroke) +{ + Ecore_Event_Key *e; + + INF("key pressed"); + + e = (Ecore_Event_Key *)malloc(sizeof(Ecore_Event_Key)); + if (!e) return; + + if (is_keystroke) + { + if (!_ecore_wince_event_keystroke_get(LOWORD(msg->window_param), + EINA_TRUE, + (char **)&e->keyname, + (char **)&e->key, + (char **)&e->string)) + { + free(e); + return; + } + } + else + { + if (!_ecore_wince_event_char_get(LOWORD(msg->window_param), + (char **)&e->keyname, + (char **)&e->key, + (char **)&e->string)) + { + free(e); + return; + } + } + + e->window = (Ecore_Window)GetWindowLong(msg->window, GWL_USERDATA); + e->event_window = e->window; + if (!e->window) + { + free(e); + return; + } + e->timestamp = msg->time; + + _ecore_wince_event_last_time = e->timestamp; + + ecore_event_add(ECORE_EVENT_KEY_DOWN, e, _ecore_wince_event_free_key_down, NULL); +} + +void +_ecore_wince_event_handle_key_release(Ecore_WinCE_Callback_Data *msg, + int is_keystroke) +{ + Ecore_Event_Key *e; + + INF("key released"); + + e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key)); + if (!e) return; + + if (is_keystroke) + { + if (!_ecore_wince_event_keystroke_get(LOWORD(msg->window_param), + EINA_FALSE, + (char **)&e->keyname, + (char **)&e->key, + (char **)&e->string)) + { + free(e); + return; + } + } + else + { + if (!_ecore_wince_event_char_get(LOWORD(msg->window_param), + (char **)&e->keyname, + (char **)&e->key, + (char **)&e->string)) + { + free(e); + return; + } + } + + e->window = (Ecore_Window)GetWindowLong(msg->window, GWL_USERDATA); + e->event_window = e->window; + if (!e->window) + { + free(e); + return; + } + e->timestamp = msg->time; + + _ecore_wince_event_last_time = e->timestamp; + + ecore_event_add(ECORE_EVENT_KEY_UP, e, _ecore_wince_event_free_key_up, NULL); +} + +void +_ecore_wince_event_handle_button_press(Ecore_WinCE_Callback_Data *msg, + int button) +{ + Ecore_WinCE_Window *window; + + INF("mouse button pressed"); + + window = (Ecore_WinCE_Window *)GetWindowLong(msg->window, GWL_USERDATA); + + { + Ecore_Event_Mouse_Move *e; + + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); + if (!e) return; + + e->window = (Ecore_Window)window; + e->event_window = e->window; + e->x = LOWORD(msg->data_param); + e->y = HIWORD(msg->data_param); + e->timestamp = msg->time; + + _ecore_wince_event_last_time = e->timestamp; + _ecore_wince_event_last_window = (Ecore_WinCE_Window *)e->window; + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); + } + + { + Ecore_Event_Mouse_Button *e; + + if (_ecore_wince_mouse_down_did_triple) + { + _ecore_wince_mouse_down_last_window = NULL; + _ecore_wince_mouse_down_last_last_window = NULL; + _ecore_wince_mouse_down_last_time = 0; + _ecore_wince_mouse_down_last_last_time = 0; + } + + e = (Ecore_Event_Mouse_Button *)calloc(1, sizeof(Ecore_Event_Mouse_Button)); + if (!e) return; + + e->window = (Ecore_Window)window; + e->event_window = e->window; + e->buttons = button; + e->x = LOWORD(msg->data_param); + e->y = HIWORD(msg->data_param); + e->timestamp = msg->time; + + if (((e->timestamp - _ecore_wince_mouse_down_last_time) <= (long)(1000 * _ecore_wince_double_click_time)) && + (e->window == (Ecore_Window)_ecore_wince_mouse_down_last_window)) + e->double_click = 1; + + if (((e->timestamp - _ecore_wince_mouse_down_last_last_time) <= (long)(2 * 1000 * _ecore_wince_double_click_time)) && + (e->window == (Ecore_Window)_ecore_wince_mouse_down_last_window) && + (e->window == (Ecore_Window)_ecore_wince_mouse_down_last_last_window)) + { + e->triple_click = 1; + _ecore_wince_mouse_down_did_triple = 1; + } + else + _ecore_wince_mouse_down_did_triple = 0; + + if (!e->double_click && !e->triple_click) + _ecore_wince_mouse_up_count = 0; + + _ecore_wince_event_last_time = e->timestamp; + _ecore_wince_event_last_window = (Ecore_WinCE_Window *)e->window; + + if (!_ecore_wince_mouse_down_did_triple) + { + _ecore_wince_mouse_down_last_last_window = _ecore_wince_mouse_down_last_window; + _ecore_wince_mouse_down_last_window = (Ecore_WinCE_Window *)e->window; + _ecore_wince_mouse_down_last_last_time = _ecore_wince_mouse_down_last_time; + _ecore_wince_mouse_down_last_time = e->timestamp; + } + + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL); + } +} + +void +_ecore_wince_event_handle_button_release(Ecore_WinCE_Callback_Data *msg, + int button) +{ + Ecore_WinCE_Window *window; + + INF("mouse button released"); + + window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + + { + Ecore_Event_Mouse_Move *e; + + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); + if (!e) return; + + e->window = (Ecore_Window)window; + e->event_window = e->window; + e->x = LOWORD(msg->data_param); + e->y = HIWORD(msg->data_param); + e->timestamp = msg->time; + + _ecore_wince_event_last_time = e->timestamp; + _ecore_wince_event_last_window = (Ecore_WinCE_Window *)e->window; + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); + } + + { + Ecore_Event_Mouse_Button *e; + + e = (Ecore_Event_Mouse_Button *)calloc(1, sizeof(Ecore_Event_Mouse_Button)); + if (!e) return; + + e->window = (Ecore_Window)window; + e->event_window = e->window; + e->buttons = button; + e->x = LOWORD(msg->data_param); + e->y = HIWORD(msg->data_param); + e->timestamp = msg->time; + + _ecore_wince_mouse_up_count++; + + if ((_ecore_wince_mouse_up_count >= 2) && + ((e->timestamp - _ecore_wince_mouse_down_last_time) <= (long)(1000 * _ecore_wince_double_click_time)) && + (e->window == (Ecore_Window)_ecore_wince_mouse_down_last_window)) + e->double_click = 1; + + if ((_ecore_wince_mouse_up_count >= 3) && + ((e->timestamp - _ecore_wince_mouse_down_last_last_time) <= (long)(2 * 1000 * _ecore_wince_double_click_time)) && + (e->window == (Ecore_Window)_ecore_wince_mouse_down_last_window) && + (e->window == (Ecore_Window)_ecore_wince_mouse_down_last_last_window)) + e->triple_click = 1; + + _ecore_wince_event_last_time = e->timestamp; + _ecore_wince_event_last_window = (Ecore_WinCE_Window *)e->window; + + ecore_event_add(ECORE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL); + } +} + +void +_ecore_wince_event_handle_motion_notify(Ecore_WinCE_Callback_Data *msg) +{ + Ecore_Event_Mouse_Move *e; + + INF("mouse moved"); + + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); + if (!e) return; + + e->window = (Ecore_Window)GetWindowLong(msg->window, GWL_USERDATA); + e->event_window = e->window; + e->x = LOWORD(msg->data_param); + e->y = HIWORD(msg->data_param); + e->timestamp = msg->time; + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); +} + +void +_ecore_wince_event_handle_enter_notify(Ecore_WinCE_Callback_Data *msg) +{ + Ecore_WinCE_Window *window; + + INF("mouse in"); + + window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + + { + Ecore_Event_Mouse_Move *e; + + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); + if (!e) return; + + e->window = (Ecore_Window)window; + e->event_window = e->window; + e->x = msg->x; + e->y = msg->y; + e->timestamp = msg->time; + + _ecore_wince_event_last_time = e->timestamp; + _ecore_wince_event_last_window = (Ecore_WinCE_Window *)e->window; + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); + } + + { + Ecore_WinCE_Event_Mouse_In *e; + + e = (Ecore_WinCE_Event_Mouse_In *)calloc(1, sizeof(Ecore_WinCE_Event_Mouse_In)); + if (!e) return; + + e->window = window; + e->x = msg->x; + e->y = msg->y; + e->time = msg->time; + + _ecore_wince_event_last_time = e->time; + + ecore_event_add(ECORE_WINCE_EVENT_MOUSE_IN, e, NULL, NULL); + } +} + +void +_ecore_wince_event_handle_leave_notify(Ecore_WinCE_Callback_Data *msg) +{ + Ecore_WinCE_Window *window; + + INF("mouse out"); + + window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + + { + Ecore_Event_Mouse_Move *e; + + e = (Ecore_Event_Mouse_Move *)calloc(1, sizeof(Ecore_Event_Mouse_Move)); + if (!e) return; + + e->window = (Ecore_Window)window; + e->event_window = e->window; + e->x = msg->x; + e->y = msg->y; + e->timestamp = msg->time; + + _ecore_wince_event_last_time = e->timestamp; + _ecore_wince_event_last_window = (Ecore_WinCE_Window *)e->window; + + ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); + } + + { + Ecore_WinCE_Event_Mouse_Out *e; + + e = (Ecore_WinCE_Event_Mouse_Out *)calloc(1, sizeof(Ecore_WinCE_Event_Mouse_Out)); + if (!e) return; + + e->window = window; + e->x = msg->x; + e->y = msg->y; + e->time = msg->time; + + _ecore_wince_event_last_time = e->time; + + ecore_event_add(ECORE_WINCE_EVENT_MOUSE_OUT, e, NULL, NULL); + } +} + +void +_ecore_wince_event_handle_focus_in(Ecore_WinCE_Callback_Data *msg) +{ + Ecore_WinCE_Event_Window_Focus_In *e; + Ecore_WinCE_Window *window; + + INF("focus in"); + + e = (Ecore_WinCE_Event_Window_Focus_In *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Focus_In)); + if (!e) return; + + window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + if (!e->window) + { + free(e); + return; + } + + if (window->resume_cb) + window->resume_cb(window->backend); + + e->window = window; + + e->time = _ecore_wince_event_last_time; + _ecore_wince_event_last_time = e->time; + + ecore_event_add(ECORE_WINCE_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL); +} + +void +_ecore_wince_event_handle_focus_out(Ecore_WinCE_Callback_Data *msg) +{ + Ecore_WinCE_Event_Window_Focus_Out *e; + Ecore_WinCE_Window *window; + + INF("focus out"); + + e = (Ecore_WinCE_Event_Window_Focus_Out *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Focus_Out)); + if (!e) return; + + window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + if (!e->window) + { + free(e); + return; + } + if (window->suspend_cb) + window->suspend_cb(window->backend); + + e->window = window; + + e->time = _ecore_wince_event_last_time; + _ecore_wince_event_last_time = e->time; + + ecore_event_add(ECORE_WINCE_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL); +} + +void +_ecore_wince_event_handle_expose(Ecore_WinCE_Callback_Data *msg) +{ + Ecore_WinCE_Event_Window_Damage *e; + + INF("window expose"); + + e = (Ecore_WinCE_Event_Window_Damage *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Damage)); + if (!e) return; + + e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + if (!e->window) + { + free(e); + return; + } + + e->x = msg->update.left; + e->y = msg->update.top; + e->width = msg->update.right - msg->update.left; + e->height = msg->update.bottom - msg->update.top; + INF("window expose size: %dx%d", e->width, e->height); + + e->time = _ecore_wince_event_last_time; + + ecore_event_add(ECORE_WINCE_EVENT_WINDOW_DAMAGE, e, NULL, NULL); +} + +void +_ecore_wince_event_handle_create_notify(Ecore_WinCE_Callback_Data *msg) +{ + Ecore_WinCE_Event_Window_Create *e; + + INF("window create notify"); + + e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Create)); + if (!e) return; + + e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + if (!e->window) + { + free(e); + return; + } + + e->time = _ecore_wince_event_last_time; + + ecore_event_add(ECORE_WINCE_EVENT_WINDOW_CREATE, e, NULL, NULL); +} + +void +_ecore_wince_event_handle_destroy_notify(Ecore_WinCE_Callback_Data *msg) +{ + Ecore_WinCE_Event_Window_Destroy *e; + + INF("window destroy notify"); + + e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Destroy)); + if (!e) return; + + e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + if (!e->window) + { + free(e); + return; + } + + e->time = _ecore_wince_event_last_time; +/* if (e->window == _ecore_wince_event_last_window) _ecore_wince_event_last_window = NULL; */ + + ecore_event_add(ECORE_WINCE_EVENT_WINDOW_DESTROY, e, NULL, NULL); +} + +void +_ecore_wince_event_handle_map_notify(Ecore_WinCE_Callback_Data *msg) +{ + Ecore_WinCE_Event_Window_Show *e; + + INF("window map notify"); + + e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Show)); + if (!e) return; + + e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + if (!e->window) + { + free(e); + return; + } + + e->time = _ecore_wince_event_last_time; + + ecore_event_add(ECORE_WINCE_EVENT_WINDOW_SHOW, e, NULL, NULL); +} + +void +_ecore_wince_event_handle_unmap_notify(Ecore_WinCE_Callback_Data *msg) +{ + Ecore_WinCE_Event_Window_Hide *e; + + INF("window unmap notify"); + + e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Hide)); + if (!e) return; + + e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + if (!e->window) + { + free(e); + return; + } + + e->time = _ecore_wince_event_last_time; + + ecore_event_add(ECORE_WINCE_EVENT_WINDOW_HIDE, e, NULL, NULL); +} + +void +_ecore_wince_event_handle_delete_request(Ecore_WinCE_Callback_Data *msg) +{ + Ecore_WinCE_Event_Window_Delete_Request *e; + + INF("window delete request"); + + e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Delete_Request)); + if (!e) return; + + e->window = (void *)GetWindowLong(msg->window, GWL_USERDATA); + if (!e->window) + { + free(e); + return; + } + + e->time = _ecore_wince_event_last_time; + + ecore_event_add(ECORE_WINCE_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL); +} + +/*============================================================================* + * API * + *============================================================================*/ + diff --git a/libraries/ecore/src/lib/ecore_wince/ecore_wince_private.h b/libraries/ecore/src/lib/ecore_wince/ecore_wince_private.h new file mode 100644 index 0000000..b506312 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_wince/ecore_wince_private.h @@ -0,0 +1,85 @@ +#ifndef __ECORE_WINCE_PRIVATE_H__ +#define __ECORE_WINCE_PRIVATE_H__ + + +/* logging messages macros */ +extern int _ecore_wince_log_dom_global; + +#ifdef ECORE_WINCE_DEFAULT_LOG_COLOR +#undef ECORE_WINCE_DEFAULT_LOG_COLOR +#endif +#define ECORE_WINCE_DEFAULT_LOG_COLOR EINA_COLOR_LIGHTBLUE + +#ifdef ERR +# undef ERR +#endif +#define ERR(...) EINA_LOG_DOM_ERR(_ecore_wince_log_dom_global , __VA_ARGS__) +#ifdef DBG +# undef DBG +#endif +#define DBG(...) EINA_LOG_DOM_DBG(_ecore_wince_log_dom_global , __VA_ARGS__) +#ifdef INF +# undef INF +#endif +#define INF(...) EINA_LOG_DOM_INFO(_ecore_wince_log_dom_global , __VA_ARGS__) + +#define ECORE_WINCE_WINDOW_CLASS L"Ecore_WinCE_Window_Class" + + +typedef struct _Ecore_WinCE_Callback_Data Ecore_WinCE_Callback_Data; + +struct _Ecore_WinCE_Callback_Data +{ + RECT update; + HWND window; + unsigned int message; + WPARAM window_param; + LPARAM data_param; + long time; + int x; + int y; +}; + + +typedef int (*ecore_wince_suspend_cb) (int); +typedef int (*ecore_wince_resume_cb) (int); + + +struct _Ecore_WinCE_Window +{ + HWND window; + + int backend; + ecore_wince_suspend_cb suspend_cb; + ecore_wince_resume_cb resume_cb; + + RECT rect; /* used to go fullscreen to normal */ + + unsigned int pointer_is_in : 1; + unsigned int fullscreen : 1; +}; + +extern HINSTANCE _ecore_wince_instance; +extern double _ecore_wince_double_click_time; +extern long _ecore_wince_event_last_time; +extern Ecore_WinCE_Window *_ecore_wince_event_last_window; + + +void _ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg, int is_keystroke); +void _ecore_wince_event_handle_key_release(Ecore_WinCE_Callback_Data *msg, int is_keystroke); +void _ecore_wince_event_handle_button_press(Ecore_WinCE_Callback_Data *msg, int button); +void _ecore_wince_event_handle_button_release(Ecore_WinCE_Callback_Data *msg, int button); +void _ecore_wince_event_handle_motion_notify(Ecore_WinCE_Callback_Data *msg); +void _ecore_wince_event_handle_enter_notify(Ecore_WinCE_Callback_Data *msg); +void _ecore_wince_event_handle_leave_notify(Ecore_WinCE_Callback_Data *msg); +void _ecore_wince_event_handle_focus_in(Ecore_WinCE_Callback_Data *msg); +void _ecore_wince_event_handle_focus_out(Ecore_WinCE_Callback_Data *msg); +void _ecore_wince_event_handle_expose(Ecore_WinCE_Callback_Data *msg); +void _ecore_wince_event_handle_create_notify(Ecore_WinCE_Callback_Data *msg); +void _ecore_wince_event_handle_destroy_notify(Ecore_WinCE_Callback_Data *msg); +void _ecore_wince_event_handle_map_notify(Ecore_WinCE_Callback_Data *msg); +void _ecore_wince_event_handle_unmap_notify(Ecore_WinCE_Callback_Data *msg); +void _ecore_wince_event_handle_delete_request(Ecore_WinCE_Callback_Data *msg); + + +#endif /* __ECORE_WINCE_PRIVATE_H__ */ diff --git a/libraries/ecore/src/lib/ecore_wince/ecore_wince_window.c b/libraries/ecore/src/lib/ecore_wince/ecore_wince_window.c new file mode 100644 index 0000000..4e8b7b1 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_wince/ecore_wince_window.c @@ -0,0 +1,775 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#define WIN32_LEAN_AND_MEAN +#include +#undef WIN32_LEAN_AND_MEAN + +#include +#include + +#include "Ecore_WinCE.h" +#include "ecore_wince_private.h" + +/*============================================================================* + * Local * + *============================================================================*/ + +/** + * @cond LOCAL + */ + + +typedef BOOL (__stdcall *UnregisterFunc1Proc)(UINT, UINT); + +static int +_ecore_wince_hardware_keys_register(HWND window) +{ + HINSTANCE core_dll; + UnregisterFunc1Proc unregister_fct; + int i; + + core_dll = LoadLibrary(L"coredll.dll"); + if (!core_dll) + { + ERR("LoadLibrary() failed"); + return 0; + } + + unregister_fct = (UnregisterFunc1Proc)GetProcAddress(core_dll, L"UnregisterFunc1"); + if (!unregister_fct) + { + ERR("GetProcAddress() failed"); + FreeLibrary(core_dll); + return 0; + } + + for (i = 0xc1; i <= 0xcf; i++) + { + unregister_fct(MOD_WIN, i); + RegisterHotKey(window, i, MOD_WIN, i); + } + + FreeLibrary(core_dll); + + return 1; +} + +/** + * @endcond + */ + + +/*============================================================================* + * Global * + *============================================================================*/ + +/*============================================================================* + * API * + *============================================================================*/ + +/** + * @addtogroup Ecore_WinCE_Group Ecore_WinCE library + * + * @{ + */ + +/** + * @brief Creates a new window. + * + * @param parent The parent window. + * @param x The x coordinate of the top-left corner of the window. + * @param y The y coordinate of the top-left corner of the window. + * @param width The width of the window. + * @param height The height of hte window. + * @return A newly allocated window. + * + * This function creates a new window which parent is @p parent. @p width and + * @p height are the size of the window content (the client part), + * without the border and title bar. @p x and @p y are the system + * coordinates of the top left cerner of the window (that is, of the + * title bar). This function returns a newly created window on + * success, and @c NULL on failure. + */ +EAPI Ecore_WinCE_Window * +ecore_wince_window_new(Ecore_WinCE_Window *parent, + int x, + int y, + int width, + int height) +{ + Ecore_WinCE_Window *w; + HWND window; + RECT rect; + + INF("creating window"); + + w = (Ecore_WinCE_Window *)calloc(1, sizeof(Ecore_WinCE_Window)); + if (!w) + { + ERR("malloc() failed"); + return NULL; + } + + rect.left = 0; + rect.top = 0; + rect.right = width; + rect.bottom = height; + if (!AdjustWindowRectEx(&rect, WS_CAPTION | WS_SYSMENU | WS_VISIBLE, FALSE, WS_EX_TOPMOST)) + { + ERR("AdjustWindowRectEx() failed"); + free(w); + return NULL; + } + + window = CreateWindowEx(WS_EX_TOPMOST, + ECORE_WINCE_WINDOW_CLASS, + L"", + WS_CAPTION | WS_SYSMENU | WS_VISIBLE, + x, y, + rect.right - rect.left, rect.bottom - rect.top, + parent ? ((Ecore_WinCE_Window *)parent)->window : NULL, + NULL, _ecore_wince_instance, NULL); + if (!window) + { + ERR("CreateWindowEx() failed"); + free(w); + return NULL; + } + + if (!_ecore_wince_hardware_keys_register(window)) + { + ERR("_ecore_wince_hardware_keys_register() failed"); + DestroyWindow(window); + free(w); + return NULL; + } + + w->window = window; + + SetLastError(0); + if (!SetWindowLong(window, GWL_USERDATA, (LONG)w) && (GetLastError() != 0)) + { + ERR("SetWindowLong() failed"); + DestroyWindow(window); + free(w); + return NULL; + } + + w->pointer_is_in = 0; + + return w; +} + +/** + * @brief Free the given window. + * + * @param window The window to free. + * + * This function frees @p window. If @p window is @c NULL, this + * function does nothing. + */ +EAPI void +ecore_wince_window_free(Ecore_WinCE_Window *window) +{ + if (!window) return; + + INF("destroying window"); + + DestroyWindow(window->window); + free(window); +} + +/** + * @brief Return the window HANDLE associated to the given window. + * + * @param window The window to retrieve the HANDLE from. + * + * This function returns the window HANDLE associated to @p window. If + * @p window is @c NULL, this function returns @c NULL. + */ +EAPI void * +ecore_wince_window_hwnd_get(Ecore_WinCE_Window *window) +{ + if (!window) + return NULL; + + return window->window; +} + +/** + * @brief Move the given window to a given position. + * + * @param window The window to move. + * @param x The x coordinate of the destination position. + * @param y The y coordinate of the destination position. + * + * This function move @p window to the new position of coordinates @p x + * and @p y. If @p window is @c NULL, or if it is fullscreen, or on + * error, this function does nothing. + */ +EAPI void +ecore_wince_window_move(Ecore_WinCE_Window *window, + int x, + int y) +{ + RECT rect; + + if (!window || window->fullscreen) + return; + + INF("moving window (%dx%d)", x, y); + + if (!GetWindowRect(window->window, &rect)) + { + ERR("GetWindowRect() failed"); + return; + } + + if (!MoveWindow(window->window, x, y, + rect.right - rect.left, + rect.bottom - rect.top, + TRUE)) + { + ERR("MoveWindow() failed"); + } +} + +/** + * @brief Resize the given window to a given size. + * + * @param window The window to resize. + * @param width The new width. + * @param height The new height. + * + * This function resize @p window to the new @p width and @p height. + * If @p window is @c NULL, or if it is fullscreen, or on error, this + * function does nothing. + */ +EAPI void +ecore_wince_window_resize(Ecore_WinCE_Window *window, + int width, + int height) +{ + RECT rect; + DWORD style; + DWORD exstyle; + int x; + int y; + + if (!window || window->fullscreen) + return; + + INF("resizing window (%dx%d)", width, height); + + if (!GetWindowRect(window->window, &rect)) + { + ERR("GetWindowRect() failed"); + return; + } + + x = rect.left; + y = rect.top; + rect.left = 0; + rect.top = 0; + rect.right = width; + rect.bottom = height; + if (!(style = GetWindowLong(window->window, GWL_STYLE))) + { + ERR("GetWindowLong() failed"); + return; + } + if (!(exstyle = GetWindowLong(window->window, GWL_EXSTYLE))) + { + ERR("GetWindowLong() failed"); + return; + } + if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle)) + { + ERR("AdjustWindowRectEx() failed"); + return; + } + + if (!MoveWindow(window->window, x, y, + rect.right - rect.left, + rect.bottom - rect.top, + FALSE)) + { + ERR("MoveWindow() failed"); + } +} + +/** + * @brief Move and resize the given window to a given position and size. + * + * @param window The window to move and resize. + * @param x The x coordinate of the destination position. + * @param y The x coordinate of the destination position. + * @param width The new width. + * @param height The new height. + * + * This function resize @p window to the new position of coordinates @p x + * and @p y and the new @p width and @p height. If @p window is @c NULL, + * or if it is fullscreen, or on error, this function does nothing. + */ +EAPI void +ecore_wince_window_move_resize(Ecore_WinCE_Window *window, + int x, + int y, + int width, + int height) +{ + RECT rect; + DWORD style; + DWORD exstyle; + + if (!window || window->fullscreen) + return; + + INF("moving and resizing window (%dx%d %dx%d)", x, y, width, height); + + rect.left = 0; + rect.top = 0; + rect.right = width; + rect.bottom = height; + if (!(style = GetWindowLong(window->window, GWL_STYLE))) + { + ERR("GetWindowLong() failed"); + return; + } + if (!(exstyle = GetWindowLong(window->window, GWL_EXSTYLE))) + { + ERR("GetWindowLong() failed"); + return; + } + if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle)) + { + ERR("AdjustWindowRectEx() failed"); + return; + } + + if (!MoveWindow(window->window, x, y, + rect.right - rect.left, + rect.bottom - rect.top, + TRUE)) + { + ERR("MoveWindow() failed"); + } +} + +/** + * @brief Show the given window. + * + * @param window The window to show. + * + * This function shows @p window. If @p window is @c NULL, or on + * error, this function does nothing. + */ +EAPI void +ecore_wince_window_show(Ecore_WinCE_Window *window) +{ + if (!window) return; + + INF("showing window"); + + if (!ShowWindow(window->window, SW_SHOWNORMAL)) + { + ERR("ShowWindow() failed"); + return; + } + if (!UpdateWindow(window->window)) + { + ERR("UpdateWindow() failed"); + } + if (!SendMessage(window->window, WM_SHOWWINDOW, 1, 0)) + { + ERR("SendMessage() failed"); + } +} + +/** + * @brief Hide the given window. + * + * @param window The window to show. + * + * This function hides @p window. If @p window is @c NULL, or on + * error, this function does nothing. + */ +EAPI void +ecore_wince_window_hide(Ecore_WinCE_Window *window) +{ + if (!window) return; + + INF("hiding window"); + + if (!ShowWindow(window->window, SW_HIDE)) + { + ERR("ShowWindow() failed"); + return; + } + if (!SendMessage(window->window, WM_SHOWWINDOW, 0, 0)) + { + ERR("SendMessage() failed"); + } +} + +/** + * @brief Set the title of the given window. + * + * @param window The window to set the title. + * @param title The new title. + * + * This function sets the title of @p window to @p title. If @p window + * is @c NULL, or if @p title is @c NULL or empty, or on error, this + * function does nothing. + */ +EAPI void +ecore_wince_window_title_set(Ecore_WinCE_Window *window, + const char *title) +{ + wchar_t *wtitle; + + if (!window) return; + + if (!title || !title[0]) return; + + INF("setting window title"); + + wtitle = evil_char_to_wchar(title); + if (!wtitle) return; + + if (!SetWindowText(window->window, wtitle)) + { + ERR("SetWindowText() failed"); + } + free(wtitle); +} + +/** + * @brief Set the graphic backend used for the given window. + * + * @param window The window. + * @param backend The backend. + * + * This function sets the graphic backend to use with @p window to + * @p backend. If @p window if @c NULL, this function does nothing. + * + * The valid values for @p backend are + * + * @li 0: automatic choice of the backend. + * @li 1: the framebuffer (fast but could be not well suported). + * @li 2: GAPI (less fast but almost always supported). + * @li 3: DirectDraw (less fast than GAPI but almost always + * supported). + * @li 4: GDI (the slowest but always supported). + * + * The @p backend is used only in Evas and Ecore_Evas. So this + * function should not be called if Ecore_Evas is used. + */ +EAPI void +ecore_wince_window_backend_set(Ecore_WinCE_Window *window, + int backend) +{ + if (!window) + return; + + INF("setting backend"); + + window->backend = backend; +} + +/** + * @brief Set the suspend callback used for the given window. + * + * @param window The window. + * @param suspend_cb The suspend callback. + * + * This function sets the suspend callback to use with @p window to + * @p suspend_cb. If @p window if @c NULL, this function does nothing. + * + * The @p suspend_cb is used only in Evas and Ecore_Evas. So this + * function should not be called if Ecore_Evas is used. + */ +EAPI void +ecore_wince_window_suspend_cb_set(Ecore_WinCE_Window *window, int (*suspend_cb)(int)) +{ + if (!window) + return; + + INF("setting suspend callback"); + + window->suspend_cb = suspend_cb; +} + +/** + * @brief Set the resume callback used for the given window. + * + * @param window The window. + * @param resume_cb The resume callback. + * + * This function sets the resume callback to use with @p window to + * @p resume_cb. If @p window if @c NULL, this function does nothing. + * + * The @p resume_cb is used only in Evas and Ecore_Evas. So this + * function should not be called if Ecore_Evas is used. + */ +EAPI void +ecore_wince_window_resume_cb_set(Ecore_WinCE_Window *window, int (*resume_cb)(int)) +{ + if (!window) + return; + + INF("setting resume callback"); + + window->resume_cb = resume_cb; +} + +/** + * @brief Get the geometry of the given window. + * + * @param window The window to retrieve the geometry from. + * @param x The x coordinate of the position. + * @param y The x coordinate of the position. + * @param width The width. + * @param height The height. + * + * This function retrieves the position and size of @p window. @p x, + * @p y, @p width and @p height can be buffers that will be filled with + * the corresponding values. If one of them is @c NULL, nothing will + * be done for that parameter. If @p window is @c NULL, and if the + * buffers are not @c NULL, they will be filled with respectively 0, + * 0, the size of the screen and the height of the screen. + */ +EAPI void +ecore_wince_window_geometry_get(Ecore_WinCE_Window *window, + int *x, + int *y, + int *width, + int *height) +{ + RECT rect; + int w; + int h; + + INF("getting window geometry"); + + if (!window) + { + if (x) *x = 0; + if (y) *y = 0; + if (width) *width = GetSystemMetrics(SM_CXSCREEN); + if (height) *height = GetSystemMetrics(SM_CYSCREEN); + + return; + } + + if (!GetClientRect(window->window, &rect)) + { + ERR("GetClientRect() failed"); + + if (x) *x = 0; + if (y) *y = 0; + if (width) *width = 0; + if (height) *height = 0; + + return; + } + + w = rect.right - rect.left; + h = rect.bottom - rect.top; + + if (!GetWindowRect(window->window, &rect)) + { + ERR("GetWindowRect() failed"); + + if (x) *x = 0; + if (y) *y = 0; + if (width) *width = 0; + if (height) *height = 0; + + return; + } + + if (x) *x = rect.left; + if (y) *y = rect.top; + if (width) *width = w; + if (height) *height = h; +} + +/** + * @brief Get the size of the given window. + * + * @param window The window to retrieve the size from. + * @param width The width. + * @param height The height. + * + * This function retrieves the size of @p window. @p width and + * @p height can be buffers that will be filled with the corresponding + * values. If one of them is @c NULL, nothing will be done for that + * parameter. If @p window is @c NULL, and if the buffers are not + * @c NULL, they will be filled with respectively the size of the screen + * and the height of the screen. + */ +EAPI void +ecore_wince_window_size_get(Ecore_WinCE_Window *window, + int *width, + int *height) +{ + RECT rect; + + INF("getting window size"); + + if (!window) + { + if (width) *width = GetSystemMetrics(SM_CXSCREEN); + if (height) *height = GetSystemMetrics(SM_CYSCREEN); + + return; + } + + if (!GetClientRect(window->window, &rect)) + { + ERR("GetClientRect() failed"); + + if (width) *width = 0; + if (height) *height = 0; + } + + if (width) *width = rect.right - rect.left; + if (height) *height = rect.bottom - rect.top; +} + +/** + * @brief Set the given window to fullscreen. + * + * @param window The window. + * @param on EINA_TRUE for fullscreen mode, EINA_FALSE for windowed mode. + * + * This function set @p window to fullscreen or windowed mode. If @p on + * is set to EINA_TRUE, the window will be fullscreen, if it is set to + * EINA_FALSE, it will be windowed. If @p window is @c NULL or if the + * state does not change (like setting to fullscreen while the window + * is already fullscreen), this function does nothing. + */ +EAPI void +ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window, + Eina_Bool on) +{ + HWND task_bar; + + if (!window) return; + + if (((window->fullscreen) && (on)) || + ((!window->fullscreen) && (!on))) + return; + + INF("setting fullscreen: %s", on ? "yes" : "no"); + + window->fullscreen = !!on; + + if (on) + { + /* save the position and size of the window */ + if (!GetWindowRect(window->window, &window->rect)) + { + ERR("GetWindowRect() failed"); + return; + } + + /* hide task bar */ + task_bar = FindWindow(L"HHTaskBar", NULL); + if (!task_bar) + { + INF("FindWindow(): can not find task bar"); + } + if (!ShowWindow(task_bar, SW_HIDE)) + { + INF("ShowWindow(): task bar already hidden"); + } + if (!EnableWindow(task_bar, FALSE)) + { + INF("EnableWindow(): input already disabled"); + } + + /* style: visible + popup */ + if (!SetWindowLong(window->window, GWL_STYLE, WS_POPUP | WS_VISIBLE)) + { + INF("SetWindowLong() failed"); + } + + /* resize window to fit the entire screen */ + if (!SetWindowPos(window->window, HWND_TOPMOST, + 0, 0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED)) + { + INF("SetWindowPos() failed"); + } + /* + * It seems that SetWindowPos is not sufficient. + * Call MoveWindow with the correct size and force painting. + * Note that UpdateWindow (forcing repainting) is not sufficient + */ + if (!MoveWindow(window->window, + 0, 0, + GetSystemMetrics(SM_CXSCREEN), + GetSystemMetrics(SM_CYSCREEN), + TRUE)) + { + INF("MoveWindow() failed"); + } + } + else + { + /* show task bar */ + task_bar = FindWindow(L"HHTaskBar", NULL); + if (!task_bar) + { + INF("FindWindow(): can not find task bar"); + } + if (!ShowWindow(task_bar, SW_SHOW)) + { + INF("ShowWindow(): task bar already visible"); + } + if (!EnableWindow(task_bar, TRUE)) + { + INF("EnableWindow(): input already enabled"); + } + + /* style: visible + caption + sysmenu */ + if (!SetWindowLong(window->window, GWL_STYLE, WS_CAPTION | WS_SYSMENU | WS_VISIBLE)) + { + INF("SetWindowLong() failed"); + } + /* restaure the position and size of the window */ + if (!SetWindowPos(window->window, HWND_TOPMOST, + window->rect.left, + window->rect.top, + window->rect.right - window->rect.left, + window->rect.bottom - window->rect.top, + SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED)) + { + INF("SetWindowLong() failed"); + } + /* + * It seems that SetWindowPos is not sufficient. + * Call MoveWindow with the correct size and force painting. + * Note that UpdateWindow (forcing repainting) is not sufficient + */ + if (!MoveWindow(window->window, + window->rect.left, + window->rect.top, + window->rect.right - window->rect.left, + window->rect.bottom - window->rect.top, + TRUE)) + { + INF("MoveWindow() failed"); + } + } +} + +/** + * @} + */ diff --git a/libraries/ecore/src/lib/ecore_x/Ecore_X.h b/libraries/ecore/src/lib/ecore_x/Ecore_X.h new file mode 100644 index 0000000..6588a75 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/Ecore_X.h @@ -0,0 +1,3622 @@ +#ifndef _ECORE_X_H +#define _ECORE_X_H + +#include + +#ifdef EAPI +# undef EAPI +#endif // ifdef EAPI + +#ifdef _MSC_VER +# ifdef BUILDING_DLL +# define EAPI __declspec(dllexport) +# else // ifdef BUILDING_DLL +# define EAPI __declspec(dllimport) +# endif // ifdef BUILDING_DLL +#else // ifdef _MSC_VER +# ifdef __GNUC__ +# if __GNUC__ >= 4 +# define EAPI __attribute__ ((visibility("default"))) +# else // if __GNUC__ >= 4 +# define EAPI +# endif // if __GNUC__ >= 4 +# else // ifdef __GNUC__ +# define EAPI +# endif // ifdef __GNUC__ +#endif // ifdef _MSC_VER + +#include + +/** + * @file + * @brief Ecore functions for dealing with the X Windows System + * + * Ecore_X provides a wrapper and convenience functions for using the + * X Windows System. Function groups for this part of the library + * include the following: + * @li @ref Ecore_X_Init_Group + * @li @ref Ecore_X_Display_Attr_Group + * @li @ref Ecore_X_Flush_Group + */ + +typedef unsigned int Ecore_X_ID; +#ifndef _ECORE_X_WINDOW_PREDEF +typedef Ecore_X_ID Ecore_X_Window; +#endif // ifndef _ECORE_X_WINDOW_PREDEF +typedef void *Ecore_X_Visual; +typedef Ecore_X_ID Ecore_X_Pixmap; +typedef Ecore_X_ID Ecore_X_Drawable; +#ifdef HAVE_ECORE_X_XCB +typedef Ecore_X_ID Ecore_X_GC; +#else // ifdef HAVE_ECORE_X_XCB +typedef void *Ecore_X_GC; +#endif /* HAVE_ECORE_X_XCB */ +typedef Ecore_X_ID Ecore_X_Atom; +typedef Ecore_X_ID Ecore_X_Colormap; +typedef Ecore_X_ID Ecore_X_Time; +typedef Ecore_X_ID Ecore_X_Cursor; +typedef void Ecore_X_Display; +typedef void Ecore_X_Connection; +typedef void Ecore_X_Screen; +typedef Ecore_X_ID Ecore_X_Sync_Counter; +typedef Ecore_X_ID Ecore_X_Sync_Alarm; +typedef void Ecore_X_XRegion; + +typedef Ecore_X_ID Ecore_X_Randr_Output; +typedef Ecore_X_ID Ecore_X_Randr_Crtc; +typedef Ecore_X_ID Ecore_X_Randr_Mode; +typedef unsigned short Ecore_X_Randr_Size_ID; +typedef int Ecore_X_Randr_Screen; + +typedef Ecore_X_ID Ecore_X_Device; + +#ifdef __cplusplus +extern "C" { +#endif // ifdef __cplusplus + +typedef struct _Ecore_X_Rectangle +{ + int x, y; + unsigned int width, height; +} Ecore_X_Rectangle; + +typedef struct _Ecore_X_Icon +{ + unsigned int width, height; + unsigned int *data; +} Ecore_X_Icon; + +typedef enum _Ecore_X_GC_Value_Mask +{ + ECORE_X_GC_VALUE_MASK_FUNCTION = (1L << 0), + ECORE_X_GC_VALUE_MASK_PLANE_MASK = (1L << 1), + ECORE_X_GC_VALUE_MASK_FOREGROUND = (1L << 2), + ECORE_X_GC_VALUE_MASK_BACKGROUND = (1L << 3), + ECORE_X_GC_VALUE_MASK_LINE_WIDTH = (1L << 4), + ECORE_X_GC_VALUE_MASK_LINE_STYLE = (1L << 5), + ECORE_X_GC_VALUE_MASK_CAP_STYLE = (1L << 6), + ECORE_X_GC_VALUE_MASK_JOIN_STYLE = (1L << 7), + ECORE_X_GC_VALUE_MASK_FILL_STYLE = (1L << 8), + ECORE_X_GC_VALUE_MASK_FILL_RULE = (1L << 9), + ECORE_X_GC_VALUE_MASK_TILE = (1L << 10), + ECORE_X_GC_VALUE_MASK_STIPPLE = (1L << 11), + ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_X = (1L << 12), + ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_Y = (1L << 13), + ECORE_X_GC_VALUE_MASK_FONT = (1L << 14), + ECORE_X_GC_VALUE_MASK_SUBWINDOW_MODE = (1L << 15), + ECORE_X_GC_VALUE_MASK_GRAPHICS_EXPOSURES = (1L << 16), + ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_X = (1L << 17), + ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_Y = (1L << 18), + ECORE_X_GC_VALUE_MASK_CLIP_MASK = (1L << 19), + ECORE_X_GC_VALUE_MASK_DASH_OFFSET = (1L << 20), + ECORE_X_GC_VALUE_MASK_DASH_LIST = (1L << 21), + ECORE_X_GC_VALUE_MASK_ARC_MODE = (1L << 22) +} Ecore_X_GC_Value_Mask; + +typedef enum _Ecore_X_Composite_Update_Type +{ + ECORE_X_COMPOSITE_UPDATE_AUTOMATIC, + ECORE_X_COMPOSITE_UPDATE_MANUAL +} Ecore_X_Composite_Update_Type; + +typedef enum _Ecore_X_Window_State +{ + /* Unknown state */ + ECORE_X_WINDOW_STATE_UNKNOWN = 0, + /** The window is iconified. */ + ECORE_X_WINDOW_STATE_ICONIFIED, + /** The window is a modal dialog box. */ + ECORE_X_WINDOW_STATE_MODAL, + /** The window manager should keep the window's position fixed + * even if the virtual desktop scrolls. */ + ECORE_X_WINDOW_STATE_STICKY, + /** The window has the maximum vertical size. */ + ECORE_X_WINDOW_STATE_MAXIMIZED_VERT, + /** The window has the maximum horizontal size. */ + ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ, + /** The window is shaded. */ + ECORE_X_WINDOW_STATE_SHADED, + /** The window should not be included in the taskbar. */ + ECORE_X_WINDOW_STATE_SKIP_TASKBAR, + /** The window should not be included in the pager. */ + ECORE_X_WINDOW_STATE_SKIP_PAGER, + /** The window is invisible (i.e. minimized/iconified) */ + ECORE_X_WINDOW_STATE_HIDDEN, + /** The window should fill the entire screen and have no + * window border/decorations */ + ECORE_X_WINDOW_STATE_FULLSCREEN, + /* The following are not documented because they are not + * intended for use in applications. */ + ECORE_X_WINDOW_STATE_ABOVE, + ECORE_X_WINDOW_STATE_BELOW, + /* FIXME: Documentation */ + ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION +} Ecore_X_Window_State; + +typedef enum _Ecore_X_Window_State_Action +{ + ECORE_X_WINDOW_STATE_ACTION_REMOVE, + ECORE_X_WINDOW_STATE_ACTION_ADD, + ECORE_X_WINDOW_STATE_ACTION_TOGGLE +} Ecore_X_Window_State_Action; + +typedef enum _Ecore_X_Window_Stack_Mode +{ + ECORE_X_WINDOW_STACK_ABOVE = 0, + ECORE_X_WINDOW_STACK_BELOW = 1, + ECORE_X_WINDOW_STACK_TOP_IF = 2, + ECORE_X_WINDOW_STACK_BOTTOM_IF = 3, + ECORE_X_WINDOW_STACK_OPPOSITE = 4 +} Ecore_X_Window_Stack_Mode; + +typedef enum _Ecore_X_Randr_Orientation +{ + ECORE_X_RANDR_ORIENTATION_ROT_0 = (1 << 0), + ECORE_X_RANDR_ORIENTATION_ROT_90 = (1 << 1), + ECORE_X_RANDR_ORIENTATION_ROT_180 = (1 << 2), + ECORE_X_RANDR_ORIENTATION_ROT_270 = (1 << 3), + ECORE_X_RANDR_ORIENTATION_FLIP_X = (1 << 4), + ECORE_X_RANDR_ORIENTATION_FLIP_Y = (1 << 5) +} Ecore_X_Randr_Orientation; + +typedef enum _Ecore_X_Randr_Connection_Status +{ + ECORE_X_RANDR_CONNECTION_STATUS_CONNECTED = 0, + ECORE_X_RANDR_CONNECTION_STATUS_DISCONNECTED = 1, + ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN = 2 +} Ecore_X_Randr_Connection_Status; + +typedef enum _Ecore_X_Randr_Output_Policy +{ + ECORE_X_RANDR_OUTPUT_POLICY_ABOVE = 1, + ECORE_X_RANDR_OUTPUT_POLICY_RIGHT = 2, + ECORE_X_RANDR_OUTPUT_POLICY_BELOW = 3, + ECORE_X_RANDR_OUTPUT_POLICY_LEFT = 4, + ECORE_X_RANDR_OUTPUT_POLICY_CLONE = 5, + ECORE_X_RANDR_OUTPUT_POLICY_NONE = 6 +} Ecore_X_Randr_Output_Policy; + +typedef enum _Ecore_X_Randr_Relative_Alignment +{ + ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE = 0, + ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL = 1, + ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR = 2 +} Ecore_X_Randr_Relative_Alignment; + +typedef enum _Ecore_X_Render_Subpixel_Order +{ + ECORE_X_RENDER_SUBPIXEL_ORDER_UNKNOWN = 0, + ECORE_X_RENDER_SUBPIXEL_ORDER_HORIZONTAL_RGB = 1, + ECORE_X_RENDER_SUBPIXEL_ORDER_HORIZONTAL_BGR = 2, + ECORE_X_RENDER_SUBPIXEL_ORDER_VERTICAL_RGB = 3, + ECORE_X_RENDER_SUBPIXEL_ORDER_VERTICAL_BGR = 4, + ECORE_X_RENDER_SUBPIXEL_ORDER_NONE = 5 +} Ecore_X_Render_Subpixel_Order; + +typedef enum _Ecore_X_Randr_Edid_Display_Interface_Type +{ + ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_UNDEFINED, + ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_DVI, + ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_HDMI_A, + ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_HDMI_B, + ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_MDDI, + ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_DISPLAY_PORT +} Ecore_X_Randr_Edid_Display_Interface_Type; + +typedef enum _Ecore_X_Randr_Edid_Display_Colorscheme +{ + ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_MONOCHROME_GRAYSCALE = 0x00, + ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB = 0x08, + ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_NON_RGB = 0x10, + ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_UNDEFINED = 0x18, + ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_4_4_4 = 0x444000, + ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_4_4 = 0x444, + ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_2_2 = 0x422 +} Ecore_X_Randr_Edid_Display_Colorscheme; + +typedef enum _Ecore_X_Randr_Edid_Aspect_Ratio +{ + ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3 = 0x0, + ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9 = 0x1, + ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10 = 0x2, + ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4 = 0x4, + ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9 = 0x8 +} Ecore_X_Randr_Edid_Aspect_Ratio; + +#define ECORE_X_RANDR_EDID_UNKNOWN_VALUE -1 + +#define ECORE_X_SELECTION_TARGET_TARGETS "TARGETS" +#define ECORE_X_SELECTION_TARGET_TEXT "TEXT" +#define ECORE_X_SELECTION_TARGET_COMPOUND_TEXT "COMPOUND_TEXT" +#define ECORE_X_SELECTION_TARGET_STRING "STRING" +#define ECORE_X_SELECTION_TARGET_UTF8_STRING "UTF8_STRING" +#define ECORE_X_SELECTION_TARGET_FILENAME "FILENAME" + +#define ECORE_X_DND_VERSION 5 + +typedef enum _Ecore_X_Selection +{ + ECORE_X_SELECTION_PRIMARY, + ECORE_X_SELECTION_SECONDARY, + ECORE_X_SELECTION_XDND, + ECORE_X_SELECTION_CLIPBOARD, + ECORE_X_SELECTION_OTHER +} Ecore_X_Selection; + +typedef enum _Ecore_X_Event_Mode +{ + ECORE_X_EVENT_MODE_NORMAL, + ECORE_X_EVENT_MODE_WHILE_GRABBED, + ECORE_X_EVENT_MODE_GRAB, + ECORE_X_EVENT_MODE_UNGRAB +} Ecore_X_Event_Mode; + +typedef enum _Ecore_X_Event_Detail +{ + ECORE_X_EVENT_DETAIL_ANCESTOR, + ECORE_X_EVENT_DETAIL_VIRTUAL, + ECORE_X_EVENT_DETAIL_INFERIOR, + ECORE_X_EVENT_DETAIL_NON_LINEAR, + ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL, + ECORE_X_EVENT_DETAIL_POINTER, + ECORE_X_EVENT_DETAIL_POINTER_ROOT, + ECORE_X_EVENT_DETAIL_DETAIL_NONE +} Ecore_X_Event_Detail; + +typedef enum _Ecore_X_Event_Mask +{ + ECORE_X_EVENT_MASK_NONE = 0L, + ECORE_X_EVENT_MASK_KEY_DOWN = (1L << 0), + ECORE_X_EVENT_MASK_KEY_UP = (1L << 1), + ECORE_X_EVENT_MASK_MOUSE_DOWN = (1L << 2), + ECORE_X_EVENT_MASK_MOUSE_UP = (1L << 3), + ECORE_X_EVENT_MASK_MOUSE_IN = (1L << 4), + ECORE_X_EVENT_MASK_MOUSE_OUT = (1L << 5), + ECORE_X_EVENT_MASK_MOUSE_MOVE = (1L << 6), + ECORE_X_EVENT_MASK_WINDOW_DAMAGE = (1L << 15), + ECORE_X_EVENT_MASK_WINDOW_VISIBILITY = (1L << 16), + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE = (1L << 17), + ECORE_X_EVENT_MASK_WINDOW_RESIZE_MANAGE = (1L << 18), + ECORE_X_EVENT_MASK_WINDOW_MANAGE = (1L << 19), + ECORE_X_EVENT_MASK_WINDOW_CHILD_CONFIGURE = (1L << 20), + ECORE_X_EVENT_MASK_WINDOW_FOCUS_CHANGE = (1L << 21), + ECORE_X_EVENT_MASK_WINDOW_PROPERTY = (1L << 22), + ECORE_X_EVENT_MASK_WINDOW_COLORMAP = (1L << 23), + ECORE_X_EVENT_MASK_WINDOW_GRAB = (1L << 24), + ECORE_X_EVENT_MASK_MOUSE_WHEEL = (1L << 29), + ECORE_X_EVENT_MASK_WINDOW_FOCUS_IN = (1L << 30), + ECORE_X_EVENT_MASK_WINDOW_FOCUS_OUT = (1L << 31) +} Ecore_X_Event_Mask; + +typedef enum _Ecore_X_Gravity +{ + ECORE_X_GRAVITY_FORGET = 0, + ECORE_X_GRAVITY_UNMAP = 0, + ECORE_X_GRAVITY_NW = 1, + ECORE_X_GRAVITY_N = 2, + ECORE_X_GRAVITY_NE = 3, + ECORE_X_GRAVITY_W = 4, + ECORE_X_GRAVITY_CENTER = 5, + ECORE_X_GRAVITY_E = 6, + ECORE_X_GRAVITY_SW = 7, + ECORE_X_GRAVITY_S = 8, + ECORE_X_GRAVITY_SE = 9, + ECORE_X_GRAVITY_STATIC = 10 +} Ecore_X_Gravity; + +/* Needed for ecore_x_region_window_shape_set */ +typedef enum _Ecore_X_Shape_Type +{ + ECORE_X_SHAPE_BOUNDING, + ECORE_X_SHAPE_CLIP, + ECORE_X_SHAPE_INPUT +} Ecore_X_Shape_Type; + +typedef enum _Ecore_X_Mapping_Type +{ + ECORE_X_MAPPING_MODIFIER, + ECORE_X_MAPPING_KEYBOARD, + ECORE_X_MAPPING_MOUSE +} Ecore_X_Mapping_Type; + +typedef enum _Ecore_X_Randr_Property_Change +{ + ECORE_X_RANDR_PROPERTY_CHANGE_ADD, + ECORE_X_RANDR_PROPERTY_CHANGE_DEL +} Ecore_X_Randr_Property_Change; + +typedef struct _Ecore_X_Event_Mouse_In Ecore_X_Event_Mouse_In; +typedef struct _Ecore_X_Event_Mouse_Out Ecore_X_Event_Mouse_Out; +typedef struct _Ecore_X_Event_Window_Focus_In Ecore_X_Event_Window_Focus_In; +typedef struct _Ecore_X_Event_Window_Focus_Out Ecore_X_Event_Window_Focus_Out; +typedef struct _Ecore_X_Event_Window_Keymap Ecore_X_Event_Window_Keymap; +typedef struct _Ecore_X_Event_Window_Damage Ecore_X_Event_Window_Damage; +typedef struct _Ecore_X_Event_Window_Visibility_Change Ecore_X_Event_Window_Visibility_Change; +typedef struct _Ecore_X_Event_Window_Create Ecore_X_Event_Window_Create; +typedef struct _Ecore_X_Event_Window_Destroy Ecore_X_Event_Window_Destroy; +typedef struct _Ecore_X_Event_Window_Hide Ecore_X_Event_Window_Hide; +typedef struct _Ecore_X_Event_Window_Show Ecore_X_Event_Window_Show; +typedef struct _Ecore_X_Event_Window_Show_Request Ecore_X_Event_Window_Show_Request; +typedef struct _Ecore_X_Event_Window_Reparent Ecore_X_Event_Window_Reparent; +typedef struct _Ecore_X_Event_Window_Configure Ecore_X_Event_Window_Configure; +typedef struct _Ecore_X_Event_Window_Configure_Request Ecore_X_Event_Window_Configure_Request; +typedef struct _Ecore_X_Event_Window_Gravity Ecore_X_Event_Window_Gravity; +typedef struct _Ecore_X_Event_Window_Resize_Request Ecore_X_Event_Window_Resize_Request; +typedef struct _Ecore_X_Event_Window_Stack Ecore_X_Event_Window_Stack; +typedef struct _Ecore_X_Event_Window_Stack_Request Ecore_X_Event_Window_Stack_Request; +typedef struct _Ecore_X_Event_Window_Property Ecore_X_Event_Window_Property; +typedef struct _Ecore_X_Event_Window_Colormap Ecore_X_Event_Window_Colormap; +typedef struct _Ecore_X_Event_Mapping_Change Ecore_X_Event_Mapping_Change; +typedef struct _Ecore_X_Event_Window_Mapping Ecore_X_Event_Window_Mapping; +typedef struct _Ecore_X_Event_Selection_Clear Ecore_X_Event_Selection_Clear; +typedef struct _Ecore_X_Event_Selection_Request Ecore_X_Event_Selection_Request; +typedef struct _Ecore_X_Event_Selection_Notify Ecore_X_Event_Selection_Notify; +typedef struct _Ecore_X_Event_Fixes_Selection_Notify Ecore_X_Event_Fixes_Selection_Notify; +typedef struct _Ecore_X_Selection_Data Ecore_X_Selection_Data; +typedef struct _Ecore_X_Selection_Data_Files Ecore_X_Selection_Data_Files; +typedef struct _Ecore_X_Selection_Data_Text Ecore_X_Selection_Data_Text; +typedef struct _Ecore_X_Selection_Data_Targets Ecore_X_Selection_Data_Targets; +typedef struct _Ecore_X_Event_Xdnd_Enter Ecore_X_Event_Xdnd_Enter; +typedef struct _Ecore_X_Event_Xdnd_Position Ecore_X_Event_Xdnd_Position; +typedef struct _Ecore_X_Event_Xdnd_Status Ecore_X_Event_Xdnd_Status; +typedef struct _Ecore_X_Event_Xdnd_Leave Ecore_X_Event_Xdnd_Leave; +typedef struct _Ecore_X_Event_Xdnd_Drop Ecore_X_Event_Xdnd_Drop; +typedef struct _Ecore_X_Event_Xdnd_Finished Ecore_X_Event_Xdnd_Finished; +typedef struct _Ecore_X_Event_Client_Message Ecore_X_Event_Client_Message; +typedef struct _Ecore_X_Event_Window_Shape Ecore_X_Event_Window_Shape; +typedef struct _Ecore_X_Event_Screensaver_Notify Ecore_X_Event_Screensaver_Notify; +typedef struct _Ecore_X_Event_Gesture_Notify_Flick Ecore_X_Event_Gesture_Notify_Flick; +typedef struct _Ecore_X_Event_Gesture_Notify_Pan Ecore_X_Event_Gesture_Notify_Pan; +typedef struct _Ecore_X_Event_Gesture_Notify_PinchRotation Ecore_X_Event_Gesture_Notify_PinchRotation; +typedef struct _Ecore_X_Event_Gesture_Notify_Tap Ecore_X_Event_Gesture_Notify_Tap; +typedef struct _Ecore_X_Event_Gesture_Notify_TapNHold Ecore_X_Event_Gesture_Notify_TapNHold; +typedef struct _Ecore_X_Event_Gesture_Notify_Hold Ecore_X_Event_Gesture_Notify_Hold; +typedef struct _Ecore_X_Event_Gesture_Notify_Group Ecore_X_Event_Gesture_Notify_Group; +typedef struct _Ecore_X_Event_Sync_Counter Ecore_X_Event_Sync_Counter; +typedef struct _Ecore_X_Event_Sync_Alarm Ecore_X_Event_Sync_Alarm; +typedef struct _Ecore_X_Event_Screen_Change Ecore_X_Event_Screen_Change; +typedef struct _Ecore_X_Event_Randr_Crtc_Change Ecore_X_Event_Randr_Crtc_Change; +typedef struct _Ecore_X_Event_Randr_Output_Change Ecore_X_Event_Randr_Output_Change; +typedef struct _Ecore_X_Event_Randr_Output_Property_Notify Ecore_X_Event_Randr_Output_Property_Notify; + +typedef struct _Ecore_X_Event_Window_Delete_Request Ecore_X_Event_Window_Delete_Request; +typedef struct _Ecore_X_Event_Window_Move_Resize_Request Ecore_X_Event_Window_Move_Resize_Request; +typedef struct _Ecore_X_Event_Window_State_Request Ecore_X_Event_Window_State_Request; +typedef struct _Ecore_X_Event_Frame_Extents_Request Ecore_X_Event_Frame_Extents_Request; +typedef struct _Ecore_X_Event_Ping Ecore_X_Event_Ping; +typedef struct _Ecore_X_Event_Desktop_Change Ecore_X_Event_Desktop_Change; + +typedef struct _Ecore_X_Event_Startup_Sequence Ecore_X_Event_Startup_Sequence; + +typedef struct _Ecore_X_Event_Generic Ecore_X_Event_Generic; + +typedef struct _Ecore_X_Randr_Screen_Size Ecore_X_Randr_Screen_Size; +typedef struct _Ecore_X_Randr_Screen_Size_MM Ecore_X_Randr_Screen_Size_MM; + +typedef struct _Ecore_X_Xdnd_Position Ecore_X_Xdnd_Position; + +struct _Ecore_X_Event_Mouse_In +{ + int modifiers; + int x, y; + Eina_Bool same_screen : 1; + struct + { + int x, y; + } root; + Ecore_X_Window win; + Ecore_X_Window event_win; + Ecore_X_Window root_win; + Ecore_X_Event_Mode mode; + Ecore_X_Event_Detail detail; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Mouse_Out +{ + int modifiers; + int x, y; + int same_screen; + struct + { + int x, y; + } root; + Ecore_X_Window win; + Ecore_X_Window event_win; + Ecore_X_Window root_win; + Ecore_X_Event_Mode mode; + Ecore_X_Event_Detail detail; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Focus_In +{ + Ecore_X_Window win; + Ecore_X_Event_Mode mode; + Ecore_X_Event_Detail detail; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Focus_Out +{ + Ecore_X_Window win; + Ecore_X_Event_Mode mode; + Ecore_X_Event_Detail detail; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Keymap +{ + Ecore_X_Window win; +}; + +struct _Ecore_X_Event_Window_Damage +{ + Ecore_X_Window win; + int x, y, w, h; + int count; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Visibility_Change +{ + Ecore_X_Window win; + int fully_obscured; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Create +{ + Ecore_X_Window win; + Ecore_X_Window parent; + int override; + int x, y, w, h; + int border; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Destroy +{ + Ecore_X_Window win; + Ecore_X_Window event_win; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Hide +{ + Ecore_X_Window win; + Ecore_X_Window event_win; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Show +{ + Ecore_X_Window win; + Ecore_X_Window event_win; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Show_Request +{ + Ecore_X_Window win; + Ecore_X_Window parent; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Reparent +{ + Ecore_X_Window win; + Ecore_X_Window event_win; + Ecore_X_Window parent; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Configure +{ + Ecore_X_Window win; + Ecore_X_Window event_win; + Ecore_X_Window abovewin; + int x, y, w, h; + int border; + Eina_Bool override : 1; + Eina_Bool from_wm : 1; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Configure_Request +{ + Ecore_X_Window win; + Ecore_X_Window parent_win; + Ecore_X_Window abovewin; + int x, y, w, h; + int border; + Ecore_X_Window_Stack_Mode detail; + unsigned long value_mask; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Gravity +{ + Ecore_X_Window win; + Ecore_X_Window event_win; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Resize_Request +{ + Ecore_X_Window win; + int w, h; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Stack +{ + Ecore_X_Window win; + Ecore_X_Window event_win; + Ecore_X_Window_Stack_Mode detail; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Stack_Request +{ + Ecore_X_Window win; + Ecore_X_Window parent; + Ecore_X_Window_Stack_Mode detail; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Property +{ + Ecore_X_Window win; + Ecore_X_Atom atom; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Colormap +{ + Ecore_X_Window win; + Ecore_X_Colormap cmap; + Eina_Bool installed : 1; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Mapping_Change +{ + Ecore_X_Mapping_Type type; + int keycode; + int num; +}; + +struct _Ecore_X_Event_Selection_Clear +{ + Ecore_X_Window win; + Ecore_X_Selection selection; + Ecore_X_Atom atom; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Selection_Request +{ + Ecore_X_Window owner; + Ecore_X_Window requestor; + Ecore_X_Time time; + Ecore_X_Atom selection; + Ecore_X_Atom target; + Ecore_X_Atom property; +}; + +typedef enum +{ + ECORE_X_OWNER_CHANGE_REASON_NEW_OWNER, + ECORE_X_OWNER_CHANGE_REASON_DESTROY, + ECORE_X_OWNER_CHANGE_REASON_CLOSE +} Ecore_X_Owner_Change_Reason; + +struct _Ecore_X_Event_Fixes_Selection_Notify +{ + Ecore_X_Window win; + Ecore_X_Window owner; + Ecore_X_Time time; + Ecore_X_Time selection_time; + Ecore_X_Selection selection; + Ecore_X_Atom atom; + Ecore_X_Owner_Change_Reason reason; +}; + +struct _Ecore_X_Event_Selection_Notify +{ + Ecore_X_Window win; + Ecore_X_Time time; + Ecore_X_Selection selection; + Ecore_X_Atom atom; + char *target; + void *data; +}; + +struct _Ecore_X_Selection_Data +{ + enum + { + ECORE_X_SELECTION_CONTENT_NONE, + ECORE_X_SELECTION_CONTENT_TEXT, + ECORE_X_SELECTION_CONTENT_FILES, + ECORE_X_SELECTION_CONTENT_TARGETS, + ECORE_X_SELECTION_CONTENT_CUSTOM + } content; + unsigned char *data; + int length; + int format; + int (*free)(void *data); +}; + +struct _Ecore_X_Selection_Data_Files +{ + Ecore_X_Selection_Data data; + char **files; + int num_files; +}; + +struct _Ecore_X_Selection_Data_Text +{ + Ecore_X_Selection_Data data; + char *text; +}; + +struct _Ecore_X_Selection_Data_Targets +{ + Ecore_X_Selection_Data data; + char **targets; + int num_targets; +}; + +struct _Ecore_X_Event_Xdnd_Enter +{ + Ecore_X_Window win, source; + + char **types; + int num_types; +}; + +struct _Ecore_X_Event_Xdnd_Position +{ + Ecore_X_Window win, source; + struct + { + int x, y; + } position; + Ecore_X_Atom action; +}; + +struct _Ecore_X_Xdnd_Position +{ + Ecore_X_Window win, prev; + struct + { + int x, y; + } position; +}; + +struct _Ecore_X_Event_Xdnd_Status +{ + Ecore_X_Window win, target; + Eina_Bool will_accept : 1; + Ecore_X_Rectangle rectangle; + Ecore_X_Atom action; +}; + +struct _Ecore_X_Event_Xdnd_Leave +{ + Ecore_X_Window win, source; +}; + +struct _Ecore_X_Event_Xdnd_Drop +{ + Ecore_X_Window win, source; + Ecore_X_Atom action; + struct + { + int x, y; + } position; +}; + +struct _Ecore_X_Event_Xdnd_Finished +{ + Ecore_X_Window win, target; + Eina_Bool completed : 1; + Ecore_X_Atom action; +}; + +struct _Ecore_X_Event_Client_Message +{ + Ecore_X_Window win; + Ecore_X_Atom message_type; + int format; + union + { + char b[20]; + short s[10]; + long l[5]; + } data; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Window_Shape +{ + Ecore_X_Window win; + Ecore_X_Time time; + Ecore_X_Shape_Type type; + int x, y, w, h; + Eina_Bool shaped : 1; +}; + +struct _Ecore_X_Event_Screensaver_Notify +{ + Ecore_X_Window win; + Eina_Bool on : 1; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Sync_Counter +{ + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Sync_Alarm +{ + Ecore_X_Time time; + Ecore_X_Sync_Alarm alarm; +}; + +struct _Ecore_X_Randr_Screen_Size +{ + int width, height; +}; + +struct _Ecore_X_Randr_Screen_Size_MM +{ + int width, height, width_mm, height_mm; +}; + +struct _Ecore_X_Event_Screen_Change +{ + Ecore_X_Window win; + Ecore_X_Window root; + Ecore_X_Randr_Screen_Size_MM size; /* in pixel and millimeters */ + Ecore_X_Time time; + Ecore_X_Time config_time; + Ecore_X_Randr_Orientation orientation; + Ecore_X_Render_Subpixel_Order subpixel_order; + Ecore_X_Randr_Size_ID size_id; +}; + +struct _Ecore_X_Event_Randr_Crtc_Change +{ + Ecore_X_Window win; + Ecore_X_Randr_Crtc crtc; + Ecore_X_Randr_Mode mode; + Ecore_X_Randr_Orientation orientation; + Eina_Rectangle geo; +}; + +struct _Ecore_X_Event_Randr_Output_Change +{ + Ecore_X_Window win; + Ecore_X_Randr_Output output; + Ecore_X_Randr_Crtc crtc; + Ecore_X_Randr_Mode mode; + Ecore_X_Randr_Orientation orientation; + Ecore_X_Randr_Connection_Status connection; + Ecore_X_Render_Subpixel_Order subpixel_order; +}; + +struct _Ecore_X_Event_Randr_Output_Property_Notify +{ + Ecore_X_Window win; + Ecore_X_Randr_Output output; + Ecore_X_Atom property; + Ecore_X_Time time; + Ecore_X_Randr_Property_Change state; +}; + +struct _Ecore_X_Event_Window_Delete_Request +{ + Ecore_X_Window win; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Startup_Sequence +{ + Ecore_X_Window win; +}; + +struct _Ecore_X_Event_Window_Move_Resize_Request +{ + Ecore_X_Window win; + int x, y; + int direction; + int button; + int source; +}; + +struct _Ecore_X_Event_Window_State_Request +{ + Ecore_X_Window win; + Ecore_X_Window_State_Action action; + Ecore_X_Window_State state[2]; + int source; +}; + +struct _Ecore_X_Event_Frame_Extents_Request +{ + Ecore_X_Window win; +}; + +struct _Ecore_X_Event_Ping +{ + Ecore_X_Window win; + Ecore_X_Window event_win; + Ecore_X_Time time; +}; + +struct _Ecore_X_Event_Desktop_Change +{ + Ecore_X_Window win; + unsigned int desk; + int source; +}; + +struct _Ecore_X_Event_Generic +{ + int extension; + int evtype; + unsigned int cookie; + void *data; +}; + +EAPI extern int ECORE_X_EVENT_ANY; /**< low level event dependent on + backend in use, if Xlib will be XEvent, + if XCB will be xcb_generic_event_t. + @warning avoid using it. + */ +EAPI extern int ECORE_X_EVENT_MOUSE_IN; +EAPI extern int ECORE_X_EVENT_MOUSE_OUT; +EAPI extern int ECORE_X_EVENT_WINDOW_FOCUS_IN; +EAPI extern int ECORE_X_EVENT_WINDOW_FOCUS_OUT; +EAPI extern int ECORE_X_EVENT_WINDOW_KEYMAP; +EAPI extern int ECORE_X_EVENT_WINDOW_DAMAGE; +EAPI extern int ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE; +EAPI extern int ECORE_X_EVENT_WINDOW_CREATE; +EAPI extern int ECORE_X_EVENT_WINDOW_DESTROY; +EAPI extern int ECORE_X_EVENT_WINDOW_HIDE; +EAPI extern int ECORE_X_EVENT_WINDOW_SHOW; +EAPI extern int ECORE_X_EVENT_WINDOW_SHOW_REQUEST; +EAPI extern int ECORE_X_EVENT_WINDOW_REPARENT; +EAPI extern int ECORE_X_EVENT_WINDOW_CONFIGURE; +EAPI extern int ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST; +EAPI extern int ECORE_X_EVENT_WINDOW_GRAVITY; +EAPI extern int ECORE_X_EVENT_WINDOW_RESIZE_REQUEST; +EAPI extern int ECORE_X_EVENT_WINDOW_STACK; +EAPI extern int ECORE_X_EVENT_WINDOW_STACK_REQUEST; +EAPI extern int ECORE_X_EVENT_WINDOW_PROPERTY; +EAPI extern int ECORE_X_EVENT_WINDOW_COLORMAP; +EAPI extern int ECORE_X_EVENT_WINDOW_MAPPING; +EAPI extern int ECORE_X_EVENT_MAPPING_CHANGE; +EAPI extern int ECORE_X_EVENT_SELECTION_CLEAR; +EAPI extern int ECORE_X_EVENT_SELECTION_REQUEST; +EAPI extern int ECORE_X_EVENT_SELECTION_NOTIFY; +EAPI extern int ECORE_X_EVENT_FIXES_SELECTION_NOTIFY; +EAPI extern int ECORE_X_EVENT_CLIENT_MESSAGE; +EAPI extern int ECORE_X_EVENT_WINDOW_SHAPE; +EAPI extern int ECORE_X_EVENT_SCREENSAVER_NOTIFY; +EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_FLICK; +EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_PAN; +EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION; +EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_TAP; +EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD; +EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_HOLD; +EAPI extern int ECORE_X_EVENT_GESTURE_NOTIFY_GROUP; +EAPI extern int ECORE_X_EVENT_SYNC_COUNTER; +EAPI extern int ECORE_X_EVENT_SYNC_ALARM; +EAPI extern int ECORE_X_EVENT_SCREEN_CHANGE; +EAPI extern int ECORE_X_EVENT_RANDR_CRTC_CHANGE; +EAPI extern int ECORE_X_EVENT_RANDR_OUTPUT_CHANGE; +EAPI extern int ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY; +EAPI extern int ECORE_X_EVENT_DAMAGE_NOTIFY; + +EAPI extern int ECORE_X_EVENT_WINDOW_DELETE_REQUEST; + +EAPI extern int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST; +EAPI extern int ECORE_X_EVENT_WINDOW_STATE_REQUEST; +EAPI extern int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST; +EAPI extern int ECORE_X_EVENT_PING; +EAPI extern int ECORE_X_EVENT_DESKTOP_CHANGE; + +EAPI extern int ECORE_X_EVENT_STARTUP_SEQUENCE_NEW; +EAPI extern int ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE; +EAPI extern int ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE; + +EAPI extern int ECORE_X_EVENT_GENERIC; + +EAPI extern int ECORE_X_EVENT_XDND_ENTER; +EAPI extern int ECORE_X_EVENT_XDND_POSITION; +EAPI extern int ECORE_X_EVENT_XDND_STATUS; +EAPI extern int ECORE_X_EVENT_XDND_LEAVE; +EAPI extern int ECORE_X_EVENT_XDND_DROP; +EAPI extern int ECORE_X_EVENT_XDND_FINISHED; + +EAPI extern int ECORE_X_LOCK_SCROLL; +EAPI extern int ECORE_X_LOCK_NUM; +EAPI extern int ECORE_X_LOCK_CAPS; +EAPI extern int ECORE_X_LOCK_SHIFT; + +typedef enum _Ecore_X_WM_Protocol +{ + /* If enabled the window manager will be asked to send a + * delete message instead of just closing (destroying) the window. */ + ECORE_X_WM_PROTOCOL_DELETE_REQUEST, + + /* If enabled the window manager will be told that the window + * explicitly sets input focus. */ + ECORE_X_WM_PROTOCOL_TAKE_FOCUS, + + /* If enabled the window manager can ping the window to check + * if it is alive. */ + ECORE_X_NET_WM_PROTOCOL_PING, + + /* If enabled the window manager can sync updating with the + * window (?) */ + ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST, + + /* Number of defined items */ + ECORE_X_WM_PROTOCOL_NUM +} Ecore_X_WM_Protocol; + +typedef enum _Ecore_X_Window_Input_Mode +{ + /* The window can never be focused */ + ECORE_X_WINDOW_INPUT_MODE_NONE, + + /* The window can be focused by the WM but doesn't focus itself */ + ECORE_X_WINDOW_INPUT_MODE_PASSIVE, + + /* The window sets the focus itself if one of its sub-windows + * already is focused */ + ECORE_X_WINDOW_INPUT_MODE_ACTIVE_LOCAL, + + /* The window sets the focus itself even if another window + * is currently focused */ + ECORE_X_WINDOW_INPUT_MODE_ACTIVE_GLOBAL +} Ecore_X_Window_Input_Mode; + +typedef enum _Ecore_X_Window_State_Hint +{ + /** Do not provide any state hint to the window manager */ + ECORE_X_WINDOW_STATE_HINT_NONE = -1, + + /** The window wants to remain hidden and NOT iconified */ + ECORE_X_WINDOW_STATE_HINT_WITHDRAWN, + + /** The window wants to be mapped normally */ + ECORE_X_WINDOW_STATE_HINT_NORMAL, + + /** The window wants to start in an iconified state */ + ECORE_X_WINDOW_STATE_HINT_ICONIC +} Ecore_X_Window_State_Hint; + +typedef enum _Ecore_X_Window_Type +{ + ECORE_X_WINDOW_TYPE_UNKNOWN = 0, + ECORE_X_WINDOW_TYPE_DESKTOP, + ECORE_X_WINDOW_TYPE_DOCK, + ECORE_X_WINDOW_TYPE_TOOLBAR, + ECORE_X_WINDOW_TYPE_MENU, + ECORE_X_WINDOW_TYPE_UTILITY, + ECORE_X_WINDOW_TYPE_SPLASH, + ECORE_X_WINDOW_TYPE_DIALOG, + ECORE_X_WINDOW_TYPE_NORMAL, + ECORE_X_WINDOW_TYPE_DROPDOWN_MENU, + ECORE_X_WINDOW_TYPE_POPUP_MENU, + ECORE_X_WINDOW_TYPE_TOOLTIP, + ECORE_X_WINDOW_TYPE_NOTIFICATION, + ECORE_X_WINDOW_TYPE_COMBO, + ECORE_X_WINDOW_TYPE_DND +} Ecore_X_Window_Type; + +typedef enum _Ecore_X_Action +{ + ECORE_X_ACTION_MOVE, + ECORE_X_ACTION_RESIZE, + ECORE_X_ACTION_MINIMIZE, + ECORE_X_ACTION_SHADE, + ECORE_X_ACTION_STICK, + ECORE_X_ACTION_MAXIMIZE_HORZ, + ECORE_X_ACTION_MAXIMIZE_VERT, + ECORE_X_ACTION_FULLSCREEN, + ECORE_X_ACTION_CHANGE_DESKTOP, + ECORE_X_ACTION_CLOSE, + ECORE_X_ACTION_ABOVE, + ECORE_X_ACTION_BELOW +} Ecore_X_Action; + +typedef enum _Ecore_X_Window_Configure_Mask +{ + ECORE_X_WINDOW_CONFIGURE_MASK_X = (1 << 0), + ECORE_X_WINDOW_CONFIGURE_MASK_Y = (1 << 1), + ECORE_X_WINDOW_CONFIGURE_MASK_W = (1 << 2), + ECORE_X_WINDOW_CONFIGURE_MASK_H = (1 << 3), + ECORE_X_WINDOW_CONFIGURE_MASK_BORDER_WIDTH = (1 << 4), + ECORE_X_WINDOW_CONFIGURE_MASK_SIBLING = (1 << 5), + ECORE_X_WINDOW_CONFIGURE_MASK_STACK_MODE = (1 << 6) +} Ecore_X_Window_Configure_Mask; + +typedef enum _Ecore_X_Virtual_Keyboard_State +{ + ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN = 0, + ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF, + ECORE_X_VIRTUAL_KEYBOARD_STATE_ON, + ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA, + ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC, + ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN, + ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER, + ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX, + ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL, + ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD, + ECORE_X_VIRTUAL_KEYBOARD_STATE_IP, + ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST, + ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE, + ECORE_X_VIRTUAL_KEYBOARD_STATE_URL, + ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD, + ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME +} Ecore_X_Virtual_Keyboard_State; + +typedef enum _Ecore_X_Illume_Mode +{ + ECORE_X_ILLUME_MODE_UNKNOWN = 0, + ECORE_X_ILLUME_MODE_SINGLE, + ECORE_X_ILLUME_MODE_DUAL_TOP, + ECORE_X_ILLUME_MODE_DUAL_LEFT +} Ecore_X_Illume_Mode; + +typedef enum _Ecore_X_Illume_Quickpanel_State +{ + ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN = 0, + ECORE_X_ILLUME_QUICKPANEL_STATE_OFF, + ECORE_X_ILLUME_QUICKPANEL_STATE_ON +} Ecore_X_Illume_Quickpanel_State; + +/* Window layer constants */ +#define ECORE_X_WINDOW_LAYER_BELOW 2 +#define ECORE_X_WINDOW_LAYER_NORMAL 4 +#define ECORE_X_WINDOW_LAYER_ABOVE 6 + +/* Property list operations */ +#define ECORE_X_PROP_LIST_REMOVE 0 +#define ECORE_X_PROP_LIST_ADD 1 +#define ECORE_X_PROP_LIST_TOGGLE 2 + +EAPI int + ecore_x_init(const char *name); +EAPI int + ecore_x_shutdown(void); +EAPI int + ecore_x_disconnect(void); +EAPI Ecore_X_Display * + ecore_x_display_get(void); +EAPI Ecore_X_Connection * + ecore_x_connection_get(void); +EAPI int + ecore_x_fd_get(void); +EAPI Ecore_X_Screen * + ecore_x_default_screen_get(void); +EAPI void + ecore_x_screen_size_get(const Ecore_X_Screen *screen, + int *w, + int *h); +EAPI int + ecore_x_screen_count_get(void); +EAPI int + ecore_x_screen_index_get(const Ecore_X_Screen *screen); +EAPI Ecore_X_Screen * + ecore_x_screen_get(int index); + +EAPI void + ecore_x_double_click_time_set(double t); +EAPI double + ecore_x_double_click_time_get(void); +EAPI void + ecore_x_flush(void); +EAPI void + ecore_x_sync(void); +EAPI void + ecore_x_killall(Ecore_X_Window root); +EAPI void + ecore_x_kill(Ecore_X_Window win); +EAPI int + ecore_x_dpi_get(void); +EAPI Eina_Bool + ecore_x_bell(int percent); +EAPI unsigned int + ecore_x_visual_id_get(Ecore_X_Visual visual); + +EAPI Ecore_X_Visual +ecore_x_default_visual_get(Ecore_X_Display *disp, + Ecore_X_Screen *screen); +EAPI Ecore_X_Colormap +ecore_x_default_colormap_get(Ecore_X_Display *disp, + Ecore_X_Screen *screen); +EAPI int +ecore_x_default_depth_get(Ecore_X_Display *disp, + Ecore_X_Screen *screen); + +EAPI Ecore_X_Time +ecore_x_current_time_get(void); + +EAPI void +ecore_x_error_handler_set(void (*func)(void *data), + const void *data); +EAPI void +ecore_x_io_error_handler_set(void (*func)(void *data), + const void *data); +EAPI int + ecore_x_error_request_get(void); +EAPI int + ecore_x_error_code_get(void); + +EAPI void +ecore_x_event_mask_set(Ecore_X_Window w, + Ecore_X_Event_Mask mask); +EAPI void +ecore_x_event_mask_unset(Ecore_X_Window w, + Ecore_X_Event_Mask mask); + +EAPI Eina_Bool +ecore_x_selection_notify_send(Ecore_X_Window requestor, + Ecore_X_Atom selection, + Ecore_X_Atom target, + Ecore_X_Atom property, + Ecore_X_Time time); +EAPI Eina_Bool +ecore_x_selection_primary_set(Ecore_X_Window w, + const void *data, + int size); +EAPI Eina_Bool + ecore_x_selection_primary_clear(void); +EAPI Eina_Bool + ecore_x_selection_secondary_set(Ecore_X_Window w, + const void *data, + int size); +EAPI Eina_Bool + ecore_x_selection_secondary_clear(void); +EAPI Eina_Bool + ecore_x_selection_xdnd_set(Ecore_X_Window w, + const void *data, + int size); +EAPI Eina_Bool + ecore_x_selection_xdnd_clear(void); +EAPI Eina_Bool + ecore_x_selection_clipboard_set(Ecore_X_Window w, + const void *data, + int size); +EAPI Eina_Bool + ecore_x_selection_clipboard_clear(void); +EAPI void + ecore_x_selection_primary_request(Ecore_X_Window w, + const char *target); +EAPI void +ecore_x_selection_secondary_request(Ecore_X_Window w, + const char *target); +EAPI void +ecore_x_selection_xdnd_request(Ecore_X_Window w, + const char *target); +EAPI void +ecore_x_selection_clipboard_request(Ecore_X_Window w, + const char *target); +EAPI Eina_Bool +ecore_x_selection_convert(Ecore_X_Atom selection, + Ecore_X_Atom target, + void **data_ret, + int *len, + Ecore_X_Atom *targprop, + int *targsize); +EAPI void +ecore_x_selection_converter_add(char *target, + Eina_Bool (*func)(char *target, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *, + int *)); +EAPI void +ecore_x_selection_converter_atom_add(Ecore_X_Atom target, + Eina_Bool (*func)(char *target, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *tprop, + int *tsize)); +EAPI void + ecore_x_selection_converter_del(char *target); +EAPI void + ecore_x_selection_converter_atom_del(Ecore_X_Atom target); +EAPI void + ecore_x_selection_parser_add(const char *target, + void *(*func)(const char *target, void *data, int size, int format)); +EAPI void + ecore_x_selection_parser_del(const char *target); +EAPI void + ecore_x_selection_owner_set(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Time tm); +EAPI Ecore_X_Window +ecore_x_selection_owner_get(Ecore_X_Atom atom); + +EAPI void +ecore_x_dnd_aware_set(Ecore_X_Window win, + Eina_Bool on); +EAPI int + ecore_x_dnd_version_get(Ecore_X_Window win); +EAPI Eina_Bool + ecore_x_dnd_type_isset(Ecore_X_Window win, + const char *type); +EAPI void +ecore_x_dnd_type_set(Ecore_X_Window win, + const char *type, + Eina_Bool on); +EAPI void +ecore_x_dnd_types_set(Ecore_X_Window win, + const char **types, + unsigned int num_types); +EAPI void +ecore_x_dnd_actions_set(Ecore_X_Window win, + Ecore_X_Atom *actions, + unsigned int num_actions); +EAPI Eina_Bool +ecore_x_dnd_begin(Ecore_X_Window source, + unsigned char *data, + int size); +EAPI Eina_Bool + ecore_x_dnd_drop(void); +EAPI void + ecore_x_dnd_send_status(Eina_Bool will_accept, + Eina_Bool suppress, + Ecore_X_Rectangle rectangle, + Ecore_X_Atom action); +EAPI void + ecore_x_dnd_send_finished(void); +EAPI void + ecore_x_dnd_source_action_set(Ecore_X_Atom action); +EAPI Ecore_X_Atom + ecore_x_dnd_source_action_get(void); +EAPI void + ecore_x_dnd_callback_pos_update_set(void (*cb)(void *, + Ecore_X_Xdnd_Position *data), + const void *data); + +EAPI Ecore_X_Window +ecore_x_window_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h); +EAPI Ecore_X_Window +ecore_x_window_override_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h); +EAPI int + ecore_x_window_argb_get(Ecore_X_Window win); +EAPI Ecore_X_Window + ecore_x_window_manager_argb_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h); +EAPI Ecore_X_Window +ecore_x_window_argb_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h); +EAPI Ecore_X_Window +ecore_x_window_override_argb_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h); +EAPI Ecore_X_Window +ecore_x_window_input_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h); +EAPI void +ecore_x_window_configure(Ecore_X_Window win, + Ecore_X_Window_Configure_Mask mask, + int x, + int y, + int w, + int h, + int border_width, + Ecore_X_Window sibling, + int stack_mode); +EAPI void +ecore_x_window_cursor_set(Ecore_X_Window win, + Ecore_X_Cursor c); +EAPI void + ecore_x_window_free(Ecore_X_Window win); +EAPI void + ecore_x_window_ignore_set(Ecore_X_Window win, + int ignore); +EAPI Ecore_X_Window * +ecore_x_window_ignore_list(int *num); + +EAPI void + ecore_x_window_delete_request_send(Ecore_X_Window win); +EAPI void + ecore_x_window_show(Ecore_X_Window win); +EAPI void + ecore_x_window_hide(Ecore_X_Window win); +EAPI void + ecore_x_window_move(Ecore_X_Window win, + int x, + int y); +EAPI void +ecore_x_window_resize(Ecore_X_Window win, + int w, + int h); +EAPI void +ecore_x_window_move_resize(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI void + ecore_x_window_focus(Ecore_X_Window win); +EAPI void + ecore_x_window_focus_at_time(Ecore_X_Window win, + Ecore_X_Time t); +EAPI Ecore_X_Window + ecore_x_window_focus_get(void); +EAPI void + ecore_x_window_raise(Ecore_X_Window win); +EAPI void + ecore_x_window_lower(Ecore_X_Window win); +EAPI void + ecore_x_window_reparent(Ecore_X_Window win, + Ecore_X_Window new_parent, + int x, + int y); +EAPI void +ecore_x_window_size_get(Ecore_X_Window win, + int *w, + int *h); +EAPI void +ecore_x_window_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *w, + int *h); +EAPI int + ecore_x_window_border_width_get(Ecore_X_Window win); +EAPI void + ecore_x_window_border_width_set(Ecore_X_Window win, + int width); +EAPI int + ecore_x_window_depth_get(Ecore_X_Window win); +EAPI void + ecore_x_window_cursor_show(Ecore_X_Window win, + Eina_Bool show); +EAPI void + ecore_x_window_defaults_set(Ecore_X_Window win); +EAPI int + ecore_x_window_visible_get(Ecore_X_Window win); +EAPI Ecore_X_Window + ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, + int x, + int y, + Ecore_X_Window *skip, + int skip_num); +EAPI Ecore_X_Window +ecore_x_window_shadow_parent_get(Ecore_X_Window root, + Ecore_X_Window win); +EAPI void + ecore_x_window_shadow_tree_flush(void); +EAPI Ecore_X_Window + ecore_x_window_root_get(Ecore_X_Window win); +EAPI Ecore_X_Window + ecore_x_window_at_xy_get(int x, + int y); +EAPI Ecore_X_Window +ecore_x_window_at_xy_with_skip_get(int x, + int y, + Ecore_X_Window *skip, + int skip_num); +EAPI Ecore_X_Window +ecore_x_window_at_xy_begin_get(Ecore_X_Window begin, + int x, + int y); +EAPI Ecore_X_Window +ecore_x_window_parent_get(Ecore_X_Window win); + +EAPI void +ecore_x_window_background_color_set(Ecore_X_Window win, + unsigned short r, + unsigned short g, + unsigned short b); +EAPI void +ecore_x_window_gravity_set(Ecore_X_Window win, + Ecore_X_Gravity grav); +EAPI void +ecore_x_window_pixel_gravity_set(Ecore_X_Window win, + Ecore_X_Gravity grav); +EAPI void +ecore_x_window_pixmap_set(Ecore_X_Window win, + Ecore_X_Pixmap pmap); +EAPI void +ecore_x_window_area_clear(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI void +ecore_x_window_area_expose(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI void +ecore_x_window_override_set(Ecore_X_Window win, + Eina_Bool override); + +EAPI void +ecore_x_window_prop_card32_set(Ecore_X_Window win, + Ecore_X_Atom atom, + unsigned int *val, + unsigned int num); +EAPI int +ecore_x_window_prop_card32_get(Ecore_X_Window win, + Ecore_X_Atom atom, + unsigned int *val, + unsigned int len); +EAPI int +ecore_x_window_prop_card32_list_get(Ecore_X_Window win, + Ecore_X_Atom atom, + unsigned int **plst); + +EAPI void +ecore_x_window_prop_xid_set(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID *lst, + unsigned int num); +EAPI int +ecore_x_window_prop_xid_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID *lst, + unsigned int len); +EAPI int +ecore_x_window_prop_xid_list_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID **plst); +EAPI void +ecore_x_window_prop_xid_list_change(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID item, + int op); +EAPI void +ecore_x_window_prop_atom_set(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom *val, + unsigned int num); +EAPI int +ecore_x_window_prop_atom_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom *val, + unsigned int len); +EAPI int +ecore_x_window_prop_atom_list_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom **plst); +EAPI void +ecore_x_window_prop_atom_list_change(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom item, + int op); +EAPI void +ecore_x_window_prop_window_set(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Window *val, + unsigned int num); +EAPI int +ecore_x_window_prop_window_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Window *val, + unsigned int len); +EAPI int +ecore_x_window_prop_window_list_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Window **plst); + +EAPI Ecore_X_Atom + ecore_x_window_prop_any_type(void); +EAPI void + ecore_x_window_prop_property_set(Ecore_X_Window win, + Ecore_X_Atom type, + Ecore_X_Atom format, + int size, + void *data, + int number); +EAPI int +ecore_x_window_prop_property_get(Ecore_X_Window win, + Ecore_X_Atom property, + Ecore_X_Atom type, + int size, + unsigned char **data, + int *num); +EAPI void +ecore_x_window_prop_property_del(Ecore_X_Window win, + Ecore_X_Atom property); +EAPI Ecore_X_Atom * +ecore_x_window_prop_list(Ecore_X_Window win, + int *num_ret); +EAPI void +ecore_x_window_prop_string_set(Ecore_X_Window win, + Ecore_X_Atom type, + const char *str); +EAPI char * +ecore_x_window_prop_string_get(Ecore_X_Window win, + Ecore_X_Atom type); +EAPI Eina_Bool +ecore_x_window_prop_protocol_isset(Ecore_X_Window win, + Ecore_X_WM_Protocol protocol); +EAPI Ecore_X_WM_Protocol * +ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, + int *num_ret); + +EAPI void +ecore_x_window_shape_mask_set(Ecore_X_Window win, + Ecore_X_Pixmap mask); +EAPI void +ecore_x_window_shape_window_set(Ecore_X_Window win, + Ecore_X_Window shape_win); +EAPI void +ecore_x_window_shape_window_set_xy(Ecore_X_Window win, + Ecore_X_Window shape_win, + int x, + int y); +EAPI void +ecore_x_window_shape_rectangle_set(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI void +ecore_x_window_shape_rectangles_set(Ecore_X_Window win, + Ecore_X_Rectangle *rects, + int num); +EAPI void +ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI void +ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win, + Ecore_X_Rectangle *rects, + int num); +EAPI void +ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI void +ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI void +ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI void +ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win, + Ecore_X_Window shape_win, + int x, + int y); +EAPI void +ecore_x_window_shape_input_window_set(Ecore_X_Window win, + Ecore_X_Window shape_win); +EAPI void +ecore_x_window_shape_window_add(Ecore_X_Window win, + Ecore_X_Window shape_win); +EAPI void +ecore_x_window_shape_window_add_xy(Ecore_X_Window win, + Ecore_X_Window shape_win, + int x, + int y); +EAPI void +ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win, + Ecore_X_Window shape_win, + int x, + int y); +EAPI void +ecore_x_window_shape_rectangle_add(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI void +ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI void +ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI void +ecore_x_window_shape_rectangles_add(Ecore_X_Window win, + Ecore_X_Rectangle *rects, + int num); +EAPI void +ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, + Ecore_X_Rectangle *rects, + int num); +EAPI Ecore_X_Rectangle * +ecore_x_window_shape_rectangles_get(Ecore_X_Window win, + int *num_ret); +EAPI Ecore_X_Rectangle * +ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, + int *num_ret); +EAPI void +ecore_x_window_shape_events_select(Ecore_X_Window win, + Eina_Bool on); +EAPI void +ecore_x_window_shape_input_mask_set(Ecore_X_Window win, + Ecore_X_Pixmap mask); + +EAPI Ecore_X_Pixmap +ecore_x_pixmap_new(Ecore_X_Window win, + int w, + int h, + int dep); +EAPI void + ecore_x_pixmap_free(Ecore_X_Pixmap pmap); +EAPI void + ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, + Ecore_X_Drawable dest, + Ecore_X_GC gc, + int sx, + int sy, + int w, + int h, + int dx, + int dy); +EAPI void +ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, + int *x, + int *y, + int *w, + int *h); +EAPI int +ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap); + +EAPI Ecore_X_GC +ecore_x_gc_new(Ecore_X_Drawable draw, + Ecore_X_GC_Value_Mask value_mask, + const unsigned int *value_list); +EAPI void + ecore_x_gc_free(Ecore_X_GC gc); +EAPI void + ecore_x_gc_foreground_set(Ecore_X_GC gc, + unsigned long foreground); +EAPI void +ecore_x_gc_background_set(Ecore_X_GC gc, + unsigned long background); + +EAPI Eina_Bool +ecore_x_client_message32_send(Ecore_X_Window win, + Ecore_X_Atom type, + Ecore_X_Event_Mask mask, + long d0, + long d1, + long d2, + long d3, + long d4); +EAPI Eina_Bool +ecore_x_client_message8_send(Ecore_X_Window win, + Ecore_X_Atom type, + const void *data, + int len); +EAPI Eina_Bool +ecore_x_mouse_move_send(Ecore_X_Window win, + int x, + int y); +EAPI Eina_Bool +ecore_x_mouse_down_send(Ecore_X_Window win, + int x, + int y, + int b); +EAPI Eina_Bool +ecore_x_mouse_up_send(Ecore_X_Window win, + int x, + int y, + int b); + +EAPI void +ecore_x_drawable_geometry_get(Ecore_X_Drawable d, + int *x, + int *y, + int *w, + int *h); +EAPI int + ecore_x_drawable_border_width_get(Ecore_X_Drawable d); +EAPI int + ecore_x_drawable_depth_get(Ecore_X_Drawable d); +EAPI void + ecore_x_drawable_rectangle_fill(Ecore_X_Drawable d, + Ecore_X_GC gc, + int x, + int y, + int width, + int height); + +EAPI Eina_Bool + ecore_x_cursor_color_supported_get(void); +EAPI Ecore_X_Cursor + ecore_x_cursor_new(Ecore_X_Window win, + int *pixels, + int w, + int h, + int hot_x, + int hot_y); +EAPI void + ecore_x_cursor_free(Ecore_X_Cursor c); +EAPI Ecore_X_Cursor + ecore_x_cursor_shape_get(int shape); +EAPI void + ecore_x_cursor_size_set(int size); +EAPI int + ecore_x_cursor_size_get(void); + +/* FIXME: these funcs need categorising */ +EAPI Ecore_X_Window * + ecore_x_window_root_list(int *num_ret); +EAPI Ecore_X_Window + ecore_x_window_root_first_get(void); +EAPI Eina_Bool + ecore_x_window_manage(Ecore_X_Window win); +EAPI void + ecore_x_window_container_manage(Ecore_X_Window win); +EAPI void + ecore_x_window_client_manage(Ecore_X_Window win); +EAPI void + ecore_x_window_sniff(Ecore_X_Window win); +EAPI void + ecore_x_window_client_sniff(Ecore_X_Window win); + +EAPI Ecore_X_Atom + ecore_x_atom_get(const char *name); +EAPI void + ecore_x_atoms_get(const char **names, + int num, + Ecore_X_Atom *atoms); +EAPI char * +ecore_x_atom_name_get(Ecore_X_Atom atom); + +EAPI void + ecore_x_icccm_init(void); +EAPI void + ecore_x_icccm_state_set(Ecore_X_Window win, + Ecore_X_Window_State_Hint state); +EAPI Ecore_X_Window_State_Hint + ecore_x_icccm_state_get(Ecore_X_Window win); +EAPI void + ecore_x_icccm_delete_window_send(Ecore_X_Window win, + Ecore_X_Time t); +EAPI void +ecore_x_icccm_take_focus_send(Ecore_X_Window win, + Ecore_X_Time t); +EAPI void +ecore_x_icccm_save_yourself_send(Ecore_X_Window win, + Ecore_X_Time t); +EAPI void +ecore_x_icccm_move_resize_send(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI void +ecore_x_icccm_hints_set(Ecore_X_Window win, + Eina_Bool accepts_focus, + Ecore_X_Window_State_Hint initial_state, + Ecore_X_Pixmap icon_pixmap, + Ecore_X_Pixmap icon_mask, + Ecore_X_Window icon_window, + Ecore_X_Window window_group, + Eina_Bool is_urgent); +EAPI Eina_Bool +ecore_x_icccm_hints_get(Ecore_X_Window win, + Eina_Bool *accepts_focus, + Ecore_X_Window_State_Hint *initial_state, + Ecore_X_Pixmap *icon_pixmap, + Ecore_X_Pixmap *icon_mask, + Ecore_X_Window *icon_window, + Ecore_X_Window *window_group, + Eina_Bool *is_urgent); +EAPI void +ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, + Eina_Bool request_pos, + Ecore_X_Gravity gravity, + int min_w, + int min_h, + int max_w, + int max_h, + int base_w, + int base_h, + int step_x, + int step_y, + double min_aspect, + double max_aspect); +EAPI Eina_Bool +ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, + Eina_Bool *request_pos, + Ecore_X_Gravity *gravity, + int *min_w, + int *min_h, + int *max_w, + int *max_h, + int *base_w, + int *base_h, + int *step_x, + int *step_y, + double *min_aspect, + double *max_aspect); +EAPI void +ecore_x_icccm_title_set(Ecore_X_Window win, + const char *t); +EAPI char * + ecore_x_icccm_title_get(Ecore_X_Window win); +EAPI void + ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win, + Ecore_X_Atom *protos, + int num); +EAPI void +ecore_x_icccm_protocol_set(Ecore_X_Window win, + Ecore_X_WM_Protocol protocol, + Eina_Bool on); +EAPI Eina_Bool +ecore_x_icccm_protocol_isset(Ecore_X_Window win, + Ecore_X_WM_Protocol protocol); +EAPI void +ecore_x_icccm_name_class_set(Ecore_X_Window win, + const char *n, + const char *c); +EAPI void +ecore_x_icccm_name_class_get(Ecore_X_Window win, + char **n, + char **c); +EAPI char * + ecore_x_icccm_client_machine_get(Ecore_X_Window win); +EAPI void + ecore_x_icccm_command_set(Ecore_X_Window win, + int argc, + char **argv); +EAPI void +ecore_x_icccm_command_get(Ecore_X_Window win, + int *argc, + char ***argv); +EAPI char * + ecore_x_icccm_icon_name_get(Ecore_X_Window win); +EAPI void + ecore_x_icccm_icon_name_set(Ecore_X_Window win, + const char *t); +EAPI void +ecore_x_icccm_colormap_window_set(Ecore_X_Window win, + Ecore_X_Window subwin); +EAPI void +ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, + Ecore_X_Window subwin); +EAPI void +ecore_x_icccm_transient_for_set(Ecore_X_Window win, + Ecore_X_Window forwin); +EAPI void + ecore_x_icccm_transient_for_unset(Ecore_X_Window win); +EAPI Ecore_X_Window + ecore_x_icccm_transient_for_get(Ecore_X_Window win); +EAPI void + ecore_x_icccm_window_role_set(Ecore_X_Window win, + const char *role); +EAPI char * + ecore_x_icccm_window_role_get(Ecore_X_Window win); +EAPI void + ecore_x_icccm_client_leader_set(Ecore_X_Window win, + Ecore_X_Window l); +EAPI Ecore_X_Window + ecore_x_icccm_client_leader_get(Ecore_X_Window win); +EAPI void + ecore_x_icccm_iconic_request_send(Ecore_X_Window win, + Ecore_X_Window root); + +typedef enum _Ecore_X_MWM_Hint_Func +{ + ECORE_X_MWM_HINT_FUNC_ALL = (1 << 0), + ECORE_X_MWM_HINT_FUNC_RESIZE = (1 << 1), + ECORE_X_MWM_HINT_FUNC_MOVE = (1 << 2), + ECORE_X_MWM_HINT_FUNC_MINIMIZE = (1 << 3), + ECORE_X_MWM_HINT_FUNC_MAXIMIZE = (1 << 4), + ECORE_X_MWM_HINT_FUNC_CLOSE = (1 << 5) +} Ecore_X_MWM_Hint_Func; + +typedef enum _Ecore_X_MWM_Hint_Decor +{ + ECORE_X_MWM_HINT_DECOR_ALL = (1 << 0), + ECORE_X_MWM_HINT_DECOR_BORDER = (1 << 1), + ECORE_X_MWM_HINT_DECOR_RESIZEH = (1 << 2), + ECORE_X_MWM_HINT_DECOR_TITLE = (1 << 3), + ECORE_X_MWM_HINT_DECOR_MENU = (1 << 4), + ECORE_X_MWM_HINT_DECOR_MINIMIZE = (1 << 5), + ECORE_X_MWM_HINT_DECOR_MAXIMIZE = (1 << 6) +} Ecore_X_MWM_Hint_Decor; + +typedef enum _Ecore_X_MWM_Hint_Input +{ + ECORE_X_MWM_HINT_INPUT_MODELESS = 0, + ECORE_X_MWM_HINT_INPUT_PRIMARY_APPLICATION_MODAL = 1, + ECORE_X_MWM_HINT_INPUT_SYSTEM_MODAL = 2, + ECORE_X_MWM_HINT_INPUT_FULL_APPLICATION_MODAL = 3 +} Ecore_X_MWM_Hint_Input; + +EAPI Eina_Bool +ecore_x_mwm_hints_get(Ecore_X_Window win, + Ecore_X_MWM_Hint_Func *fhint, + Ecore_X_MWM_Hint_Decor *dhint, + Ecore_X_MWM_Hint_Input *ihint); +EAPI void +ecore_x_mwm_borderless_set(Ecore_X_Window win, + Eina_Bool borderless); + +/* netwm */ +EAPI void + ecore_x_netwm_init(void); +EAPI void + ecore_x_netwm_shutdown(void); +EAPI void + ecore_x_netwm_wm_identify(Ecore_X_Window root, + Ecore_X_Window check, + const char *wm_name); +EAPI void +ecore_x_netwm_supported_set(Ecore_X_Window root, + Ecore_X_Atom *supported, + int num); +EAPI Eina_Bool +ecore_x_netwm_supported_get(Ecore_X_Window root, + Ecore_X_Atom **supported, + int *num); +EAPI void +ecore_x_netwm_desk_count_set(Ecore_X_Window root, + unsigned int n_desks); +EAPI void +ecore_x_netwm_desk_roots_set(Ecore_X_Window root, + Ecore_X_Window *vroots, + unsigned int n_desks); +EAPI void +ecore_x_netwm_desk_names_set(Ecore_X_Window root, + const char **names, + unsigned int n_desks); +EAPI void +ecore_x_netwm_desk_size_set(Ecore_X_Window root, + unsigned int width, + unsigned int height); +EAPI void +ecore_x_netwm_desk_workareas_set(Ecore_X_Window root, + unsigned int *areas, + unsigned int n_desks); +EAPI unsigned int * +ecore_x_netwm_desk_workareas_get(Ecore_X_Window root, + unsigned int *n_desks); +EAPI void +ecore_x_netwm_desk_current_set(Ecore_X_Window root, + unsigned int desk); +EAPI void +ecore_x_netwm_desk_viewports_set(Ecore_X_Window root, + unsigned int *origins, + unsigned int n_desks); +EAPI void +ecore_x_netwm_desk_layout_set(Ecore_X_Window root, + int orientation, + int columns, + int rows, + int starting_corner); +EAPI void +ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, + Eina_Bool on); +EAPI void +ecore_x_netwm_client_list_set(Ecore_X_Window root, + Ecore_X_Window *p_clients, + unsigned int n_clients); +EAPI void +ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root, + Ecore_X_Window *p_clients, + unsigned int n_clients); +EAPI void +ecore_x_netwm_client_active_set(Ecore_X_Window root, + Ecore_X_Window win); +EAPI void +ecore_x_netwm_client_active_request(Ecore_X_Window root, + Ecore_X_Window win, + int type, + Ecore_X_Window current_win); +EAPI void +ecore_x_netwm_name_set(Ecore_X_Window win, + const char *name); +EAPI int +ecore_x_netwm_name_get(Ecore_X_Window win, + char **name); +EAPI void +ecore_x_netwm_startup_id_set(Ecore_X_Window win, + const char *id); +EAPI int +ecore_x_netwm_startup_id_get(Ecore_X_Window win, + char **id); +EAPI void +ecore_x_netwm_visible_name_set(Ecore_X_Window win, + const char *name); +EAPI int +ecore_x_netwm_visible_name_get(Ecore_X_Window win, + char **name); +EAPI void +ecore_x_netwm_icon_name_set(Ecore_X_Window win, + const char *name); +EAPI int +ecore_x_netwm_icon_name_get(Ecore_X_Window win, + char **name); +EAPI void +ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, + const char *name); +EAPI int +ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win, + char **name); +EAPI void +ecore_x_netwm_desktop_set(Ecore_X_Window win, + unsigned int desk); +EAPI Eina_Bool +ecore_x_netwm_desktop_get(Ecore_X_Window win, + unsigned int *desk); +EAPI void +ecore_x_netwm_strut_set(Ecore_X_Window win, + int left, + int right, + int top, + int bottom); +EAPI Eina_Bool +ecore_x_netwm_strut_get(Ecore_X_Window win, + int *left, + int *right, + int *top, + int *bottom); +EAPI void +ecore_x_netwm_strut_partial_set(Ecore_X_Window win, + int left, + int right, + int top, + int bottom, + int left_start_y, + int left_end_y, + int right_start_y, + int right_end_y, + int top_start_x, + int top_end_x, + int bottom_start_x, + int bottom_end_x); +EAPI Eina_Bool +ecore_x_netwm_strut_partial_get(Ecore_X_Window win, + int *left, + int *right, + int *top, + int *bottom, + int *left_start_y, + int *left_end_y, + int *right_start_y, + int *right_end_y, + int *top_start_x, + int *top_end_x, + int *bottom_start_x, + int *bottom_end_x); + +EAPI Eina_Bool +ecore_x_netwm_icons_get(Ecore_X_Window win, + Ecore_X_Icon **icon, + int *num); +EAPI void +ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, + int x, + int y, + int width, + int height); +EAPI Eina_Bool +ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *width, + int *height); +EAPI void +ecore_x_netwm_pid_set(Ecore_X_Window win, + int pid); +EAPI Eina_Bool +ecore_x_netwm_pid_get(Ecore_X_Window win, + int *pid); +EAPI void + ecore_x_netwm_handled_icons_set(Ecore_X_Window win); +EAPI Eina_Bool + ecore_x_netwm_handled_icons_get(Ecore_X_Window win); +EAPI void + ecore_x_netwm_user_time_set(Ecore_X_Window win, + unsigned int time); +EAPI Eina_Bool +ecore_x_netwm_user_time_get(Ecore_X_Window win, + unsigned int *time); +EAPI void +ecore_x_netwm_window_state_set(Ecore_X_Window win, + Ecore_X_Window_State *state, + unsigned int num); +EAPI Eina_Bool +ecore_x_netwm_window_state_get(Ecore_X_Window win, + Ecore_X_Window_State **state, + unsigned int *num); +EAPI void +ecore_x_netwm_window_type_set(Ecore_X_Window win, + Ecore_X_Window_Type type); +EAPI Eina_Bool +ecore_x_netwm_window_type_get(Ecore_X_Window win, + Ecore_X_Window_Type *type); +EAPI int +ecore_x_netwm_window_types_get(Ecore_X_Window win, + Ecore_X_Window_Type **types); +EAPI Eina_Bool +ecore_x_netwm_allowed_action_isset(Ecore_X_Window win, + Ecore_X_Action action); +EAPI void +ecore_x_netwm_allowed_action_set(Ecore_X_Window win, + Ecore_X_Action *action, + unsigned int num); +EAPI Eina_Bool +ecore_x_netwm_allowed_action_get(Ecore_X_Window win, + Ecore_X_Action **action, + unsigned int *num); +EAPI void +ecore_x_netwm_opacity_set(Ecore_X_Window win, + unsigned int opacity); +EAPI Eina_Bool +ecore_x_netwm_opacity_get(Ecore_X_Window win, + unsigned int *opacity); +EAPI void +ecore_x_netwm_frame_size_set(Ecore_X_Window win, + int fl, + int fr, + int ft, + int fb); +EAPI Eina_Bool +ecore_x_netwm_frame_size_get(Ecore_X_Window win, + int *fl, + int *fr, + int *ft, + int *fb); +EAPI Eina_Bool +ecore_x_netwm_sync_counter_get(Ecore_X_Window win, + Ecore_X_Sync_Counter *counter); +EAPI void + ecore_x_netwm_ping_send(Ecore_X_Window win); +EAPI void + ecore_x_netwm_sync_request_send(Ecore_X_Window win, + unsigned int serial); +EAPI void +ecore_x_netwm_state_request_send(Ecore_X_Window win, + Ecore_X_Window root, + Ecore_X_Window_State s1, + Ecore_X_Window_State s2, + Eina_Bool set); +EAPI void +ecore_x_netwm_desktop_request_send(Ecore_X_Window win, + Ecore_X_Window root, + unsigned int desktop); + +EAPI void + ecore_x_e_init(void); +EAPI void + ecore_x_e_frame_size_set(Ecore_X_Window win, + int fl, + int fr, + int ft, + int fb); +EAPI void +ecore_x_e_virtual_keyboard_set(Ecore_X_Window win, + unsigned int is_keyboard); +EAPI Eina_Bool + ecore_x_e_virtual_keyboard_get(Ecore_X_Window win); +EAPI void + ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win, + Ecore_X_Virtual_Keyboard_State state); +EAPI Ecore_X_Virtual_Keyboard_State + ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win); +EAPI void + ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win, + Ecore_X_Virtual_Keyboard_State state); + +/* Illume functions */ +EAPI void +ecore_x_e_illume_zone_set(Ecore_X_Window win, + Ecore_X_Window zone); +EAPI Ecore_X_Window + ecore_x_e_illume_zone_get(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_zone_list_set(Ecore_X_Window win, + Ecore_X_Window *zones, + unsigned int n_zones); +EAPI void +ecore_x_e_illume_conformant_set(Ecore_X_Window win, + unsigned int is_conformant); +EAPI Eina_Bool + ecore_x_e_illume_conformant_get(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_mode_set(Ecore_X_Window win, + Ecore_X_Illume_Mode mode); +EAPI Ecore_X_Illume_Mode + ecore_x_e_illume_mode_get(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_mode_send(Ecore_X_Window win, + Ecore_X_Illume_Mode mode); +EAPI void + ecore_x_e_illume_focus_back_send(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_focus_forward_send(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_focus_home_send(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_close_send(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_home_new_send(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_home_del_send(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_drag_set(Ecore_X_Window win, + unsigned int drag); +EAPI Eina_Bool + ecore_x_e_illume_drag_get(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_drag_locked_set(Ecore_X_Window win, + unsigned int is_locked); +EAPI Eina_Bool + ecore_x_e_illume_drag_locked_get(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_drag_start_send(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_drag_end_send(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_indicator_geometry_set(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI Eina_Bool +ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *w, + int *h); +EAPI void +ecore_x_e_illume_softkey_geometry_set(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI Eina_Bool +ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *w, + int *h); +EAPI void +ecore_x_e_illume_keyboard_geometry_set(Ecore_X_Window win, + int x, + int y, + int w, + int h); +EAPI Eina_Bool +ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *w, + int *h); +EAPI void +ecore_x_e_illume_quickpanel_set(Ecore_X_Window win, + unsigned int is_quickpanel); +EAPI Eina_Bool + ecore_x_e_illume_quickpanel_get(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win, + Ecore_X_Illume_Quickpanel_State state); +EAPI Ecore_X_Illume_Quickpanel_State + ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win, + Ecore_X_Illume_Quickpanel_State state); +EAPI void + ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_quickpanel_priority_major_set(Ecore_X_Window win, + unsigned int priority); +EAPI int + ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_quickpanel_priority_minor_set(Ecore_X_Window win, + unsigned int priority); +EAPI int + ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win, + unsigned int zone); +EAPI int + ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_quickpanel_zone_request_send(Ecore_X_Window win); +EAPI void + ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win); + +EAPI void +ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, + Ecore_X_Sync_Counter counter); +EAPI Ecore_X_Sync_Counter + ecore_x_e_comp_sync_counter_get(Ecore_X_Window win); +EAPI void + ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root, + Ecore_X_Window win); +EAPI void +ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root, + Ecore_X_Window win, + int w, + int h); +EAPI void +ecore_x_e_comp_sync_supported_set(Ecore_X_Window root, + Eina_Bool enabled); +EAPI Eina_Bool + ecore_x_e_comp_sync_supported_get(Ecore_X_Window root); +EAPI void + ecore_x_e_comp_sync_begin_send(Ecore_X_Window win); +EAPI void + ecore_x_e_comp_sync_end_send(Ecore_X_Window win); +EAPI void + ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win); + +EAPI void + ecore_x_e_comp_flush_send(Ecore_X_Window win); +EAPI void + ecore_x_e_comp_dump_send(Ecore_X_Window win); +EAPI void + ecore_x_e_comp_pixmap_set(Ecore_X_Window win, + Ecore_X_Pixmap pixmap); +EAPI Ecore_X_Pixmap +ecore_x_e_comp_pixmap_get(Ecore_X_Window win); + +EAPI Ecore_X_Sync_Alarm + ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter); +EAPI Eina_Bool + ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm); +EAPI Eina_Bool + ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, + unsigned int *val); +EAPI Ecore_X_Sync_Counter + ecore_x_sync_counter_new(int val); +EAPI void + ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter); +EAPI void + ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, + int by); +EAPI void +ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, + int val); + +EAPI void +ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter, + int val); +EAPI void +ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter, + int val_hi, + unsigned int val_lo); +EAPI Eina_Bool +ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter, + int *val_hi, + unsigned int *val_lo); + +EAPI int + ecore_x_xinerama_screen_count_get(void); +EAPI Eina_Bool + ecore_x_xinerama_screen_geometry_get(int screen, + int *x, + int *y, + int *w, + int *h); + +EAPI Eina_Bool + ecore_x_screensaver_event_available_get(void); +EAPI int + ecore_x_screensaver_idle_time_get(void); +EAPI void + ecore_x_screensaver_set(int timeout, + int interval, + int prefer_blanking, + int allow_exposures); +EAPI void + ecore_x_screensaver_timeout_set(int timeout); +EAPI int + ecore_x_screensaver_timeout_get(void); +EAPI void + ecore_x_screensaver_blank_set(int timeout); +EAPI int + ecore_x_screensaver_blank_get(void); +EAPI void + ecore_x_screensaver_expose_set(int timeout); +EAPI int + ecore_x_screensaver_expose_get(void); +EAPI void + ecore_x_screensaver_interval_set(int timeout); +EAPI int + ecore_x_screensaver_interval_get(void); +EAPI void + ecore_x_screensaver_event_listen_set(Eina_Bool on); + +/* FIXME: these funcs need categorising */ + +typedef struct _Ecore_X_Window_Attributes +{ + Ecore_X_Window root; + int x, y, w, h; + int border; + int depth; + Eina_Bool visible : 1; + Eina_Bool viewable : 1; + Eina_Bool override : 1; + Eina_Bool input_only : 1; + Eina_Bool save_under : 1; + struct + { + Ecore_X_Event_Mask mine; + Ecore_X_Event_Mask all; + Ecore_X_Event_Mask no_propagate; + } event_mask; + Ecore_X_Gravity window_gravity; + Ecore_X_Gravity pixel_gravity; + Ecore_X_Colormap colormap; + Ecore_X_Visual visual; + /* FIXME: missing + * int map_installed; + * Screen *screen; + */ +} Ecore_X_Window_Attributes; + +EAPI Eina_Bool +ecore_x_window_attributes_get(Ecore_X_Window win, + Ecore_X_Window_Attributes *att_ret); +EAPI void + ecore_x_window_save_set_add(Ecore_X_Window win); +EAPI void + ecore_x_window_save_set_del(Ecore_X_Window win); +EAPI Ecore_X_Window * + ecore_x_window_children_get(Ecore_X_Window win, + int *num); + +EAPI Eina_Bool +ecore_x_pointer_control_set(int accel_num, + int accel_denom, + int threshold); +EAPI Eina_Bool +ecore_x_pointer_control_get(int *accel_num, + int *accel_denom, + int *threshold); +EAPI Eina_Bool +ecore_x_pointer_mapping_set(unsigned char *map, + int nmap); +EAPI Eina_Bool +ecore_x_pointer_mapping_get(unsigned char *map, + int nmap); +EAPI Eina_Bool + ecore_x_pointer_grab(Ecore_X_Window win); +EAPI Eina_Bool + ecore_x_pointer_confine_grab(Ecore_X_Window win); +EAPI void + ecore_x_pointer_ungrab(void); +EAPI Eina_Bool + ecore_x_pointer_warp(Ecore_X_Window win, + int x, + int y); +EAPI Eina_Bool + ecore_x_keyboard_grab(Ecore_X_Window win); +EAPI void + ecore_x_keyboard_ungrab(void); +EAPI void + ecore_x_grab(void); +EAPI void + ecore_x_ungrab(void); +EAPI void + ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data, + int event_type, + void *event), + void *data); +EAPI void +ecore_x_window_button_grab(Ecore_X_Window win, + int button, + Ecore_X_Event_Mask event_mask, + int mod, + int any_mod); +EAPI void +ecore_x_window_button_ungrab(Ecore_X_Window win, + int button, + int mod, + int any_mod); +EAPI void +ecore_x_window_key_grab(Ecore_X_Window win, + const char *key, + int mod, + int any_mod); +EAPI void +ecore_x_window_key_ungrab(Ecore_X_Window win, + const char *key, + int mod, + int any_mod); + +EAPI void + ecore_x_focus_reset(void); +EAPI void + ecore_x_events_allow_all(void); +EAPI void + ecore_x_pointer_last_xy_get(int *x, + int *y); +EAPI void +ecore_x_pointer_xy_get(Ecore_X_Window win, + int *x, + int *y); + +/* ecore_x_region.c */ +EAPI Ecore_X_XRegion * + ecore_x_xregion_new(void); +EAPI void + ecore_x_xregion_free(Ecore_X_XRegion *region); +EAPI Eina_Bool + ecore_x_xregion_set(Ecore_X_XRegion *region, + Ecore_X_GC gc); +EAPI void +ecore_x_xregion_translate(Ecore_X_XRegion *region, + int x, + int y); +EAPI Eina_Bool +ecore_x_xregion_intersect(Ecore_X_XRegion *dst, + Ecore_X_XRegion *r1, + Ecore_X_XRegion *r2); +EAPI Eina_Bool +ecore_x_xregion_union(Ecore_X_XRegion *dst, + Ecore_X_XRegion *r1, + Ecore_X_XRegion *r2); +EAPI Eina_Bool +ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, + Ecore_X_XRegion *src, + Ecore_X_Rectangle *rect); +EAPI Eina_Bool +ecore_x_xregion_subtract(Ecore_X_XRegion *dst, + Ecore_X_XRegion *r1, + Ecore_X_XRegion *r2); +EAPI Eina_Bool + ecore_x_xregion_is_empty(Ecore_X_XRegion *region); +EAPI Eina_Bool + ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, + Ecore_X_XRegion *r2); +EAPI Eina_Bool +ecore_x_xregion_point_contain(Ecore_X_XRegion *region, + int x, + int y); +EAPI Eina_Bool +ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, + Ecore_X_Rectangle *rect); + +/* ecore_x_randr.c */ + +/* The usage of 'Ecore_X_Randr_None' or 'Ecore_X_Randr_Unset' + * depends on the context. In most cases 'Ecore_X_Randr_Unset' + * can be used, but in some cases -1 is a special value to + * functions, thus 'Ecore_X_Randr_None' (=0) musst be used. + */ + +typedef short Ecore_X_Randr_Refresh_Rate; +typedef int Ecore_X_Randr_Crtc_Gamma; +typedef int Ecore_X_Randr_Signal_Format; +typedef int Ecore_X_Randr_Signal_Property; +typedef int Ecore_X_Randr_Connector_Type; + +typedef struct _Ecore_X_Randr_Mode_Info +{ + Ecore_X_ID xid; + unsigned int width; + unsigned int height; + unsigned long dotClock; + unsigned int hSyncStart; + unsigned int hSyncEnd; + unsigned int hTotal; + unsigned int hSkew; + unsigned int vSyncStart; + unsigned int vSyncEnd; + unsigned int vTotal; + char *name; + unsigned int nameLength; + unsigned long modeFlags; +} Ecore_X_Randr_Mode_Info; + +EAPI int + ecore_x_randr_version_get(void); +EAPI Eina_Bool + ecore_x_randr_query(void); + +/* ecore_x_randr_11.c */ +EAPI Ecore_X_Randr_Orientation + ecore_x_randr_screen_primary_output_orientations_get(Ecore_X_Window root); +EAPI Ecore_X_Randr_Orientation + ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root); +EAPI Eina_Bool + ecore_x_randr_screen_primary_output_orientation_set(Ecore_X_Window root, + Ecore_X_Randr_Orientation orientation); +EAPI Ecore_X_Randr_Screen_Size_MM * +ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root, + int *num); +EAPI void +ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root, + int *w, + int *h, + int *w_mm, + int *h_mm, + int *size_index); +EAPI Eina_Bool +ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root, + int size_index); +EAPI Ecore_X_Randr_Refresh_Rate + ecore_x_randr_screen_primary_output_current_refresh_rate_get(Ecore_X_Window root); +EAPI Ecore_X_Randr_Refresh_Rate * + ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root, + int size_index, + int *num); +EAPI Eina_Bool +ecore_x_randr_screen_primary_output_refresh_rate_set(Ecore_X_Window root, + int size_index, + Ecore_X_Randr_Refresh_Rate rate); + +/* ecore_x_randr_12.c */ +EAPI void +ecore_x_randr_events_select(Ecore_X_Window win, + Eina_Bool on); + +EAPI void +ecore_x_randr_screen_current_size_get(Ecore_X_Window root, + int *w, + int *h, + int *w_mm, + int *h_mm); +EAPI void +ecore_x_randr_screen_size_range_get(Ecore_X_Window root, + int *wmin, + int *hmin, + int *wmax, + int *hmax); +EAPI void + ecore_x_randr_screen_reset(Ecore_X_Window root); +EAPI Eina_Bool + ecore_x_randr_screen_current_size_set(Ecore_X_Window root, + int w, + int h, + int w_mm, + int h_mm); +EAPI Ecore_X_Randr_Mode_Info ** +ecore_x_randr_modes_info_get(Ecore_X_Window root, + int *num); +EAPI Ecore_X_Randr_Mode_Info * +ecore_x_randr_mode_info_get(Ecore_X_Window root, + Ecore_X_Randr_Mode mode); +EAPI void + ecore_x_randr_mode_info_free(Ecore_X_Randr_Mode_Info *mode_info); +EAPI Ecore_X_Randr_Crtc * + ecore_x_randr_crtcs_get(Ecore_X_Window root, + int *num); +EAPI Ecore_X_Randr_Output *ecore_x_randr_outputs_get(Ecore_X_Window root, + int *num); +EAPI Ecore_X_Randr_Output * +ecore_x_randr_window_outputs_get(Ecore_X_Window window, + int *num); +EINA_DEPRECATED EAPI Ecore_X_Randr_Output * +ecore_x_randr_current_output_get(Ecore_X_Window window, + int *num); +EAPI Ecore_X_Randr_Crtc * +ecore_x_randr_current_crtc_get(Ecore_X_Window window, + int *num); +EAPI Ecore_X_Randr_Output * +ecore_x_randr_crtc_outputs_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *num); +EAPI Ecore_X_Randr_Output * +ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *num); +EAPI void +ecore_x_randr_crtc_geometry_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *x, + int *y, + int *w, + int *h); +EAPI void +ecore_x_randr_crtc_pos_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *x, + int *y); +EAPI Eina_Bool +ecore_x_randr_crtc_pos_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int x, + int y); +EAPI Ecore_X_Randr_Mode +ecore_x_randr_crtc_mode_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc); +EAPI Eina_Bool +ecore_x_randr_crtc_mode_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + Ecore_X_Randr_Output *outputs, + int noutputs, + Ecore_X_Randr_Mode mode); +EAPI void +ecore_x_randr_crtc_size_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *w, + int *h); +EAPI Ecore_X_Randr_Refresh_Rate +ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + Ecore_X_Randr_Mode mode); +EAPI Ecore_X_Randr_Orientation +ecore_x_randr_crtc_orientations_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc); +EAPI Ecore_X_Randr_Orientation +ecore_x_randr_crtc_orientation_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc); +EAPI Eina_Bool +ecore_x_randr_crtc_orientation_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + const Ecore_X_Randr_Orientation orientation); +EAPI Eina_Bool +ecore_x_randr_crtc_clone_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc original, + Ecore_X_Randr_Crtc clone); +EAPI Eina_Bool +ecore_x_randr_crtc_settings_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + Ecore_X_Randr_Output *outputs, + int noutputs, + int x, + int y, + Ecore_X_Randr_Mode mode, + Ecore_X_Randr_Orientation orientation); +EAPI Eina_Bool +ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc_r1, + Ecore_X_Randr_Crtc crtc_r2, + Ecore_X_Randr_Output_Policy policy, + Ecore_X_Randr_Relative_Alignment alignment); +EAPI Ecore_X_Randr_Mode * +ecore_x_randr_output_modes_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num, + int *npreferred); +EAPI Ecore_X_Randr_Output *ecore_x_randr_output_clones_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num); +EAPI Ecore_X_Randr_Crtc *ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num); +EAPI Ecore_X_Randr_Crtc +ecore_x_randr_output_crtc_get(Ecore_X_Window root, + Ecore_X_Randr_Output output); +EAPI char * +ecore_x_randr_output_name_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *len); +EAPI int + ecore_x_randr_crtc_gamma_ramp_size_get(Ecore_X_Randr_Crtc crtc); +EAPI Ecore_X_Randr_Crtc_Gamma ** + ecore_x_randr_crtc_gamma_ramps_get(Ecore_X_Randr_Crtc crtc); +EAPI Eina_Bool + ecore_x_randr_crtc_gamma_ramps_set(Ecore_X_Randr_Crtc crtc, + const Ecore_X_Randr_Crtc_Gamma *red, + const Ecore_X_Randr_Crtc_Gamma *green, + const Ecore_X_Randr_Crtc_Gamma *blue); +EAPI Eina_Bool +ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root, + const Ecore_X_Randr_Crtc *not_moved, + int nnot_moved, + int dx, + int dy); +EAPI Eina_Bool +ecore_x_randr_move_crtcs(Ecore_X_Window root, + const Ecore_X_Randr_Crtc *crtcs, + int ncrtc, + int dx, + int dy); +EAPI void +ecore_x_randr_mode_size_get(Ecore_X_Window root, + Ecore_X_Randr_Mode mode, + int *w, + int *h); +EAPI Ecore_X_Randr_Connection_Status +ecore_x_randr_output_connection_status_get(Ecore_X_Window root, + Ecore_X_Randr_Output output); +EAPI void +ecore_x_randr_output_size_mm_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *w, + int *h); +EAPI Eina_Bool +ecore_x_randr_output_crtc_set(Ecore_X_Window root, + Ecore_X_Randr_Output output, + const Ecore_X_Randr_Crtc crtc); + +/* ecore_x_randr_12_edid.c */ + +/* + * @brief Validates the header from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return EINA_TRUE, if the header is valid. Else EINA_FALSE. + */ +EAPI Eina_Bool +ecore_x_randr_edid_has_valid_header(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Checks whether a display's EDID has a valid checksum. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return EINA_TRUE, if the checksum is valid. Else EINA_FALSE. + */ +EAPI Eina_Bool +ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the encoded version from raw EDID data. + * + * The return value has the minor version in the lowest 8 bits, and the major + * version in all the rest of the bits. i.e. + * + * minor = (version & 0x000000ff); + * major = (version & 0xffffff00) >> 8; + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The encoded major and minor version encasuplated an int. + */ +EAPI int +ecore_x_randr_edid_version_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the encoded manufacturer from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The encoded manufacturer identifier. + */ +EAPI char * +ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the encoded name from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The encoded manufacturer identifier. + */ +EAPI char * +ecore_x_randr_edid_display_name_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the encoded ASCII from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The encoded ASCII display identifier. + */ +EAPI char * +ecore_x_randr_edid_display_ascii_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the encoded serial identifier from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The encoded serial identifier. + */ +EAPI char * +ecore_x_randr_edid_display_serial_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the encoded model number from raw EDID data. + * + * The manufacturer ID table is necessary for a useful description. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The encoded model number. + */ +EAPI int +ecore_x_randr_edid_model_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the manufacturer serial number from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The encoded serial manufacturer serial number. + */ +EAPI int +ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the manufacturer model number from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The manufacturer's model number. + */ +EAPI int +ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Looks up the DPMS support from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return EINA_TRUE, if DPMS is supported in some way. Else EINA_FALSE. + */ +EAPI Eina_Bool +ecore_x_randr_edid_dpms_available_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Looks up the DPMS Standby support from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return EINA_TRUE, if DPMS Standby is supported. Else EINA_FALSE. + */ +EAPI Eina_Bool +ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Looks up the DPMS Suspend support from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return EINA_TRUE, if DPMS Suspend is supported. Else EINA_FALSE. + */ +EAPI Eina_Bool +ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Looks up the DPMS Off support from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return EINA_TRUE, if DPMS Off is supported. Else EINA_FALSE. + */ +EAPI Eina_Bool +ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the preferred aspect ratio from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The preferred aspect ratio. + */ +EAPI Ecore_X_Randr_Edid_Aspect_Ratio +ecore_x_randr_edid_display_aspect_ratio_preferred_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the supported aspect ratios from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The supported aspect ratios. + */ +EAPI Ecore_X_Randr_Edid_Aspect_Ratio +ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the supported colorschemes from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The supported colorschemes. + */ +EAPI Ecore_X_Randr_Edid_Display_Colorscheme +ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the display type from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return EINA_TRUE, if the display is a digital one. Else EINA_FALSE. + */ +EAPI Eina_Bool +ecore_x_randr_edid_display_type_digital_get(unsigned char *edid, + unsigned long edid_length); + +/* + * @brief Get the display interface type from raw EDID data. + * + * @param edid the edid structure + * @param edid_length length of the edid structure + * @return The interface type. + */ +EAPI Ecore_X_Randr_Edid_Display_Interface_Type +ecore_x_randr_edid_display_interface_type_get(unsigned char *edid, + unsigned long edid_length); + +/* ecore_x_randr_13.c */ +EAPI void +ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root, + double level); +EAPI double +ecore_x_randr_output_backlight_level_get(Ecore_X_Window root, + Ecore_X_Randr_Output output); +EAPI Eina_Bool +ecore_x_randr_output_backlight_level_set(Ecore_X_Window root, + Ecore_X_Randr_Output output, + double level); +EAPI Ecore_X_Randr_Output + ecore_x_randr_primary_output_get(Ecore_X_Window root); +EAPI void + ecore_x_randr_primary_output_set(Ecore_X_Window root, + Ecore_X_Randr_Output output); +EAPI Ecore_X_Render_Subpixel_Order +ecore_x_randr_output_subpixel_order_get(Ecore_X_Window root, + Ecore_X_Randr_Output output); +EAPI unsigned char * +ecore_x_randr_output_edid_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + unsigned long *length); +EAPI Ecore_X_Randr_Output * +ecore_x_randr_output_wired_clones_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num); +EAPI Ecore_X_Randr_Output ** +ecore_x_randr_output_compatibility_list_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num); +EAPI Ecore_X_Randr_Signal_Format * +ecore_x_randr_output_signal_formats_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num); +EAPI Eina_Bool +ecore_x_randr_output_signal_format_set(Ecore_X_Window root, + Ecore_X_Randr_Output output, + Ecore_X_Randr_Signal_Format *signal); +EAPI Ecore_X_Randr_Signal_Property * +ecore_x_randr_output_signal_properties_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num); +EAPI int +ecore_x_randr_output_connector_number_get(Ecore_X_Window root, + Ecore_X_Randr_Output output); +EAPI Ecore_X_Randr_Connector_Type +ecore_x_randr_output_connector_type_get(Ecore_X_Window root, + Ecore_X_Randr_Output output); +EAPI Eina_Rectangle * +ecore_x_randr_crtc_panning_area_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *x, + int *y, + int *w, + int *h); +EAPI Eina_Bool +ecore_x_randr_crtc_panning_area_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int x, + const int y, + const int w, + const int h); +EAPI Eina_Rectangle * +ecore_x_randr_crtc_tracking_area_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *x, + int *y, + int *w, + int *h); +EAPI Eina_Bool +ecore_x_randr_crtc_tracking_area_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int x, + const int y, + const int w, + const int h); +EAPI Eina_Rectangle * +ecore_x_randr_crtc_border_area_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc); +EAPI Eina_Bool +ecore_x_randr_crtc_border_area_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int left, + const int top, + const int right, + const int bottom); + +/* XRender Support (horrendously incomplete) */ +typedef Ecore_X_ID Ecore_X_Picture; + +/* XFixes Extension Support */ +typedef Ecore_X_ID Ecore_X_Region; + +typedef enum _Ecore_X_Region_Type +{ + ECORE_X_REGION_BOUNDING, + ECORE_X_REGION_CLIP +} Ecore_X_Region_Type; + +EAPI Ecore_X_Region +ecore_x_region_new(Ecore_X_Rectangle *rects, + int num); +EAPI Ecore_X_Region + ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap); +EAPI Ecore_X_Region + ecore_x_region_new_from_window(Ecore_X_Window win, + Ecore_X_Region_Type type); +EAPI Ecore_X_Region + ecore_x_region_new_from_gc(Ecore_X_GC gc); +EAPI Ecore_X_Region + ecore_x_region_new_from_picture(Ecore_X_Picture picture); +EAPI void + ecore_x_region_free(Ecore_X_Region region); +EAPI void + ecore_x_region_set(Ecore_X_Region region, + Ecore_X_Rectangle *rects, + int num); +EAPI void +ecore_x_region_copy(Ecore_X_Region dest, + Ecore_X_Region source); +EAPI void +ecore_x_region_combine(Ecore_X_Region dest, + Ecore_X_Region source1, + Ecore_X_Region source2); +EAPI void +ecore_x_region_intersect(Ecore_X_Region dest, + Ecore_X_Region source1, + Ecore_X_Region source2); +EAPI void +ecore_x_region_subtract(Ecore_X_Region dest, + Ecore_X_Region source1, + Ecore_X_Region source2); +EAPI void +ecore_x_region_invert(Ecore_X_Region dest, + Ecore_X_Rectangle *bounds, + Ecore_X_Region source); +EAPI void +ecore_x_region_translate(Ecore_X_Region region, + int dx, + int dy); +EAPI void +ecore_x_region_extents(Ecore_X_Region dest, + Ecore_X_Region source); +EAPI Ecore_X_Rectangle * +ecore_x_region_fetch(Ecore_X_Region region, + int *num, + Ecore_X_Rectangle *bounds); +EAPI void +ecore_x_region_expand(Ecore_X_Region dest, + Ecore_X_Region source, + unsigned int left, + unsigned int right, + unsigned int top, + unsigned int bottom); +EAPI void +ecore_x_region_gc_clip_set(Ecore_X_Region region, + Ecore_X_GC gc, + int x_origin, + int y_origin); +EAPI void +ecore_x_region_window_shape_set(Ecore_X_Region region, + Ecore_X_Window win, + Ecore_X_Shape_Type type, + int x_offset, + int y_offset); +EAPI void +ecore_x_region_picture_clip_set(Ecore_X_Region region, + Ecore_X_Picture picture, + int x_origin, + int y_origin); + +/** + * xfixes selection notification request. + * + * This lets you choose which selections you want to get notifications for. + * @param selection the selection atom. + * @return EINA_TRUE on success, EINA_FALSE otherwise. + * @since 1.1.0 + */ +EAPI Eina_Bool +ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection); + +/* XComposite Extension Support */ +EAPI Eina_Bool + ecore_x_composite_query(void); +EAPI void + ecore_x_composite_redirect_window(Ecore_X_Window win, + Ecore_X_Composite_Update_Type type); +EAPI void +ecore_x_composite_redirect_subwindows(Ecore_X_Window win, + Ecore_X_Composite_Update_Type type); +EAPI void +ecore_x_composite_unredirect_window(Ecore_X_Window win, + Ecore_X_Composite_Update_Type type); +EAPI void +ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, + Ecore_X_Composite_Update_Type type); +EAPI Ecore_X_Pixmap + ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win); +EAPI void + ecore_x_composite_window_events_disable(Ecore_X_Window win); +EAPI void + ecore_x_composite_window_events_enable(Ecore_X_Window win); +EAPI Ecore_X_Window + ecore_x_composite_render_window_enable(Ecore_X_Window root); +EAPI void + ecore_x_composite_render_window_disable(Ecore_X_Window root); + +/* XDamage Extension Support */ +typedef Ecore_X_ID Ecore_X_Damage; + +typedef enum _Ecore_X_Damage_Report_Level +{ + ECORE_X_DAMAGE_REPORT_RAW_RECTANGLES, + ECORE_X_DAMAGE_REPORT_DELTA_RECTANGLES, + ECORE_X_DAMAGE_REPORT_BOUNDING_BOX, + ECORE_X_DAMAGE_REPORT_NON_EMPTY +} Ecore_X_Damage_Report_Level; + +struct _Ecore_X_Event_Damage +{ + Ecore_X_Damage_Report_Level level; + Ecore_X_Drawable drawable; + Ecore_X_Damage damage; + int more; + Ecore_X_Time time; + Ecore_X_Rectangle area; + Ecore_X_Rectangle geometry; +}; + +typedef struct _Ecore_X_Event_Damage Ecore_X_Event_Damage; + +EAPI Eina_Bool + ecore_x_damage_query(void); +EAPI Ecore_X_Damage + ecore_x_damage_new(Ecore_X_Drawable d, + Ecore_X_Damage_Report_Level level); +EAPI void + ecore_x_damage_free(Ecore_X_Damage damage); +EAPI void + ecore_x_damage_subtract(Ecore_X_Damage damage, + Ecore_X_Region repair, + Ecore_X_Region parts); + +EAPI Eina_Bool + ecore_x_screen_is_composited(int screen); +EAPI void + ecore_x_screen_is_composited_set(int screen, + Ecore_X_Window win); + +EAPI Eina_Bool + ecore_x_dpms_query(void); +EAPI Eina_Bool + ecore_x_dpms_capable_get(void); +EAPI Eina_Bool + ecore_x_dpms_enabled_get(void); +EAPI void + ecore_x_dpms_enabled_set(int enabled); +EAPI void + ecore_x_dpms_timeouts_get(unsigned int *standby, + unsigned int *suspend, + unsigned int *off); +EAPI Eina_Bool +ecore_x_dpms_timeouts_set(unsigned int standby, + unsigned int suspend, + unsigned int off); +EAPI unsigned int + ecore_x_dpms_timeout_standby_get(void); +EAPI unsigned int + ecore_x_dpms_timeout_suspend_get(void); +EAPI unsigned int + ecore_x_dpms_timeout_off_get(void); +EAPI void + ecore_x_dpms_timeout_standby_set(unsigned int new_timeout); +EAPI void + ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout); +EAPI void + ecore_x_dpms_timeout_off_set(unsigned int new_timeout); + +EAPI Eina_Bool + ecore_x_test_fake_key_down(const char *key); +EAPI Eina_Bool + ecore_x_test_fake_key_up(const char *key); +EAPI Eina_Bool + ecore_x_test_fake_key_press(const char *key); +EAPI const char * + ecore_x_keysym_string_get(int keysym); + +typedef struct _Ecore_X_Image Ecore_X_Image; + +EAPI Ecore_X_Image * +ecore_x_image_new(int w, + int h, + Ecore_X_Visual vis, + int depth); +EAPI void + ecore_x_image_free(Ecore_X_Image *im); +EAPI Eina_Bool + ecore_x_image_get(Ecore_X_Image *im, + Ecore_X_Drawable draw, + int x, + int y, + int sx, + int sy, + int w, + int h); +EAPI void +ecore_x_image_put(Ecore_X_Image *im, + Ecore_X_Drawable draw, + Ecore_X_GC gc, + int x, + int y, + int sx, + int sy, + int w, + int h); +EAPI void * +ecore_x_image_data_get(Ecore_X_Image *im, + int *bpl, + int *rows, + int *bpp); +EAPI Eina_Bool +ecore_x_image_is_argb32_get(Ecore_X_Image *im); + +EAPI Eina_Bool +ecore_x_image_to_argb_convert(void *src, + int sbpp, + int sbpl, + Ecore_X_Colormap c, + Ecore_X_Visual v, + int x, + int y, + int w, + int h, + unsigned int *dst, + int dbpl, + int dx, + int dy); + +EAPI Eina_Bool +ecore_x_input_multi_select(Ecore_X_Window win); + +EAPI Eina_Bool +ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win); + +typedef enum _Ecore_X_Gesture_Event_Mask +{ + ECORE_X_GESTURE_EVENT_MASK_NONE = 0L, + ECORE_X_GESTURE_EVENT_MASK_FLICK = (1L << 0), + ECORE_X_GESTURE_EVENT_MASK_PAN = (1L << 1), + ECORE_X_GESTURE_EVENT_MASK_PINCHROTATION = (1L << 2), + ECORE_X_GESTURE_EVENT_MASK_TAP = (1L << 3), + ECORE_X_GESTURE_EVENT_MASK_TAPNHOLD = (1L << 4), + ECORE_X_GESTURE_EVENT_MASK_HOLD = (1L << 5), + ECORE_X_GESTURE_EVENT_MASK_GROUP = (1L << 6) +} Ecore_X_Gesture_Event_Mask; + +typedef enum _Ecore_X_Gesture_Event_Type +{ + ECORE_X_GESTURE_EVENT_FLICK, + ECORE_X_GESTURE_EVENT_PAN, + ECORE_X_GESTURE_EVENT_PINCHROTATION, + ECORE_X_GESTURE_EVENT_TAP, + ECORE_X_GESTURE_EVENT_TAPNHOLD, + ECORE_X_GESTURE_EVENT_HOLD, + ECORE_X_GESTURE_EVENT_GROUP +} Ecore_X_Gesture_Event_Type; + +typedef enum _Ecore_X_Gesture_Event_Subtype +{ + ECORE_X_GESTURE_END, + ECORE_X_GESTURE_BEGIN, + ECORE_X_GESTURE_UPDATE, + ECORE_X_GESTURE_DONE +} Ecore_X_Gesture_Event_Subtype; + +typedef enum _Ecore_X_Gesture_Group_Subtype +{ + ECORE_X_GESTURE_GROUP_REMOVED, + ECORE_X_GESTURE_GROUP_ADDED, + ECORE_X_GESTURE_GROUP_CURRENT +} Ecore_X_Gesture_Group_Subtype; + +typedef enum _Ecore_X_Gesture_Direction +{ + ECORE_X_GESTURE_NORTHWARD, + ECORE_X_GESTURE_NORTHEASTWARD, + ECORE_X_GESTURE_EASTWARD, + ECORE_X_GESTURE_SOUTHEASTWARD, + ECORE_X_GESTURE_SOUTHWARD, + ECORE_X_GESTURE_SOUTHWESTWARD, + ECORE_X_GESTURE_WESTWARD, + ECORE_X_GESTURE_NORTHWESTWARD +} Ecore_X_Gesture_Direction; + +struct _Ecore_X_Event_Gesture_Notify_Flick +{ + Ecore_X_Window win; + Ecore_X_Time time; + Ecore_X_Gesture_Event_Subtype subtype; + int num_fingers; + int distance; + Ecore_X_Time duration; + Ecore_X_Gesture_Direction direction; + double angle; +}; + +struct _Ecore_X_Event_Gesture_Notify_Pan +{ + Ecore_X_Window win; + Ecore_X_Time time; + Ecore_X_Gesture_Event_Subtype subtype; + int num_fingers; + int dx; + int dy; + int distance; + Ecore_X_Time duration; + Ecore_X_Gesture_Direction direction; +}; + +struct _Ecore_X_Event_Gesture_Notify_PinchRotation +{ + Ecore_X_Window win; + Ecore_X_Time time; + Ecore_X_Gesture_Event_Subtype subtype; + int num_fingers; + int distance; + int cx; + int cy; + double zoom; + double angle; +}; + +struct _Ecore_X_Event_Gesture_Notify_Tap +{ + Ecore_X_Window win; + Ecore_X_Time time; + Ecore_X_Gesture_Event_Subtype subtype; + int num_fingers; + int cx; + int cy; + int tap_repeat; + Ecore_X_Time interval; +}; + +struct _Ecore_X_Event_Gesture_Notify_TapNHold +{ + Ecore_X_Window win; + Ecore_X_Time time; + Ecore_X_Gesture_Event_Subtype subtype; + int num_fingers; + int cx; + int cy; + Ecore_X_Time interval; + Ecore_X_Time hold_time; +}; + +struct _Ecore_X_Event_Gesture_Notify_Hold +{ + Ecore_X_Window win; + Ecore_X_Time time; + Ecore_X_Gesture_Event_Subtype subtype; + int num_fingers; + int cx; + int cy; + Ecore_X_Time hold_time; +}; + +struct _Ecore_X_Event_Gesture_Notify_Group +{ + Ecore_X_Window win; + Ecore_X_Time time; + Ecore_X_Gesture_Group_Subtype subtype; + int num_groups; + int group_id; +}; + +EAPI Eina_Bool +ecore_x_gesture_supported(void); + +EAPI Eina_Bool +ecore_x_gesture_events_select(Ecore_X_Window win, + Ecore_X_Gesture_Event_Mask mask); + +EAPI Ecore_X_Gesture_Event_Mask +ecore_x_gesture_events_selected_get(Ecore_X_Window win); + +EAPI Eina_Bool +ecore_x_gesture_event_grab(Ecore_X_Window win, + Ecore_X_Gesture_Event_Type type, + int num_fingers); + +EAPI Eina_Bool +ecore_x_gesture_event_ungrab(Ecore_X_Window win, + Ecore_X_Gesture_Event_Type type, + int num_fingers); + +#ifdef __cplusplus +} +#endif // ifdef __cplusplus + +#include +#include + +#endif // ifndef _ECORE_X_H diff --git a/libraries/ecore/src/lib/ecore_x/Ecore_X_Atoms.h b/libraries/ecore/src/lib/ecore_x/Ecore_X_Atoms.h new file mode 100644 index 0000000..6788a5e --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/Ecore_X_Atoms.h @@ -0,0 +1,255 @@ +#ifndef _ECORE_X_ATOMS_H +#define _ECORE_X_ATOMS_H + +/** + * @file + * @brief Ecore X atoms + */ + +/* generic atoms */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_ATOM; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_CARDINAL; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_COMPOUND_TEXT; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_FILE_NAME; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_STRING; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_TEXT; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_UTF8_STRING; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WINDOW; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_PIXMAP; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_VISUALID; + +/* dnd atoms */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_XDND; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_XDND; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_AWARE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ENTER; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_TYPE_LIST; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_POSITION; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_COPY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_MOVE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_PRIVATE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_ASK; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LIST; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LINK; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_DESCRIPTION; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_PROXY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_STATUS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_LEAVE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_DROP; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_XDND_FINISHED; + +/* dnd atoms that need to be exposed to the application interface */ +EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_COPY; +EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_MOVE; +EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_LINK; +EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_ASK; +EAPI extern Ecore_X_Atom ECORE_X_DND_ACTION_PRIVATE; + +/* old E atom */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_FRAME_SIZE; + +/* old Gnome atom */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WIN_LAYER; + +/* ICCCM: client properties */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_NAME; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_ICON_NAME; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_NORMAL_HINTS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_SIZE_HINTS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_HINTS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_CLASS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_TRANSIENT_FOR; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_PROTOCOLS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_WINDOWS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_COMMAND; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_MACHINE; + +/* ICCCM: window manager properties */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_STATE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_ICON_SIZE; + +/* ICCCM: WM_STATEproperty */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_CHANGE_STATE; + +/* ICCCM: WM_PROTOCOLS properties */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_TAKE_FOCUS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_SAVE_YOURSELF; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_DELETE_WINDOW; + +/* ICCCM: WM_COLORMAP properties */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_NOTIFY; + +/* ICCCM: session management properties */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_SM_CLIENT_ID; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_LEADER; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_WM_WINDOW_ROLE; + +/* Motif WM atom */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_MOTIF_WM_HINTS; + +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTED; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST_STACKING; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_GEOMETRY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_VIEWPORT; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_CURRENT_DESKTOP; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_NAMES; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_ACTIVE_WINDOW; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WORKAREA; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_VIRTUAL_ROOTS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_LAYOUT; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_SHOWING_DESKTOP; + +/* pager */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_CLOSE_WINDOW; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_MOVERESIZE_WINDOW; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_MOVERESIZE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_RESTACK_WINDOW; + +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_NAME; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_NAME; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_NAME; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP; + +/* window type */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND; + +/* state */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MODAL; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_STICKY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SHADED; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_HIDDEN; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_ABOVE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_BELOW; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION; + +/* allowed actions */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MOVE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_RESIZE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_SHADE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_STICK; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CLOSE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_ABOVE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_BELOW; + +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT_PARTIAL; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_GEOMETRY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_PID; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_HANDLED_ICONS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_USER_TIME; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_ID; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_FRAME_EXTENTS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_PING; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_OPACITY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_SHADOW; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_SHADE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_INFO; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_TARGETS; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PRIMARY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_SECONDARY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_CLIPBOARD; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_PRIMARY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_SECONDARY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD; + +/* currently E specific virtual keyboard extension, aim to submit to netwm spec + * later */ + +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME; + +/* Illume specific atoms */ +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ZONE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ZONE_LIST; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CONFORMANT; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_SINGLE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_BACK; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_HOME; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_HOME_NEW; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_HOME_DEL; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLOSE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_START; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_END; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE; + +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_COUNTER; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_BEGIN; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_END; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_CANCEL; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_FLUSH; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_DUMP; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_COMP_PIXMAP; + +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIDEO_PARENT; +EAPI extern Ecore_X_Atom ECORE_X_ATOM_E_VIDEO_POSITION; + +#endif /* _ECORE_X_ATOMS_H */ diff --git a/libraries/ecore/src/lib/ecore_x/Ecore_X_Cursor.h b/libraries/ecore/src/lib/ecore_x/Ecore_X_Cursor.h new file mode 100644 index 0000000..807541e --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/Ecore_X_Cursor.h @@ -0,0 +1,87 @@ +#ifndef _ECORE_X_CURSOR_H +#define _ECORE_X_CURSOR_H + +/** + * @file + * @brief Defines the various cursor types for the X Windows system. + */ + +#define ECORE_X_CURSOR_X 0 +#define ECORE_X_CURSOR_ARROW 2 +#define ECORE_X_CURSOR_BASED_ARROW_DOWN 4 +#define ECORE_X_CURSOR_UP 6 +#define ECORE_X_CURSOR_BOAT 8 +#define ECORE_X_CURSOR_BOGOSITY 10 +#define ECORE_X_CURSOR_BOTTOM_LEFT_CORNER 12 +#define ECORE_X_CURSOR_BOTTOM_RIGHT_CORNER 14 +#define ECORE_X_CURSOR_BOTTOM_SIDE 16 +#define ECORE_X_CURSOR_BOTTOM_TEE 18 +#define ECORE_X_CURSOR_BOX_SPIRAL 20 +#define ECORE_X_CURSOR_CENTER_PTR 22 +#define ECORE_X_CURSOR_CIRCLE 24 +#define ECORE_X_CURSOR_CLOCK 26 +#define ECORE_X_CURSOR_COFFEE_MUG 28 +#define ECORE_X_CURSOR_CROSS 30 +#define ECORE_X_CURSOR_CROSS_REVERSE 32 +#define ECORE_X_CURSOR_CROSSHAIR 34 +#define ECORE_X_CURSOR_DIAMOND_CROSS 36 +#define ECORE_X_CURSOR_DOT 38 +#define ECORE_X_CURSOR_DOT_BOX_MASK 40 +#define ECORE_X_CURSOR_DOUBLE_ARROW 42 +#define ECORE_X_CURSOR_DRAFT_LARGE 44 +#define ECORE_X_CURSOR_DRAFT_SMALL 46 +#define ECORE_X_CURSOR_DRAPED_BOX 48 +#define ECORE_X_CURSOR_EXCHANGE 50 +#define ECORE_X_CURSOR_FLEUR 52 +#define ECORE_X_CURSOR_GOBBLER 54 +#define ECORE_X_CURSOR_GUMBY 56 +#define ECORE_X_CURSOR_HAND1 58 +#define ECORE_X_CURSOR_HAND2 60 +#define ECORE_X_CURSOR_HEART 62 +#define ECORE_X_CURSOR_ICON 64 +#define ECORE_X_CURSOR_IRON_CROSS 66 +#define ECORE_X_CURSOR_LEFT_PTR 68 +#define ECORE_X_CURSOR_LEFT_SIDE 70 +#define ECORE_X_CURSOR_LEFT_TEE 72 +#define ECORE_X_CURSOR_LEFTBUTTON 74 +#define ECORE_X_CURSOR_LL_ANGLE 76 +#define ECORE_X_CURSOR_LR_ANGLE 78 +#define ECORE_X_CURSOR_MAN 80 +#define ECORE_X_CURSOR_MIDDLEBUTTON 82 +#define ECORE_X_CURSOR_MOUSE 84 +#define ECORE_X_CURSOR_PENCIL 86 +#define ECORE_X_CURSOR_PIRATE 88 +#define ECORE_X_CURSOR_PLUS 90 +#define ECORE_X_CURSOR_QUESTION_ARROW 92 +#define ECORE_X_CURSOR_RIGHT_PTR 94 +#define ECORE_X_CURSOR_RIGHT_SIDE 96 +#define ECORE_X_CURSOR_RIGHT_TEE 98 +#define ECORE_X_CURSOR_RIGHTBUTTON 100 +#define ECORE_X_CURSOR_RTL_LOGO 102 +#define ECORE_X_CURSOR_SAILBOAT 104 +#define ECORE_X_CURSOR_SB_DOWN_ARROW 106 +#define ECORE_X_CURSOR_SB_H_DOUBLE_ARROW 108 +#define ECORE_X_CURSOR_SB_LEFT_ARROW 110 +#define ECORE_X_CURSOR_SB_RIGHT_ARROW 112 +#define ECORE_X_CURSOR_SB_UP_ARROW 114 +#define ECORE_X_CURSOR_SB_V_DOUBLE_ARROW 116 +#define ECORE_X_CURSOR_SHUTTLE 118 +#define ECORE_X_CURSOR_SIZING 120 +#define ECORE_X_CURSOR_SPIDER 122 +#define ECORE_X_CURSOR_SPRAYCAN 124 +#define ECORE_X_CURSOR_STAR 126 +#define ECORE_X_CURSOR_TARGET 128 +#define ECORE_X_CURSOR_TCROSS 130 +#define ECORE_X_CURSOR_TOP_LEFT_ARROW 132 +#define ECORE_X_CURSOR_TOP_LEFT_CORNER 134 +#define ECORE_X_CURSOR_TOP_RIGHT_CORNER 136 +#define ECORE_X_CURSOR_TOP_SIDE 138 +#define ECORE_X_CURSOR_TOP_TEE 140 +#define ECORE_X_CURSOR_TREK 142 +#define ECORE_X_CURSOR_UL_ANGLE 144 +#define ECORE_X_CURSOR_UMBRELLA 146 +#define ECORE_X_CURSOR_UR_ANGLE 148 +#define ECORE_X_CURSOR_WATCH 150 +#define ECORE_X_CURSOR_XTERM 152 + +#endif // ifndef _ECORE_X_CURSOR_H diff --git a/libraries/ecore/src/lib/ecore_x/Makefile.am b/libraries/ecore/src/lib/ecore_x/Makefile.am new file mode 100644 index 0000000..b14fc7d --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/Makefile.am @@ -0,0 +1,30 @@ +MAINTAINERCLEANFILES = Makefile.in + +SUBDIRS = xlib xcb + +if BUILD_ECORE_X_XCB +DEP = xcb/libecore_x_xcb.la +else +DEP = xlib/libecore_x_xlib.la +endif + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_x.la + +libecore_x_la_SOURCES = + +libecore_x_la_LIBADD = $(DEP) @EINA_LIBS@ +libecore_x_la_LDFLAGS = -version-info @version_info@ @release_info@ +libecore_x_la_DEPENDENCIES = $(DEP) + +includes_HEADERS = \ +Ecore_X.h \ +Ecore_X_Atoms.h \ +Ecore_X_Cursor.h +includesdir = $(includedir)/ecore-@VMAJ@ + +EXTRA_DIST = ecore_x_atoms_decl.h diff --git a/libraries/ecore/src/lib/ecore_x/Makefile.in b/libraries/ecore/src/lib/ecore_x/Makefile.in new file mode 100644 index 0000000..d5f4247 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/Makefile.in @@ -0,0 +1,934 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_x +DIST_COMMON = $(includes_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) +am_libecore_x_la_OBJECTS = +libecore_x_la_OBJECTS = $(am_libecore_x_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +libecore_x_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libecore_x_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_x_la_SOURCES) +DIST_SOURCES = $(libecore_x_la_SOURCES) +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +HEADERS = $(includes_HEADERS) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +SUBDIRS = xlib xcb +@BUILD_ECORE_X_XCB_FALSE@DEP = xlib/libecore_x_xlib.la +@BUILD_ECORE_X_XCB_TRUE@DEP = xcb/libecore_x_xcb.la +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore \ +@EINA_CFLAGS@ + +lib_LTLIBRARIES = libecore_x.la +libecore_x_la_SOURCES = +libecore_x_la_LIBADD = $(DEP) @EINA_LIBS@ +libecore_x_la_LDFLAGS = -version-info @version_info@ @release_info@ +libecore_x_la_DEPENDENCIES = $(DEP) +includes_HEADERS = \ +Ecore_X.h \ +Ecore_X_Atoms.h \ +Ecore_X_Cursor.h + +includesdir = $(includedir)/ecore-@VMAJ@ +EXTRA_DIST = ecore_x_atoms_decl.h +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_x/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_x/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_x.la: $(libecore_x_la_OBJECTS) $(libecore_x_la_DEPENDENCIES) + $(AM_V_CCLD)$(libecore_x_la_LINK) -rpath $(libdir) $(libecore_x_la_OBJECTS) $(libecore_x_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-includesHEADERS: $(includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile $(LTLIBRARIES) $(HEADERS) +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ + mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: install-includesHEADERS + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: install-libLTLIBRARIES + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-includesHEADERS uninstall-libLTLIBRARIES + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic \ + clean-libLTLIBRARIES clean-libtool ctags ctags-recursive \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am \ + install-includesHEADERS install-info install-info-am \ + install-libLTLIBRARIES install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags tags-recursive uninstall uninstall-am \ + uninstall-includesHEADERS uninstall-libLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_x/ecore_x_atoms_decl.h b/libraries/ecore/src/lib/ecore_x/ecore_x_atoms_decl.h new file mode 100644 index 0000000..3f22356 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/ecore_x_atoms_decl.h @@ -0,0 +1,281 @@ +/* generic atoms */ +EAPI Ecore_X_Atom ECORE_X_ATOM_ATOM = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_CARDINAL = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_COMPOUND_TEXT = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_FILE_NAME = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_STRING = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_TEXT = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_UTF8_STRING = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WINDOW = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_PIXMAP = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_VISUALID = 0; + +/* dnd atoms */ +EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_XDND = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_XDND = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_AWARE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ENTER = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_TYPE_LIST = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_POSITION = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_COPY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_MOVE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_PRIVATE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_ASK = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LIST = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_LINK = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_ACTION_DESCRIPTION = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_PROXY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_STATUS = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_LEAVE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_DROP = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_XDND_FINISHED = 0; + +/* dnd atoms that need to be exposed to the application interface */ +EAPI Ecore_X_Atom ECORE_X_DND_ACTION_COPY = 0; +EAPI Ecore_X_Atom ECORE_X_DND_ACTION_MOVE = 0; +EAPI Ecore_X_Atom ECORE_X_DND_ACTION_LINK = 0; +EAPI Ecore_X_Atom ECORE_X_DND_ACTION_ASK = 0; +EAPI Ecore_X_Atom ECORE_X_DND_ACTION_PRIVATE = 0; + +/* old E atom */ +EAPI Ecore_X_Atom ECORE_X_ATOM_E_FRAME_SIZE = 0; + +/* old Gnome atom */ +EAPI Ecore_X_Atom ECORE_X_ATOM_WIN_LAYER = 0; + +/* ICCCM atoms */ + +/* ICCCM: client properties */ +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_NAME = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_ICON_NAME = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_NORMAL_HINTS = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_SIZE_HINTS = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_HINTS = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLASS = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_TRANSIENT_FOR = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_PROTOCOLS = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_WINDOWS = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COMMAND = 0; /* obsolete */ +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_MACHINE = 0; /* obsolete */ + +/* ICCCM: window manager properties */ +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_STATE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_ICON_SIZE = 0; + +/* ICCCM: WM_STATE property */ +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CHANGE_STATE = 0; + +/* ICCCM: WM_PROTOCOLS properties */ +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_TAKE_FOCUS = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_SAVE_YOURSELF = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_DELETE_WINDOW = 0; + +/* ICCCM: WM_COLORMAP properties */ +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_COLORMAP_NOTIFY = 0; + +/* ICCCM: session management properties */ +EAPI Ecore_X_Atom ECORE_X_ATOM_SM_CLIENT_ID = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_CLIENT_LEADER = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_WM_WINDOW_ROLE = 0; + +/* Motif WM atom */ +EAPI Ecore_X_Atom ECORE_X_ATOM_MOTIF_WM_HINTS = 0; + +/* NetWM 1.3 atoms (http://standards.freedesktop.org/wm-spec/wm-spec-1.3.html) */ + +/* + * NetWM: Root Window Properties and related messages (complete) + */ + +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTED = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLIENT_LIST_STACKING = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_GEOMETRY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_VIEWPORT = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CURRENT_DESKTOP = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_NAMES = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_ACTIVE_WINDOW = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WORKAREA = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_VIRTUAL_ROOTS = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_DESKTOP_LAYOUT = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_SHOWING_DESKTOP = 0; + +/* + * NetWM: Other Root Window Messages (complete) + */ + +/* pager */ +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_CLOSE_WINDOW = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_MOVERESIZE_WINDOW = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_MOVERESIZE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_RESTACK_WINDOW = 0; + +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS = 0; + +/* + * NetWM: Application Window Properties (complete) + */ + +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_NAME = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_NAME = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_NAME = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_DESKTOP = 0; + +/* window type */ +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND = 0; + +/* state */ +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MODAL = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_STICKY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SHADED = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_HIDDEN = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_ABOVE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_BELOW = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION = 0; + +/* allowed actions */ +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MOVE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_RESIZE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_SHADE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_STICK = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_CLOSE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_ABOVE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ACTION_BELOW = 0; + +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_STRUT_PARTIAL = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON_GEOMETRY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_ICON = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_PID = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_HANDLED_ICONS = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_USER_TIME = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_ID = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_FRAME_EXTENTS = 0; + +/* + * NetWM: Window Manager Protocols (complete) + */ + +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_PING = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER = 0; + +/* + * NetWM: Not in the spec + */ + +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_OPACITY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_SHADOW = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_WM_WINDOW_SHADE = 0; + +/* + * Startup Notification (http://standards.freedesktop.org/startup-notification-spec/startup-notification-0.1.txt) + */ + +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_NET_STARTUP_INFO = 0; + +/* selection atoms */ +EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_TARGETS = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PRIMARY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_SECONDARY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_CLIPBOARD = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_PRIMARY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_SECONDARY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD = 0; + +/* currently E specific virtual keyboard extension, aim to submit to netwm spec + * later */ + +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME = 0; + +/* currently E specific illume extension */ +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ZONE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_ZONE_LIST = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CONFORMANT = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_SINGLE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_BACK = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_FOCUS_HOME = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_CLOSE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_HOME_NEW = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_HOME_DEL = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_START = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_DRAG_END = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE = 0; + +EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_COUNTER = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_BEGIN = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_END = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_SYNC_CANCEL = 0; + +EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_FLUSH = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_DUMP = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_COMP_PIXMAP = 0; + +/* currently Emotion and E17 specific extension */ +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIDEO_PARENT = 0; +EAPI Ecore_X_Atom ECORE_X_ATOM_E_VIDEO_POSITION = 0; diff --git a/libraries/ecore/src/lib/ecore_x/xcb/Makefile.am b/libraries/ecore/src/lib/ecore_x/xcb/Makefile.am new file mode 100644 index 0000000..366ebfd --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/Makefile.am @@ -0,0 +1,99 @@ + +MAINTAINERCLEANFILES = Makefile.in ecore_xcb_keysym_table.h + +if BUILD_ECORE_X_XCB + +AM_CPPFLAGS = \ + @XCB_DAMAGE_CFLAGS@ \ + @XCB_COMPOSITE_CFLAGS@ \ + @XCB_DPMS_CFLAGS@ \ + @XCB_RANDR_CFLAGS@ \ + @XCB_RENDER_CFLAGS@ \ + @XCB_SCREENSAVER_CFLAGS@ \ + @XCB_SHAPE_CFLAGS@ \ + @XCB_SYNC_CFLAGS@ \ + @XCB_XFIXES_CFLAGS@ \ + @XCB_XINERAMA_CFLAGS@ \ + @XCB_XPRINT_CFLAGS@ \ + @XCB_XTEST_CFLAGS@ \ + @XCB_XINPUT_CFLAGS@ \ + @XCB_XGESTURE_CFLAGS@ \ + @XCB_CURSOR_CFLAGS@ \ + @ECORE_XCB_CFLAGS@ \ + @PIXMAN_CFLAGS@ \ + -I$(top_srcdir)/src/lib/ecore \ + -I$(top_srcdir)/src/lib/ecore_x \ + -I$(top_srcdir)/src/lib/ecore_input \ + -I$(top_builddir)/src/lib/ecore \ + -I$(top_builddir)/src/lib/ecore_x \ + -I$(top_builddir)/src/lib/ecore_input \ + @EINA_CFLAGS@ + +noinst_LTLIBRARIES = libecore_x_xcb.la + +libecore_x_xcb_la_SOURCES = \ + ecore_xcb.c \ + ecore_xcb_atoms.c \ + ecore_xcb_extensions.c \ + ecore_xcb_shape.c \ + ecore_xcb_screensaver.c \ + ecore_xcb_sync.c \ + ecore_xcb_render.c \ + ecore_xcb_randr.c \ + ecore_xcb_xfixes.c \ + ecore_xcb_composite.c \ + ecore_xcb_cursor.c \ + ecore_xcb_damage.c \ + ecore_xcb_dnd.c \ + ecore_xcb_dpms.c \ + ecore_xcb_drawable.c \ + ecore_xcb_e.c \ + ecore_xcb_gc.c \ + ecore_xcb_image.c \ + ecore_xcb_input.c \ + ecore_xcb_gesture.c \ + ecore_xcb_mwm.c \ + ecore_xcb_pixmap.c \ + ecore_xcb_region.c \ + ecore_xcb_selection.c \ + ecore_xcb_textlist.c \ + ecore_xcb_events.c \ + ecore_xcb_keymap.c \ + ecore_xcb_netwm.c \ + ecore_xcb_icccm.c \ + ecore_xcb_window.c \ + ecore_xcb_window_prop.c \ + ecore_xcb_window_shape.c \ + ecore_xcb_window_shadow.c \ + ecore_xcb_xinerama.c \ + ecore_xcb_error.c \ + ecore_xcb_xtest.c \ + ecore_xcb_vsync.c \ + ecore_xcb_xdefaults.c + +libecore_x_xcb_la_LIBADD = \ + @XCB_DAMAGE_LIBS@ \ + @XCB_COMPOSITE_LIBS@ \ + @XCB_DPMS_LIBS@ \ + @XCB_RANDR_LIBS@ \ + @XCB_RENDER_LIBS@ \ + @XCB_SCREENSAVER_LIBS@ \ + @XCB_SHAPE_LIBS@ \ + @XCB_SYNC_LIBS@ \ + @XCB_XFIXES_LIBS@ \ + @XCB_XINERAMA_LIBS@ \ + @XCB_XPRINT_LIBS@ \ + @XCB_XTEST_LIBS@ \ + @XCB_XINPUT_LIBS@ \ + @XCB_XGESTURE_LIBS@ \ + @XCB_CURSOR_LIBS@ \ + @ECORE_XCB_LIBS@ \ + @PIXMAN_LIBS@ \ + $(top_builddir)/src/lib/ecore/libecore.la \ + $(top_builddir)/src/lib/ecore_input/libecore_input.la \ + @EINA_LIBS@ \ + @dlopen_libs@ + +endif + +EXTRA_DIST = ecore_xcb_private.h diff --git a/libraries/ecore/src/lib/ecore_x/xcb/Makefile.in b/libraries/ecore/src/lib/ecore_x/xcb/Makefile.in new file mode 100644 index 0000000..0213aea --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/Makefile.in @@ -0,0 +1,891 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_x/xcb +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +@BUILD_ECORE_X_XCB_TRUE@libecore_x_xcb_la_DEPENDENCIES = $(top_builddir)/src/lib/ecore/libecore.la \ +@BUILD_ECORE_X_XCB_TRUE@ $(top_builddir)/src/lib/ecore_input/libecore_input.la +am__libecore_x_xcb_la_SOURCES_DIST = ecore_xcb.c ecore_xcb_atoms.c \ + ecore_xcb_extensions.c ecore_xcb_shape.c \ + ecore_xcb_screensaver.c ecore_xcb_sync.c ecore_xcb_render.c \ + ecore_xcb_randr.c ecore_xcb_xfixes.c ecore_xcb_composite.c \ + ecore_xcb_cursor.c ecore_xcb_damage.c ecore_xcb_dnd.c \ + ecore_xcb_dpms.c ecore_xcb_drawable.c ecore_xcb_e.c \ + ecore_xcb_gc.c ecore_xcb_image.c ecore_xcb_input.c \ + ecore_xcb_gesture.c ecore_xcb_mwm.c ecore_xcb_pixmap.c \ + ecore_xcb_region.c ecore_xcb_selection.c ecore_xcb_textlist.c \ + ecore_xcb_events.c ecore_xcb_keymap.c ecore_xcb_netwm.c \ + ecore_xcb_icccm.c ecore_xcb_window.c ecore_xcb_window_prop.c \ + ecore_xcb_window_shape.c ecore_xcb_window_shadow.c \ + ecore_xcb_xinerama.c ecore_xcb_error.c ecore_xcb_xtest.c \ + ecore_xcb_vsync.c ecore_xcb_xdefaults.c +@BUILD_ECORE_X_XCB_TRUE@am_libecore_x_xcb_la_OBJECTS = ecore_xcb.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_atoms.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_extensions.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_shape.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_screensaver.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_sync.lo ecore_xcb_render.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_randr.lo ecore_xcb_xfixes.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_composite.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_cursor.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_damage.lo ecore_xcb_dnd.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_dpms.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_drawable.lo ecore_xcb_e.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_gc.lo ecore_xcb_image.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_input.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_gesture.lo ecore_xcb_mwm.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_pixmap.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_region.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_selection.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_textlist.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_events.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_keymap.lo ecore_xcb_netwm.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_icccm.lo ecore_xcb_window.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_window_prop.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_window_shape.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_window_shadow.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_xinerama.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_error.lo ecore_xcb_xtest.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_vsync.lo \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_xdefaults.lo +libecore_x_xcb_la_OBJECTS = $(am_libecore_x_xcb_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +@BUILD_ECORE_X_XCB_TRUE@am_libecore_x_xcb_la_rpath = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_x_xcb_la_SOURCES) +DIST_SOURCES = $(am__libecore_x_xcb_la_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in ecore_xcb_keysym_table.h +@BUILD_ECORE_X_XCB_TRUE@AM_CPPFLAGS = \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_DAMAGE_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_COMPOSITE_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_DPMS_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_RANDR_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_RENDER_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_SCREENSAVER_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_SHAPE_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_SYNC_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_XFIXES_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_XINERAMA_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_XPRINT_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_XTEST_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_XINPUT_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_XGESTURE_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_CURSOR_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @ECORE_XCB_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @PIXMAN_CFLAGS@ \ +@BUILD_ECORE_X_XCB_TRUE@ -I$(top_srcdir)/src/lib/ecore \ +@BUILD_ECORE_X_XCB_TRUE@ -I$(top_srcdir)/src/lib/ecore_x \ +@BUILD_ECORE_X_XCB_TRUE@ -I$(top_srcdir)/src/lib/ecore_input \ +@BUILD_ECORE_X_XCB_TRUE@ -I$(top_builddir)/src/lib/ecore \ +@BUILD_ECORE_X_XCB_TRUE@ -I$(top_builddir)/src/lib/ecore_x \ +@BUILD_ECORE_X_XCB_TRUE@ -I$(top_builddir)/src/lib/ecore_input \ +@BUILD_ECORE_X_XCB_TRUE@ @EINA_CFLAGS@ + +@BUILD_ECORE_X_XCB_TRUE@noinst_LTLIBRARIES = libecore_x_xcb.la +@BUILD_ECORE_X_XCB_TRUE@libecore_x_xcb_la_SOURCES = \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_atoms.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_extensions.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_shape.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_screensaver.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_sync.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_render.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_randr.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_xfixes.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_composite.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_cursor.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_damage.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_dnd.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_dpms.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_drawable.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_e.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_gc.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_image.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_input.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_gesture.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_mwm.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_pixmap.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_region.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_selection.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_textlist.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_events.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_keymap.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_netwm.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_icccm.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_window.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_window_prop.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_window_shape.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_window_shadow.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_xinerama.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_error.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_xtest.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_vsync.c \ +@BUILD_ECORE_X_XCB_TRUE@ ecore_xcb_xdefaults.c + +@BUILD_ECORE_X_XCB_TRUE@libecore_x_xcb_la_LIBADD = \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_DAMAGE_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_COMPOSITE_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_DPMS_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_RANDR_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_RENDER_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_SCREENSAVER_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_SHAPE_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_SYNC_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_XFIXES_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_XINERAMA_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_XPRINT_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_XTEST_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_XINPUT_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_XGESTURE_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @XCB_CURSOR_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @ECORE_XCB_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @PIXMAN_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ $(top_builddir)/src/lib/ecore/libecore.la \ +@BUILD_ECORE_X_XCB_TRUE@ $(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@BUILD_ECORE_X_XCB_TRUE@ @EINA_LIBS@ \ +@BUILD_ECORE_X_XCB_TRUE@ @dlopen_libs@ + +EXTRA_DIST = ecore_xcb_private.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_x/xcb/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_x/xcb/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_x_xcb.la: $(libecore_x_xcb_la_OBJECTS) $(libecore_x_xcb_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(am_libecore_x_xcb_la_rpath) $(libecore_x_xcb_la_OBJECTS) $(libecore_x_xcb_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_atoms.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_composite.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_cursor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_damage.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_dnd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_dpms.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_drawable.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_e.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_error.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_events.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_extensions.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_gc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_gesture.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_icccm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_image.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_input.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_keymap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_mwm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_netwm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_pixmap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_randr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_region.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_render.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_screensaver.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_selection.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_shape.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_sync.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_textlist.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_vsync.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_window.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_window_prop.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_window_shadow.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_window_shape.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_xdefaults.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_xfixes.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_xinerama.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_xcb_xtest.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb.c new file mode 100644 index 0000000..ca7e798 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb.c @@ -0,0 +1,1470 @@ +#include "ecore_xcb_private.h" +#include +#include + +/* local function prototypes */ +static int _ecore_xcb_shutdown(Eina_Bool close_display); +static Eina_Bool _ecore_xcb_fd_handle(void *data, Ecore_Fd_Handler *hdlr __UNUSED__); +static Eina_Bool _ecore_xcb_fd_handle_buff(void *data, Ecore_Fd_Handler *hdlr __UNUSED__); +static Eina_Bool _ecore_xcb_idle_enter(void *data __UNUSED__); + +/* local variables */ +static int _ecore_xcb_init_count = 0; +static int _ecore_xcb_grab_count = 0; +static Ecore_Fd_Handler *_ecore_xcb_fd_handler = NULL; +static xcb_generic_event_t *_ecore_xcb_event_buffered = NULL; +static Ecore_Idle_Enterer *_ecore_xcb_idle_enterer = NULL; + +/* external variables */ +int _ecore_xcb_log_dom = -1; +Ecore_X_Display *_ecore_xcb_display = NULL; +Ecore_X_Connection *_ecore_xcb_conn = NULL; +Ecore_X_Screen *_ecore_xcb_screen = NULL; +Ecore_X_Atom _ecore_xcb_atoms_wm_protocol[ECORE_X_WM_PROTOCOL_NUM]; +double _ecore_xcb_double_click_time = 0.25; + +/** + * @defgroup Ecore_X_Init_Group X Library Init and Shutdown Functions + * + * Functions that start and shut down the Ecore X Library. + */ + +/** + * Initialize the X display connection to the given display. + * + * @param name Display target name. If @c NULL, the default display is + * assumed. + * @return The number of times the library has been initialized without + * being shut down. 0 is returned if an error occurs. + * @ingroup Ecore_X_Init_Group + */ +EAPI int +ecore_x_init(const char *name) +{ + char *gl = NULL; + uint32_t mask, list[1]; + + /* check if we have initialized already */ + if (++_ecore_xcb_init_count != 1) + return _ecore_xcb_init_count; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + /* try to initialize eina */ + if (!eina_init()) return --_ecore_xcb_init_count; + + /* setup ecore_xcb log domain */ + _ecore_xcb_log_dom = + eina_log_domain_register("ecore_x", ECORE_XCB_DEFAULT_LOG_COLOR); + if (_ecore_xcb_log_dom < 0) + { + EINA_LOG_ERR("Cannot create Ecore Xcb log domain"); + eina_shutdown(); + return --_ecore_xcb_init_count; + } + + /* try to initialize ecore */ + if (!ecore_init()) + { + /* unregister log domain */ + eina_log_domain_unregister(_ecore_xcb_log_dom); + _ecore_xcb_log_dom = -1; + eina_shutdown(); + return --_ecore_xcb_init_count; + } + + /* try to initialize ecore_event */ + if (!ecore_event_init()) + { + /* unregister log domain */ + eina_log_domain_unregister(_ecore_xcb_log_dom); + _ecore_xcb_log_dom = -1; + ecore_shutdown(); + eina_shutdown(); + return --_ecore_xcb_init_count; + } + + /* NB: XLib has XInitThreads */ + + /* check for env var which says we are not going to use GL @ all + * + * NB: This is done because if someone wants a 'pure' xcb implementation + * of ecore_x, all they need do is export this variable in the environment + * and ecore_x will not use xlib stuff at all. + * + * The upside is you can get pure xcb-based ecore_x (w/ all the speed), but + * there is a down-side here in that you cannot get OpenGL without XLib :( + */ + if ((gl = getenv("ECORE_X_NO_XLIB"))) + { + /* we found the env var that says 'Yes, we are not ever gonna try + * OpenGL so it is safe to not use XLib at all' */ + + /* try to connect to the display server */ + _ecore_xcb_conn = xcb_connect(name, NULL); + } + else + { + /* env var was not specified, so we will assume that the user + * may want opengl @ some point. connect this way for opengl to work */ + void *libxcb, *libxlib; + Display *(*_real_display)(const char *display); + xcb_connection_t *(*_real_connection)(Display * dpy); + void (*_real_queue)(Display *dpy, enum XEventQueueOwner owner); + int (*_real_close)(Display *dpy); +#ifdef EVAS_FRAME_QUEUING + Status (*_real_threads)(void); +#endif + + /* want to dlopen here to avoid actual library linkage */ + libxlib = dlopen("libX11.so", (RTLD_LAZY | RTLD_GLOBAL)); + if (!libxlib) + libxlib = dlopen("libX11.so.6", (RTLD_LAZY | RTLD_GLOBAL)); + if (!libxlib) + libxlib = dlopen("libX11.so.6.3.0", (RTLD_LAZY | RTLD_GLOBAL)); + if (!libxlib) + { + ERR("Could not dlsym to libX11"); + /* unregister log domain */ + eina_log_domain_unregister(_ecore_xcb_log_dom); + _ecore_xcb_log_dom = -1; + ecore_event_shutdown(); + ecore_shutdown(); + eina_shutdown(); + return --_ecore_xcb_init_count; + } + + libxcb = dlopen("libX11-xcb.so", (RTLD_LAZY | RTLD_GLOBAL)); + if (!libxcb) + libxcb = dlopen("libX11-xcb.so.1", (RTLD_LAZY | RTLD_GLOBAL)); + if (!libxcb) + libxcb = dlopen("libX11-xcb.so.1.0.0", (RTLD_LAZY | RTLD_GLOBAL)); + if (!libxcb) + { + ERR("Could not dlsym to libX11-xcb"); + /* unregister log domain */ + eina_log_domain_unregister(_ecore_xcb_log_dom); + _ecore_xcb_log_dom = -1; + ecore_event_shutdown(); + ecore_shutdown(); + eina_shutdown(); + return --_ecore_xcb_init_count; + } + + _real_display = dlsym(libxlib, "XOpenDisplay"); + _real_close = dlsym(libxlib, "XCloseDisplay"); + _real_connection = dlsym(libxcb, "XGetXCBConnection"); + _real_queue = dlsym(libxcb, "XSetEventQueueOwner"); +#ifdef EVAS_FRAME_QUEUING + _real_threads = dlsym(libxlib, "XInitThreads"); +#endif + + if (_real_display) + { +#ifdef EVAS_FRAME_QUEUING + if (_real_threads) _real_threads(); +#endif + _ecore_xcb_display = _real_display(name); + if (!_ecore_xcb_display) + { + ERR("Could not open Display via XLib"); + /* unregister log domain */ + eina_log_domain_unregister(_ecore_xcb_log_dom); + _ecore_xcb_log_dom = -1; + ecore_event_shutdown(); + ecore_shutdown(); + eina_shutdown(); + return --_ecore_xcb_init_count; + } + if (_real_connection) + _ecore_xcb_conn = _real_connection(_ecore_xcb_display); + if (!_ecore_xcb_conn) + { + ERR("Could not get XCB Connection from XLib"); + + if (_real_close) _real_close(_ecore_xcb_display); + + /* unregister log domain */ + eina_log_domain_unregister(_ecore_xcb_log_dom); + _ecore_xcb_log_dom = -1; + ecore_event_shutdown(); + ecore_shutdown(); + eina_shutdown(); + return --_ecore_xcb_init_count; + } + if (_real_queue) + _real_queue(_ecore_xcb_display, XCBOwnsEventQueue); + } + } + + if (xcb_connection_has_error(_ecore_xcb_conn)) + { + CRIT("XCB Connection has error"); + eina_log_domain_unregister(_ecore_xcb_log_dom); + _ecore_xcb_log_dom = -1; + ecore_event_shutdown(); + ecore_shutdown(); + eina_shutdown(); + return --_ecore_xcb_init_count; + } + + /* grab the default screen */ + _ecore_xcb_screen = + xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).data; + + /* NB: This method of init/finalize extensions first, then atoms + * Does end up being 2 round trips to X, BUT if we do extensions init then + * atoms init first, and call the 'finalize' functions later, we end up + * being slower, so it's a trade-off. This current method clocks in + * around 0.003 for fetching atoms VS 0.010 for init both then finalize */ + + /* prefetch extension data */ + _ecore_xcb_extensions_init(); + + /* finalize extensions */ + _ecore_xcb_extensions_finalize(); + + /* set keyboard autorepeat */ + mask = XCB_KB_AUTO_REPEAT_MODE; + list[0] = XCB_AUTO_REPEAT_MODE_ON; + xcb_change_keyboard_control(_ecore_xcb_conn, mask, list); + + /* setup xcb events */ + _ecore_xcb_events_init(); + + /* setup xcb keymasks */ + _ecore_xcb_keymap_init(); + + /* finalize xcb keymasks */ + _ecore_xcb_keymap_finalize(); + + /* setup ecore fd handler */ + _ecore_xcb_fd_handler = + ecore_main_fd_handler_add(xcb_get_file_descriptor(_ecore_xcb_conn), + ECORE_FD_READ, _ecore_xcb_fd_handle, + _ecore_xcb_conn, _ecore_xcb_fd_handle_buff, + _ecore_xcb_conn); + + if (!_ecore_xcb_fd_handler) + return _ecore_xcb_shutdown(EINA_TRUE); + + /* prefetch atoms */ + _ecore_xcb_atoms_init(); + + /* finalize atoms */ + _ecore_xcb_atoms_finalize(); + + /* icccm_init: dummy function */ + ecore_x_icccm_init(); + + /* setup netwm */ + ecore_x_netwm_init(); + + /* old e hints init: dummy function */ + ecore_x_e_init(); + + _ecore_xcb_atoms_wm_protocol[ECORE_X_WM_PROTOCOL_DELETE_REQUEST] = + ECORE_X_ATOM_WM_DELETE_WINDOW; + _ecore_xcb_atoms_wm_protocol[ECORE_X_WM_PROTOCOL_TAKE_FOCUS] = + ECORE_X_ATOM_WM_TAKE_FOCUS; + _ecore_xcb_atoms_wm_protocol[ECORE_X_NET_WM_PROTOCOL_PING] = + ECORE_X_ATOM_NET_WM_PING; + _ecore_xcb_atoms_wm_protocol[ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST] = + ECORE_X_ATOM_NET_WM_SYNC_REQUEST; + + /* setup selection */ + _ecore_xcb_selection_init(); + + /* setup dnd */ + _ecore_xcb_dnd_init(); + + _ecore_xcb_idle_enterer = + ecore_idle_enterer_add(_ecore_xcb_idle_enter, NULL); + + return _ecore_xcb_init_count; +} + +/** + * Shuts down the Ecore X library. + * + * In shutting down the library, the X display connection is terminated + * and any event handlers for it are removed. + * + * @return The number of times the library has been initialized without + * being shut down. + * @ingroup Ecore_X_Init_Group + */ +EAPI int +ecore_x_shutdown(void) +{ + return _ecore_xcb_shutdown(EINA_TRUE); +} + +/** + * Shuts down the Ecore X library. + * + * As ecore_x_shutdown, except do not close Display, only connection. + * + * @ingroup Ecore_X_Init_Group + */ +EAPI int +ecore_x_disconnect(void) +{ + return _ecore_xcb_shutdown(EINA_FALSE); +} + +/** + * @defgroup Ecore_X_Flush_Group X Synchronization Functions + * + * Functions that ensure that all commands that have been issued by the + * Ecore X library have been sent to the server. + */ + +/** + * Sends all X commands in the X Display buffer. + * @ingroup Ecore_X_Flush_Group + */ +EAPI void +ecore_x_flush(void) +{ +// LOGFN(__FILE__, __LINE__, __FUNCTION__); + + CHECK_XCB_CONN; + xcb_flush(_ecore_xcb_conn); +} + +/** + * Retrieves the Ecore_X_Screen handle used for the current X connection. + * @return The current default screen. + * @ingroup Ecore_X_Display_Attr_Group + */ +EAPI Ecore_X_Screen * +ecore_x_default_screen_get(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return (Ecore_X_Screen *)_ecore_xcb_screen; +} + +EAPI Ecore_X_Connection * +ecore_x_connection_get(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + CHECK_XCB_CONN; + return (Ecore_X_Connection *)_ecore_xcb_conn; +} + +/** + * Return the last event time + */ +EAPI Ecore_X_Time +ecore_x_current_time_get(void) +{ + return _ecore_xcb_events_last_time_get(); +} + +/** + * Flushes the command buffer and waits until all requests have been + * processed by the server. + * @ingroup Ecore_X_Flush_Group + */ +EAPI void +ecore_x_sync(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + CHECK_XCB_CONN; + free(xcb_get_input_focus_reply(_ecore_xcb_conn, + xcb_get_input_focus_unchecked(_ecore_xcb_conn), + NULL)); +} + +EAPI void +ecore_x_grab(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + CHECK_XCB_CONN; + _ecore_xcb_grab_count++; + if (_ecore_xcb_grab_count == 1) + xcb_grab_server(_ecore_xcb_conn); +} + +EAPI void +ecore_x_ungrab(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + CHECK_XCB_CONN; + _ecore_xcb_grab_count--; + if (_ecore_xcb_grab_count < 0) _ecore_xcb_grab_count = 0; + if (_ecore_xcb_grab_count == 0) + xcb_ungrab_server(_ecore_xcb_conn); +} + +/** + * Send client message with given type and format 32. + * + * @param win The window the message is sent to. + * @param type The client message type. + * @param d0 The client message data item 1 + * @param d1 The client message data item 2 + * @param d2 The client message data item 3 + * @param d3 The client message data item 4 + * @param d4 The client message data item 5 + * + * @return EINA_TRUE on success EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_x_client_message32_send(Ecore_X_Window win, Ecore_X_Atom type, + Ecore_X_Event_Mask mask, + long d0, long d1, long d2, long d3, long d4) +{ + xcb_client_message_event_t ev; + xcb_void_cookie_t cookie; + xcb_generic_error_t *err; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = type; + ev.data.data32[0] = (uint32_t)d0; + ev.data.data32[1] = (uint32_t)d1; + ev.data.data32[2] = (uint32_t)d2; + ev.data.data32[3] = (uint32_t)d3; + ev.data.data32[4] = (uint32_t)d4; + + cookie = xcb_send_event(_ecore_xcb_conn, 0, win, mask, (const char *)&ev); + + err = xcb_request_check(_ecore_xcb_conn, cookie); + if (err) + { + DBG("Problem Sending Event"); + DBG("\tType: %d", type); + DBG("\tWin: %d", win); + _ecore_xcb_error_handle(err); + free(err); + return EINA_FALSE; + } + + return EINA_TRUE; +} + +/** + * Send client message with given type and format 8. + * + * @param win The window the message is sent to. + * @param type The client message type. + * @param data Data to be sent. + * @param len Number of data bytes, max 20. + * + * @return EINA_TRUE on success EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_x_client_message8_send(Ecore_X_Window win, Ecore_X_Atom type, + const void *data, int len) +{ + xcb_client_message_event_t ev; + xcb_void_cookie_t cookie; + xcb_generic_error_t *err; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 8; + ev.window = win; + ev.type = type; + if (len > 20) len = 20; + memcpy(ev.data.data8, data, len); + memset(ev.data.data8 + len, 0, 20 - len); + + cookie = xcb_send_event(_ecore_xcb_conn, 0, win, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); + + err = xcb_request_check(_ecore_xcb_conn, cookie); + if (err) + { + DBG("Problem Sending Event"); + DBG("\tType: %d", type); + DBG("\tWin: %d", win); + _ecore_xcb_error_handle(err); + free(err); + return EINA_FALSE; + } + + return EINA_TRUE; +} + +EAPI Eina_Bool +ecore_x_mouse_down_send(Ecore_X_Window win, int x, int y, int b) +{ + xcb_translate_coordinates_cookie_t cookie; + xcb_translate_coordinates_reply_t *reply; + xcb_button_press_event_t ev; + xcb_void_cookie_t vcookie; + xcb_generic_error_t *err; + Ecore_X_Window root = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + root = ecore_x_window_root_get(win); + cookie = xcb_translate_coordinates(_ecore_xcb_conn, win, root, x, y); + reply = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + + memset(&ev, 0, sizeof(xcb_button_press_event_t)); + + ev.response_type = XCB_BUTTON_PRESS; + ev.event = win; + ev.child = win; + ev.root = root; + ev.event_x = x; + ev.event_y = y; + ev.same_screen = 1; + ev.state = 1 << b; + ev.detail = b; // xcb uses detail for button + ev.root_x = reply->dst_x; + ev.root_y = reply->dst_y; + ev.time = ecore_x_current_time_get(); + free(reply); + + vcookie = xcb_send_event(_ecore_xcb_conn, 1, win, + XCB_EVENT_MASK_BUTTON_PRESS, (const char *)&ev); + + err = xcb_request_check(_ecore_xcb_conn, vcookie); + if (err) + { + _ecore_xcb_error_handle(err); + free(err); + return EINA_FALSE; + } + + return EINA_TRUE; +} + +EAPI Eina_Bool +ecore_x_mouse_up_send(Ecore_X_Window win, int x, int y, int b) +{ + xcb_translate_coordinates_cookie_t cookie; + xcb_translate_coordinates_reply_t *reply; + xcb_button_release_event_t ev; + xcb_void_cookie_t vcookie; + xcb_generic_error_t *err; + Ecore_X_Window root = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + root = ecore_x_window_root_get(win); + cookie = xcb_translate_coordinates(_ecore_xcb_conn, win, root, x, y); + reply = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + + memset(&ev, 0, sizeof(xcb_button_release_event_t)); + + ev.response_type = XCB_BUTTON_RELEASE; + ev.event = win; + ev.child = win; + ev.root = root; + ev.event_x = x; + ev.event_y = y; + ev.same_screen = 1; + ev.state = 0; + ev.root_x = reply->dst_x; + ev.root_y = reply->dst_y; + ev.detail = b; // xcb uses detail for button + ev.time = ecore_x_current_time_get(); + free(reply); + + vcookie = xcb_send_event(_ecore_xcb_conn, 1, win, + XCB_EVENT_MASK_BUTTON_RELEASE, (const char *)&ev); + + err = xcb_request_check(_ecore_xcb_conn, vcookie); + if (err) + { + _ecore_xcb_error_handle(err); + free(err); + return EINA_FALSE; + } + + return EINA_TRUE; +} + +EAPI Eina_Bool +ecore_x_mouse_move_send(Ecore_X_Window win, int x, int y) +{ + xcb_translate_coordinates_cookie_t cookie; + xcb_translate_coordinates_reply_t *reply; + xcb_motion_notify_event_t ev; + xcb_void_cookie_t vcookie; + xcb_generic_error_t *err; + Ecore_X_Window root = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + root = ecore_x_window_root_get(win); + cookie = xcb_translate_coordinates(_ecore_xcb_conn, win, root, x, y); + reply = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + + memset(&ev, 0, sizeof(xcb_motion_notify_event_t)); + + ev.response_type = XCB_MOTION_NOTIFY; + ev.event = win; + ev.child = win; + ev.root = root; + ev.event_x = x; + ev.event_y = y; + ev.same_screen = 1; + ev.state = 0; + ev.detail = 0; // xcb uses 'detail' for is_hint + ev.root_x = reply->dst_x; + ev.root_y = reply->dst_y; + ev.time = ecore_x_current_time_get(); + free(reply); + + vcookie = xcb_send_event(_ecore_xcb_conn, 1, win, + XCB_EVENT_MASK_POINTER_MOTION, (const char *)&ev); + + err = xcb_request_check(_ecore_xcb_conn, vcookie); + if (err) + { + _ecore_xcb_error_handle(err); + free(err); + return EINA_FALSE; + } + + return EINA_TRUE; +} + +EAPI Eina_Bool +ecore_x_keyboard_grab(Ecore_X_Window win) +{ + xcb_grab_keyboard_cookie_t cookie; + xcb_grab_keyboard_reply_t *reply; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = + xcb_grab_keyboard_unchecked(_ecore_xcb_conn, 0, win, XCB_CURRENT_TIME, + XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC); + reply = xcb_grab_keyboard_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + free(reply); + return EINA_TRUE; +} + +EAPI void +ecore_x_keyboard_ungrab(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_ungrab_keyboard(_ecore_xcb_conn, XCB_CURRENT_TIME); +} + +EAPI void +ecore_x_pointer_xy_get(Ecore_X_Window win, int *x, int *y) +{ + xcb_query_pointer_cookie_t cookie; + xcb_query_pointer_reply_t *reply; + +// LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +// if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + if (x) *x = -1; + if (y) *y = -1; + + cookie = xcb_query_pointer_unchecked(_ecore_xcb_conn, win); + reply = xcb_query_pointer_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return; + if (x) *x = reply->win_x; + if (y) *y = reply->win_y; + free(reply); +} + +EAPI Eina_Bool +ecore_x_pointer_control_set(int accel_num, int accel_denom, int threshold) +{ + xcb_void_cookie_t vcookie; + xcb_generic_error_t *err; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + vcookie = + xcb_change_pointer_control(_ecore_xcb_conn, + accel_num, accel_denom, threshold, 1, 1); + err = xcb_request_check(_ecore_xcb_conn, vcookie); + if (err) + { + _ecore_xcb_error_handle(err); + free(err); + return EINA_FALSE; + } + + return EINA_TRUE; +} + +EAPI Eina_Bool +ecore_x_pointer_control_get(int *accel_num, int *accel_denom, int *threshold) +{ + xcb_get_pointer_control_cookie_t cookie; + xcb_get_pointer_control_reply_t *reply; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (accel_num) *accel_num = 0; + if (accel_denom) *accel_denom = 0; + if (threshold) *threshold = 0; + + cookie = xcb_get_pointer_control_unchecked(_ecore_xcb_conn); + reply = xcb_get_pointer_control_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + + if (accel_num) *accel_num = reply->acceleration_numerator; + if (accel_denom) *accel_denom = reply->acceleration_denominator; + if (threshold) *threshold = reply->threshold; + free(reply); + + return EINA_TRUE; +} + +EAPI Eina_Bool +ecore_x_pointer_mapping_set(unsigned char *map, int nmap) +{ + xcb_set_pointer_mapping_cookie_t cookie; + xcb_set_pointer_mapping_reply_t *reply; + Eina_Bool ret = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = xcb_set_pointer_mapping_unchecked(_ecore_xcb_conn, nmap, map); + reply = xcb_set_pointer_mapping_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + ret = + (reply->status == XCB_MAPPING_STATUS_SUCCESS) ? EINA_TRUE : EINA_FALSE; + + free(reply); + return ret; +} + +EAPI Eina_Bool +ecore_x_pointer_mapping_get(unsigned char *map, int nmap) +{ + xcb_get_pointer_mapping_cookie_t cookie; + xcb_get_pointer_mapping_reply_t *reply; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (map) *map = 0; + nmap = 0; + + cookie = xcb_get_pointer_mapping_unchecked(_ecore_xcb_conn); + reply = xcb_get_pointer_mapping_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + + nmap = xcb_get_pointer_mapping_map_length(reply); + if (nmap <= 0) + { + free(reply); + return EINA_FALSE; + } + + if (map) + { + uint8_t *tmp; + int i = 0; + + tmp = xcb_get_pointer_mapping_map(reply); + for (i = 0; i < nmap; i++) + map[i] = tmp[i]; + } + + free(reply); + return EINA_TRUE; +} + +EAPI Eina_Bool +ecore_x_pointer_grab(Ecore_X_Window win) +{ + xcb_grab_pointer_cookie_t cookie; + xcb_grab_pointer_reply_t *reply; + uint16_t mask; + Eina_Bool ret = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + mask = (XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | + XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | + XCB_EVENT_MASK_POINTER_MOTION); + + cookie = xcb_grab_pointer_unchecked(_ecore_xcb_conn, 0, win, mask, + XCB_GRAB_MODE_ASYNC, + XCB_GRAB_MODE_ASYNC, + XCB_NONE, XCB_NONE, XCB_CURRENT_TIME); + reply = xcb_grab_pointer_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + + ret = (reply->status == XCB_GRAB_STATUS_SUCCESS) ? EINA_TRUE : EINA_FALSE; + + free(reply); + return ret; +} + +EAPI Eina_Bool +ecore_x_pointer_confine_grab(Ecore_X_Window win) +{ + xcb_grab_pointer_cookie_t cookie; + xcb_grab_pointer_reply_t *reply; + uint16_t mask; + Eina_Bool ret = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + mask = (XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | + XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | + XCB_EVENT_MASK_POINTER_MOTION); + + cookie = xcb_grab_pointer_unchecked(_ecore_xcb_conn, 0, win, mask, + XCB_GRAB_MODE_ASYNC, + XCB_GRAB_MODE_ASYNC, + win, XCB_NONE, XCB_CURRENT_TIME); + reply = xcb_grab_pointer_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + + ret = (reply->status == XCB_GRAB_STATUS_SUCCESS) ? EINA_TRUE : EINA_FALSE; + + free(reply); + return ret; +} + +EAPI void +ecore_x_pointer_ungrab(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_ungrab_pointer(_ecore_xcb_conn, XCB_CURRENT_TIME); +} + +EAPI Eina_Bool +ecore_x_pointer_warp(Ecore_X_Window win, int x, int y) +{ + xcb_void_cookie_t vcookie; + xcb_generic_error_t *err; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + vcookie = + xcb_warp_pointer_checked(_ecore_xcb_conn, XCB_NONE, win, 0, 0, 0, 0, x, y); + err = xcb_request_check(_ecore_xcb_conn, vcookie); + if (err) + { + _ecore_xcb_error_handle(err); + free(err); + return EINA_FALSE; + } + + return EINA_TRUE; +} + +/** + * Invoke the standard system beep to alert users + * + * @param percent The volume at which the bell rings. Must be in the range + * [-100,+100]. If percent >= 0, the final volume will be: + * base - [(base * percent) / 100] + percent + * Otherwise, it's calculated as: + * base + [(base * percent) / 100] + * where @c base is the bell's base volume as set by XChangeKeyboardControl(3). + * + * @returns EINA_TRUE on success, EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_x_bell(int percent) +{ + xcb_void_cookie_t cookie; + xcb_generic_error_t *err; + + CHECK_XCB_CONN; + + // FIXME: Use unchecked version after development is ironed out + cookie = xcb_bell_checked(_ecore_xcb_conn, percent); + err = xcb_request_check(_ecore_xcb_conn, cookie); + if (err) + { + _ecore_xcb_error_handle(err); + free(err); + return EINA_FALSE; + } + + return EINA_TRUE; +} + +EAPI void +ecore_x_display_size_get(Ecore_X_Display *dsp __UNUSED__, int *w, int *h) +{ + xcb_screen_t *screen; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + /* grab the default screen */ + screen = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).data; + if (w) *w = screen->width_in_pixels; + if (h) *h = screen->height_in_pixels; +} + +EAPI unsigned long +ecore_x_display_black_pixel_get(Ecore_X_Display *dsp __UNUSED__) +{ + xcb_screen_t *screen; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + /* grab the default screen */ + screen = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).data; + return screen->black_pixel; +} + +EAPI unsigned long +ecore_x_display_white_pixel_get(Ecore_X_Display *dsp __UNUSED__) +{ + xcb_screen_t *screen; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + /* grab the default screen */ + screen = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).data; + return screen->white_pixel; +} + +EAPI void +ecore_x_pointer_last_xy_get(int *x, int *y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (x) *x = _ecore_xcb_event_last_root_x; + if (y) *y = _ecore_xcb_event_last_root_y; +} + +EAPI void +ecore_x_focus_reset(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_set_input_focus(_ecore_xcb_conn, XCB_INPUT_FOCUS_POINTER_ROOT, + ((xcb_screen_t *)_ecore_xcb_screen)->root, + XCB_CURRENT_TIME); +// ecore_x_flush(); +} + +EAPI void +ecore_x_events_allow_all(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_allow_events(_ecore_xcb_conn, XCB_ALLOW_ASYNC_BOTH, XCB_CURRENT_TIME); +// ecore_x_flush(); +} + +/** + * Kill a specific client + * + * You can kill a specific client owning window @p win + * + * @param win Window of the client to be killed + */ +EAPI void +ecore_x_kill(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_kill_client(_ecore_xcb_conn, win); +// ecore_x_flush(); +} + +/** + * Kill all clients with subwindows under a given window. + * + * You can kill all clients connected to the X server by using + * @ref ecore_x_window_root_list to get a list of root windows, and + * then passing each root window to this function. + * + * @param root The window whose children will be killed. + */ +EAPI void +ecore_x_killall(Ecore_X_Window root) +{ + int screens = 0, i = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + ecore_x_grab(); + + screens = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).rem; + + /* Traverse window tree starting from root, and drag each + * before the firing squad */ + for (i = 0; i < screens; ++i) + { + xcb_query_tree_cookie_t cookie; + xcb_query_tree_reply_t *reply; + + cookie = xcb_query_tree_unchecked(_ecore_xcb_conn, root); + reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + xcb_window_t *wins = NULL; + int tree_c_len, j = 0; + + wins = xcb_query_tree_children(reply); + tree_c_len = xcb_query_tree_children_length(reply); + for (j = 0; j < tree_c_len; j++) + xcb_kill_client(_ecore_xcb_conn, wins[j]); + free(reply); + } + } + + ecore_x_ungrab(); + ecore_x_sync(); // needed +} + +/** + * Return the screen DPI + * + * This is a simplistic call to get DPI. It does not account for differing + * DPI in the x amd y axes nor does it account for multihead or xinerama and + * xrander where different parts of the screen may have differen DPI etc. + * + * @return the general screen DPI (dots/pixels per inch). + */ +EAPI int +ecore_x_dpi_get(void) +{ + uint16_t mw = 0, w = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + mw = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_millimeters; + if (mw <= 0) return 75; + w = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels; + return (((w * 254) / mw) + 5) / 10; +} + +/** + * @defgroup Ecore_X_Display_Attr_Group X Display Attributes + * + * Functions that set and retrieve X display attributes. + */ + +/** + * Retrieves the Ecore_X_Display handle used for the current X connection. + * @return The current X display. + * @ingroup Ecore_X_Display_Attr_Group + */ +EAPI Ecore_X_Display * +ecore_x_display_get(void) +{ + char *gl = NULL; + + CHECK_XCB_CONN; + + /* if we have the 'dont use xlib' env var, then we are not using + * XLib and thus cannot return a real XDisplay. + * + * NB: This may break EFL in some places and needs lots of testing !!! */ + if ((gl = getenv("ECORE_X_NO_XLIB"))) + return (Ecore_X_Display *)_ecore_xcb_conn; + else /* we can safely return an XDisplay var */ + return (Ecore_X_Display *)_ecore_xcb_display; +} + +/** + * Retrieves the X display file descriptor. + * @return The current X display file descriptor. + * @ingroup Ecore_X_Display_Attr_Group + */ +EAPI int +ecore_x_fd_get(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + return xcb_get_file_descriptor(_ecore_xcb_conn); +} + +EAPI void +ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data, int type, void *event), + void *data) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_xcb_window_grab_replay_func = func; + _ecore_xcb_window_grab_replay_data = data; +} + +/** + * Retrieves the size of an Ecore_X_Screen. + * @param screen the handle to the screen to query. + * @param w where to return the width. May be NULL. Returns 0 on errors. + * @param h where to return the height. May be NULL. Returns 0 on errors. + * @ingroup Ecore_X_Display_Attr_Group + * @see ecore_x_default_screen_get() + * + * @since 1.1 + */ +EAPI void +ecore_x_screen_size_get(const Ecore_X_Screen *screen, int *w, int *h) +{ + xcb_screen_t *s; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (w) *w = 0; + if (h) *h = 0; + if (!(s = (xcb_screen_t *)screen)) return; + if (w) *w = s->width_in_pixels; + if (h) *h = s->height_in_pixels; +} + +/** + * Retrieves the count of screens. + * + * @return The count of screens. + * @ingroup Ecore_X_Display_Attr_Group + * + * @since 1.1 + */ +EAPI int +ecore_x_screen_count_get(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + return xcb_setup_roots_length(xcb_get_setup(_ecore_xcb_conn)); +} + +/** + * Retrieves the index number of the given screen. + * + * @return The index number of the screen. + * @ingroup Ecore_X_Display_Attr_Group + * + * @since 1.1 + */ +EAPI int +ecore_x_screen_index_get(const Ecore_X_Screen *screen) +{ + xcb_screen_iterator_t iter; + int i = 0; + + CHECK_XCB_CONN; + + iter = + xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)); + for (; iter.rem; xcb_screen_next(&iter)) + { + if (iter.data == (xcb_screen_t *)screen) + return i; + i++; + } + + return 0; +} + +/** + * Retrieves the screen based on index number. + * + * @return The Ecore_X_Screen at this index. + * @ingroup Ecore_X_Display_Attr_Group + * + * @since 1.1 + */ +EAPI Ecore_X_Screen * +ecore_x_screen_get(int index) +{ + xcb_screen_iterator_t iter; + int i = 0; + + CHECK_XCB_CONN; + + iter = + xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)); + for (i = 0; iter.rem; xcb_screen_next(&iter), i++) + if (i == index) return iter.data; + + return NULL; +} + +EAPI unsigned int +ecore_x_visual_id_get(Ecore_X_Visual visual) +{ + return ((xcb_visualtype_t *)visual)->visual_id; +} + +/** + * Retrieve the default Visual. + * + * @param disp The Display to get the Default Visual from + * @param screen The Screen. + * + * @return The default visual. + * @since 1.1.0 + */ +EAPI Ecore_X_Visual +ecore_x_default_visual_get(Ecore_X_Display *disp __UNUSED__, Ecore_X_Screen *screen) +{ + xcb_screen_t *s; + xcb_depth_iterator_t diter; + xcb_visualtype_iterator_t viter; + + CHECK_XCB_CONN; + + s = (xcb_screen_t *)screen; + diter = xcb_screen_allowed_depths_iterator(s); + for (; diter.rem; xcb_depth_next(&diter)) + { + viter = xcb_depth_visuals_iterator(diter.data); + for (; viter.rem; xcb_visualtype_next(&viter)) + { + if (viter.data->visual_id == s->root_visual) + return viter.data; + } + } + return 0; +} + +/** + * Retrieve the default Colormap. + * + * @param disp The Display to get the Default Colormap from + * @param screen The Screen. + * + * @return The default colormap. + * @since 1.1.0 + */ +EAPI Ecore_X_Colormap +ecore_x_default_colormap_get(Ecore_X_Display *disp __UNUSED__, Ecore_X_Screen *screen) +{ + xcb_screen_t *s; + + s = (xcb_screen_t *)screen; + return s->default_colormap; +} + +/** + * Retrieve the default depth. + * + * @param disp The Display to get the Default Depth from + * @param screen The Screen. + * + * @return The default depth. + * @since 1.1.0 + */ +EAPI int +ecore_x_default_depth_get(Ecore_X_Display *disp __UNUSED__, Ecore_X_Screen *screen) +{ + xcb_screen_t *s; + + s = (xcb_screen_t *)screen; + return s->root_depth; +} + +/** + * Sets the timeout for a double and triple clicks to be flagged. + * + * This sets the time between clicks before the double_click flag is + * set in a button down event. If 3 clicks occur within double this + * time, the triple_click flag is also set. + * + * @param t The time in seconds + * @ingroup Ecore_X_Display_Attr_Group + */ +EAPI void +ecore_x_double_click_time_set(double t) +{ + if (t < 0.0) t = 0.0; + _ecore_xcb_double_click_time = t; +} + +/** + * Retrieves the double and triple click flag timeout. + * + * See @ref ecore_x_double_click_time_set for more information. + * + * @return The timeout for double clicks in seconds. + * @ingroup Ecore_X_Display_Attr_Group + */ +EAPI double +ecore_x_double_click_time_get(void) +{ + return _ecore_xcb_double_click_time; +} + +/* local function prototypes */ +static int +_ecore_xcb_shutdown(Eina_Bool close_display) +{ + if (--_ecore_xcb_init_count != 0) + return _ecore_xcb_init_count; + + if (!_ecore_xcb_conn) + return _ecore_xcb_init_count; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + ecore_idle_enterer_del(_ecore_xcb_idle_enterer); + _ecore_xcb_idle_enterer = NULL; + + if (_ecore_xcb_fd_handler) + ecore_main_fd_handler_del(_ecore_xcb_fd_handler); + + /* disconnect from display server */ + if (close_display) + xcb_disconnect(_ecore_xcb_conn); + else + { + close(xcb_get_file_descriptor(_ecore_xcb_conn)); + _ecore_xcb_conn = NULL; + } + + /* shutdown events */ + _ecore_xcb_events_shutdown(); + + /* shutdown input extension */ + _ecore_xcb_input_shutdown(); + + /* shutdown gesture extension */ + _ecore_xcb_gesture_shutdown(); + + /* shutdown selection */ + _ecore_xcb_selection_shutdown(); + + /* shutdown dnd */ + _ecore_xcb_dnd_shutdown(); + + /* shutdown netwm */ + ecore_x_netwm_shutdown(); + + /* shutdown keymap */ + _ecore_xcb_keymap_shutdown(); + + /* shutdown ecore_event */ + ecore_event_shutdown(); + + /* shutdown ecore */ + ecore_shutdown(); + + /* unregister log domain */ + eina_log_domain_unregister(_ecore_xcb_log_dom); + _ecore_xcb_log_dom = -1; + + /* shutdown eina */ + eina_shutdown(); + + return _ecore_xcb_init_count; +} + +static Eina_Bool +_ecore_xcb_fd_handle(void *data, Ecore_Fd_Handler *hdlr __UNUSED__) +{ + xcb_connection_t *conn; + xcb_generic_event_t *ev = NULL; + + conn = (xcb_connection_t *)data; + + if (_ecore_xcb_event_buffered) + { + _ecore_xcb_events_handle(_ecore_xcb_event_buffered); + free(_ecore_xcb_event_buffered); + _ecore_xcb_event_buffered = NULL; + } + +// xcb_flush(conn); + + while ((ev = xcb_poll_for_event(conn))) + { + /* NB: Ecore Xlib uses filterevent for xim, but xcb does not support + * xim, so no need for it here */ + + /* check for errors first */ + if (xcb_connection_has_error(conn)) + { + xcb_generic_error_t *err; + + err = (xcb_generic_error_t *)ev; + _ecore_xcb_io_error_handle(err); + } + else + { + /* FIXME: Filter event for XIM */ + _ecore_xcb_events_handle(ev); + free(ev); + } + } + + return ECORE_CALLBACK_RENEW; +} + +static Eina_Bool +_ecore_xcb_fd_handle_buff(void *data, Ecore_Fd_Handler *hdlr __UNUSED__) +{ + xcb_connection_t *conn; + xcb_generic_event_t *ev = NULL; + + conn = (xcb_connection_t *)data; + ev = xcb_poll_for_event(conn); + if (ev) + { + /* check for errors first */ + if (xcb_connection_has_error(conn)) + { + xcb_generic_error_t *err; + + err = (xcb_generic_error_t *)ev; + _ecore_xcb_io_error_handle(err); + return ECORE_CALLBACK_CANCEL; + } + _ecore_xcb_event_buffered = ev; + return ECORE_CALLBACK_RENEW; + } + return ECORE_CALLBACK_CANCEL; +} + +static Eina_Bool +_ecore_xcb_idle_enter(void *data __UNUSED__) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_flush(_ecore_xcb_conn); + return ECORE_CALLBACK_RENEW; +} diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_atoms.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_atoms.c new file mode 100644 index 0000000..769ffac --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_atoms.c @@ -0,0 +1,408 @@ +#include "ecore_xcb_private.h" +#include "ecore_x_atoms_decl.h" + +/* NB: Increment if you add new atoms */ +#define ECORE_X_ATOMS_COUNT 199 + +typedef struct _Xcb_Atom Xcb_Atom; +struct _Xcb_Atom +{ + const char *name; + Ecore_X_Atom *atom; +}; + +/* local function prototypes */ + +/* local variables */ +static xcb_intern_atom_cookie_t cookies[ECORE_X_ATOMS_COUNT]; +static Xcb_Atom atoms[] = +{ + { "ATOM", &ECORE_X_ATOM_ATOM }, + { "CARDINAL", &ECORE_X_ATOM_CARDINAL }, + { "COMPOUND_TEXT", &ECORE_X_ATOM_COMPOUND_TEXT }, + { "FILE_NAME", &ECORE_X_ATOM_FILE_NAME }, + { "STRING", &ECORE_X_ATOM_STRING }, + { "TEXT", &ECORE_X_ATOM_TEXT }, + { "UTF8_STRING", &ECORE_X_ATOM_UTF8_STRING }, + { "WINDOW", &ECORE_X_ATOM_WINDOW }, + { "PIXMAP", &ECORE_X_ATOM_PIXMAP }, + { "VISUALID", &ECORE_X_ATOM_VISUALID }, + + { "JXSelectionWindowProperty", &ECORE_X_ATOM_SELECTION_PROP_XDND }, + { "XdndSelection", &ECORE_X_ATOM_SELECTION_XDND }, + { "XdndAware", &ECORE_X_ATOM_XDND_AWARE }, + { "XdndEnter", &ECORE_X_ATOM_XDND_ENTER }, + { "XdndTypeList", &ECORE_X_ATOM_XDND_TYPE_LIST }, + { "XdndPosition", &ECORE_X_ATOM_XDND_POSITION }, + { "XdndActionCopy", &ECORE_X_ATOM_XDND_ACTION_COPY }, + { "XdndActionMove", &ECORE_X_ATOM_XDND_ACTION_MOVE }, + { "XdndActionPrivate", &ECORE_X_ATOM_XDND_ACTION_PRIVATE }, + { "XdndActionAsk", &ECORE_X_ATOM_XDND_ACTION_ASK }, + { "XdndActionList", &ECORE_X_ATOM_XDND_ACTION_LIST }, + { "XdndActionLink", &ECORE_X_ATOM_XDND_ACTION_LINK }, + { "XdndActionDescription", &ECORE_X_ATOM_XDND_ACTION_DESCRIPTION }, + { "XdndProxy", &ECORE_X_ATOM_XDND_PROXY }, + { "XdndStatus", &ECORE_X_ATOM_XDND_STATUS }, + { "XdndLeave", &ECORE_X_ATOM_XDND_LEAVE }, + { "XdndDrop", &ECORE_X_ATOM_XDND_DROP }, + { "XdndFinished", &ECORE_X_ATOM_XDND_FINISHED }, + + { "XdndActionCopy", &ECORE_X_DND_ACTION_COPY }, + { "XdndActionMove", &ECORE_X_DND_ACTION_MOVE }, + { "XdndActionLink", &ECORE_X_DND_ACTION_LINK }, + { "XdndActionAsk", &ECORE_X_DND_ACTION_ASK }, + { "XdndActionPrivate", &ECORE_X_DND_ACTION_PRIVATE }, + + { "_E_FRAME_SIZE", &ECORE_X_ATOM_E_FRAME_SIZE }, + + { "_WIN_LAYER", &ECORE_X_ATOM_WIN_LAYER }, + + { "WM_NAME", &ECORE_X_ATOM_WM_NAME }, + { "WM_ICON_NAME", &ECORE_X_ATOM_WM_ICON_NAME }, + { "WM_NORMAL_HINTS", &ECORE_X_ATOM_WM_NORMAL_HINTS }, + { "WM_SIZE_HINTS", &ECORE_X_ATOM_WM_SIZE_HINTS }, + { "WM_HINTS", &ECORE_X_ATOM_WM_HINTS }, + { "WM_CLASS", &ECORE_X_ATOM_WM_CLASS }, + { "WM_TRANSIENT_FOR", &ECORE_X_ATOM_WM_TRANSIENT_FOR }, + { "WM_PROTOCOLS", &ECORE_X_ATOM_WM_PROTOCOLS }, + { "WM_COLORMAP_WINDOWS", &ECORE_X_ATOM_WM_COLORMAP_WINDOWS }, + { "WM_COMMAND", &ECORE_X_ATOM_WM_COMMAND }, + { "WM_CLIENT_MACHINE", &ECORE_X_ATOM_WM_CLIENT_MACHINE }, + + { "WM_STATE", &ECORE_X_ATOM_WM_STATE }, + { "WM_ICON_SIZE", &ECORE_X_ATOM_WM_ICON_SIZE }, + + { "WM_CHANGE_STATE", &ECORE_X_ATOM_WM_CHANGE_STATE }, + + { "WM_TAKE_FOCUS", &ECORE_X_ATOM_WM_TAKE_FOCUS }, + { "WM_SAVE_YOURSELF", &ECORE_X_ATOM_WM_SAVE_YOURSELF }, + { "WM_DELETE_WINDOW", &ECORE_X_ATOM_WM_DELETE_WINDOW }, + + { "WM_COLORMAP_NOTIFY", &ECORE_X_ATOM_WM_COLORMAP_NOTIFY }, + + { "SM_CLIENT_ID", &ECORE_X_ATOM_SM_CLIENT_ID }, + { "WM_CLIENT_LEADER", &ECORE_X_ATOM_WM_CLIENT_LEADER }, + { "WM_WINDOW_ROLE", &ECORE_X_ATOM_WM_WINDOW_ROLE }, + + { "_MOTIF_WM_HINTS", &ECORE_X_ATOM_MOTIF_WM_HINTS }, + + { "_NET_SUPPORTED", &ECORE_X_ATOM_NET_SUPPORTED }, + { "_NET_CLIENT_LIST", &ECORE_X_ATOM_NET_CLIENT_LIST }, + { "_NET_CLIENT_LIST_STACKING", &ECORE_X_ATOM_NET_CLIENT_LIST_STACKING }, + { "_NET_NUMBER_OF_DESKTOPS", &ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS }, + { "_NET_DESKTOP_GEOMETRY", &ECORE_X_ATOM_NET_DESKTOP_GEOMETRY }, + { "_NET_DESKTOP_VIEWPORT", &ECORE_X_ATOM_NET_DESKTOP_VIEWPORT }, + { "_NET_CURRENT_DESKTOP", &ECORE_X_ATOM_NET_CURRENT_DESKTOP }, + { "_NET_DESKTOP_NAMES", &ECORE_X_ATOM_NET_DESKTOP_NAMES }, + { "_NET_ACTIVE_WINDOW", &ECORE_X_ATOM_NET_ACTIVE_WINDOW }, + { "_NET_WORKAREA", &ECORE_X_ATOM_NET_WORKAREA }, + { "_NET_SUPPORTING_WM_CHECK", &ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK }, + { "_NET_VIRTUAL_ROOTS", &ECORE_X_ATOM_NET_VIRTUAL_ROOTS }, + { "_NET_DESKTOP_LAYOUT", &ECORE_X_ATOM_NET_DESKTOP_LAYOUT }, + { "_NET_SHOWING_DESKTOP", &ECORE_X_ATOM_NET_SHOWING_DESKTOP }, + + { "_NET_CLOSE_WINDOW", &ECORE_X_ATOM_NET_CLOSE_WINDOW }, + { "_NET_MOVERESIZE_WINDOW", &ECORE_X_ATOM_NET_MOVERESIZE_WINDOW }, + { "_NET_WM_MOVERESIZE", &ECORE_X_ATOM_NET_WM_MOVERESIZE }, + { "_NET_RESTACK_WINDOW", &ECORE_X_ATOM_NET_RESTACK_WINDOW }, + + { "_NET_REQUEST_FRAME_EXTENTS", &ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS }, + + { "_NET_WM_NAME", &ECORE_X_ATOM_NET_WM_NAME }, + { "_NET_WM_VISIBLE_NAME", &ECORE_X_ATOM_NET_WM_VISIBLE_NAME }, + { "_NET_WM_ICON_NAME", &ECORE_X_ATOM_NET_WM_ICON_NAME }, + { "_NET_WM_VISIBLE_ICON_NAME", &ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME }, + { "_NET_WM_DESKTOP", &ECORE_X_ATOM_NET_WM_DESKTOP }, + + { "_NET_WM_WINDOW_TYPE", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE }, + { "_NET_WM_WINDOW_TYPE_DESKTOP", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP }, + { "_NET_WM_WINDOW_TYPE_DOCK", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK }, + { "_NET_WM_WINDOW_TYPE_TOOLBAR", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR }, + { "_NET_WM_WINDOW_TYPE_MENU", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU }, + { "_NET_WM_WINDOW_TYPE_UTILITY", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY }, + { "_NET_WM_WINDOW_TYPE_SPLASH", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH }, + { "_NET_WM_WINDOW_TYPE_DIALOG", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG }, + { "_NET_WM_WINDOW_TYPE_NORMAL", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL }, + { "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU", + &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU }, + { "_NET_WM_WINDOW_TYPE_POPUP_MENU", + &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU }, + { "_NET_WM_WINDOW_TYPE_TOOLTIP", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP }, + { "_NET_WM_WINDOW_TYPE_NOTIFICATION", + &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION }, + { "_NET_WM_WINDOW_TYPE_COMBO", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO }, + { "_NET_WM_WINDOW_TYPE_DND", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND }, + + { "_NET_WM_STATE", &ECORE_X_ATOM_NET_WM_STATE }, + { "_NET_WM_STATE_MODAL", &ECORE_X_ATOM_NET_WM_STATE_MODAL }, + { "_NET_WM_STATE_STICKY", &ECORE_X_ATOM_NET_WM_STATE_STICKY }, + { "_NET_WM_STATE_MAXIMIZED_VERT", + &ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT }, + { "_NET_WM_STATE_MAXIMIZED_HORZ", + &ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ }, + { "_NET_WM_STATE_SHADED", &ECORE_X_ATOM_NET_WM_STATE_SHADED }, + { "_NET_WM_STATE_SKIP_TASKBAR", &ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR }, + { "_NET_WM_STATE_SKIP_PAGER", &ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER }, + { "_NET_WM_STATE_HIDDEN", &ECORE_X_ATOM_NET_WM_STATE_HIDDEN }, + { "_NET_WM_STATE_FULLSCREEN", &ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN }, + { "_NET_WM_STATE_ABOVE", &ECORE_X_ATOM_NET_WM_STATE_ABOVE }, + { "_NET_WM_STATE_BELOW", &ECORE_X_ATOM_NET_WM_STATE_BELOW }, + { "_NET_WM_STATE_DEMANDS_ATTENTION", + &ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION }, + + { "_NET_WM_ALLOWED_ACTIONS", &ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS }, + { "_NET_WM_ACTION_MOVE", &ECORE_X_ATOM_NET_WM_ACTION_MOVE }, + { "_NET_WM_ACTION_RESIZE", &ECORE_X_ATOM_NET_WM_ACTION_RESIZE }, + { "_NET_WM_ACTION_MINIMIZE", &ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE }, + { "_NET_WM_ACTION_SHADE", &ECORE_X_ATOM_NET_WM_ACTION_SHADE }, + { "_NET_WM_ACTION_STICK", &ECORE_X_ATOM_NET_WM_ACTION_STICK }, + { "_NET_WM_ACTION_MAXIMIZE_HORZ", + &ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ }, + { "_NET_WM_ACTION_MAXIMIZE_VERT", + &ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT }, + { "_NET_WM_ACTION_FULLSCREEN", &ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN }, + { "_NET_WM_ACTION_CHANGE_DESKTOP", + &ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP }, + { "_NET_WM_ACTION_CLOSE", &ECORE_X_ATOM_NET_WM_ACTION_CLOSE }, + { "_NET_WM_ACTION_ABOVE", &ECORE_X_ATOM_NET_WM_ACTION_ABOVE }, + { "_NET_WM_ACTION_BELOW", &ECORE_X_ATOM_NET_WM_ACTION_BELOW }, + + { "_NET_WM_STRUT", &ECORE_X_ATOM_NET_WM_STRUT }, + { "_NET_WM_STRUT_PARTIAL", &ECORE_X_ATOM_NET_WM_STRUT_PARTIAL }, + { "_NET_WM_ICON_GEOMETRY", &ECORE_X_ATOM_NET_WM_ICON_GEOMETRY }, + { "_NET_WM_ICON", &ECORE_X_ATOM_NET_WM_ICON }, + { "_NET_WM_PID", &ECORE_X_ATOM_NET_WM_PID }, + { "_NET_WM_HANDLED_ICONS", &ECORE_X_ATOM_NET_WM_HANDLED_ICONS }, + { "_NET_WM_USER_TIME", &ECORE_X_ATOM_NET_WM_USER_TIME }, + { "_NET_STARTUP_ID", &ECORE_X_ATOM_NET_STARTUP_ID }, + { "_NET_FRAME_EXTENTS", &ECORE_X_ATOM_NET_FRAME_EXTENTS }, + + { "_NET_WM_PING", &ECORE_X_ATOM_NET_WM_PING }, + { "_NET_WM_SYNC_REQUEST", &ECORE_X_ATOM_NET_WM_SYNC_REQUEST }, + { "_NET_WM_SYNC_REQUEST_COUNTER", + &ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER }, + + { "_NET_WM_WINDOW_OPACITY", &ECORE_X_ATOM_NET_WM_WINDOW_OPACITY }, + { "_NET_WM_WINDOW_SHADOW", &ECORE_X_ATOM_NET_WM_WINDOW_SHADOW }, + { "_NET_WM_WINDOW_SHADE", &ECORE_X_ATOM_NET_WM_WINDOW_SHADE }, + + { "TARGETS", &ECORE_X_ATOM_SELECTION_TARGETS }, + { "CLIPBOARD", &ECORE_X_ATOM_SELECTION_CLIPBOARD }, + { "PRIMARY", &ECORE_X_ATOM_SELECTION_PRIMARY }, + { "SECONDARY", &ECORE_X_ATOM_SELECTION_SECONDARY }, + { "_ECORE_SELECTION_PRIMARY", &ECORE_X_ATOM_SELECTION_PROP_PRIMARY }, + { "_ECORE_SELECTION_SECONDARY", &ECORE_X_ATOM_SELECTION_PROP_SECONDARY }, + { "_ECORE_SELECTION_CLIPBOARD", &ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD }, + + { "_E_VIRTUAL_KEYBOARD", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD }, + { "_E_VIRTUAL_KEYBOARD_STATE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE }, + { "_E_VIRTUAL_KEYBOARD_ON", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON }, + { "_E_VIRTUAL_KEYBOARD_OFF", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF }, + { "_E_VIRTUAL_KEYBOARD_ALPHA", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA }, + { "_E_VIRTUAL_KEYBOARD_NUMERIC", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC }, + { "_E_VIRTUAL_KEYBOARD_PIN", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN }, + { "_E_VIRTUAL_KEYBOARD_PHONE_NUMBER", + &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER }, + { "_E_VIRTUAL_KEYBOARD_HEX", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX }, + { "_E_VIRTUAL_KEYBOARD_TERMINAL", + &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL }, + { "_E_VIRTUAL_KEYBOARD_PASSWORD", + &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD }, + { "_E_VIRTUAL_KEYBOARD_IP", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP }, + { "_E_VIRTUAL_KEYBOARD_HOST", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST }, + { "_E_VIRTUAL_KEYBOARD_FILE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE }, + { "_E_VIRTUAL_KEYBOARD_URL", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL }, + { "_E_VIRTUAL_KEYBOARD_KEYPAD", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD }, + { "_E_VIRTUAL_KEYBOARD_J2ME", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME }, + + { "_E_ILLUME_ZONE", &ECORE_X_ATOM_E_ILLUME_ZONE }, + { "_E_ILLUME_ZONE_LIST", &ECORE_X_ATOM_E_ILLUME_ZONE_LIST }, + { "_E_ILLUME_CONFORMANT", &ECORE_X_ATOM_E_ILLUME_CONFORMANT }, + { "_E_ILLUME_MODE", &ECORE_X_ATOM_E_ILLUME_MODE }, + { "_E_ILLUME_MODE_SINGLE", &ECORE_X_ATOM_E_ILLUME_MODE_SINGLE }, + { "_E_ILLUME_MODE_DUAL_TOP", &ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP }, + { "_E_ILLUME_MODE_DUAL_LEFT", &ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT }, + { "_E_ILLUME_FOCUS_BACK", &ECORE_X_ATOM_E_ILLUME_FOCUS_BACK }, + { "_E_ILLUME_FOCUS_FORWARD", &ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD }, + { "_E_ILLUME_FOCUS_HOME", &ECORE_X_ATOM_E_ILLUME_FOCUS_HOME }, + { "_E_ILLUME_CLOSE", &ECORE_X_ATOM_E_ILLUME_CLOSE }, + { "_E_ILLUME_HOME_NEW", &ECORE_X_ATOM_E_ILLUME_HOME_NEW }, + { "_E_ILLUME_HOME_DEL", &ECORE_X_ATOM_E_ILLUME_HOME_DEL }, + { "_E_ILLUME_DRAG", &ECORE_X_ATOM_E_ILLUME_DRAG }, + { "_E_ILLUME_DRAG_LOCKED", &ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED }, + { "_E_ILLUME_DRAG_START", &ECORE_X_ATOM_E_ILLUME_DRAG_START }, + { "_E_ILLUME_DRAG_END", &ECORE_X_ATOM_E_ILLUME_DRAG_END }, + { "_E_ILLUME_INDICATOR_GEOMETRY", + &ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY }, + { "_E_ILLUME_SOFTKEY_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY }, + { "_E_ILLUME_KEYBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY }, + { "_E_ILLUME_QUICKPANEL", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL }, + { "_E_ILLUME_QUICKPANEL_STATE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE }, + { "_E_ILLUME_QUICKPANEL_STATE_TOGGLE", + &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE }, + { "_E_ILLUME_QUICKPANEL_ON", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON }, + { "_E_ILLUME_QUICKPANEL_OFF", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF }, + { "_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR", + &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR }, + { "_E_ILLUME_QUICKPANEL_PRIORITY_MINOR", + &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR }, + { "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE }, + { "_E_ILLUME_QUICKPANEL_POSITION_UPDATE", + &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE }, + + { "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER }, + { "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE }, + { "_E_COMP_SYNC_SUPPORTED", &ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED }, + { "_E_COMP_SYNC_BEGIN", &ECORE_X_ATOM_E_COMP_SYNC_BEGIN }, + { "_E_COMP_SYNC_END", &ECORE_X_ATOM_E_COMP_SYNC_END }, + { "_E_COMP_SYNC_CANCEL", &ECORE_X_ATOM_E_COMP_SYNC_CANCEL }, + + { "_E_COMP_FLUSH", &ECORE_X_ATOM_E_COMP_FLUSH }, + { "_E_COMP_DUMP", &ECORE_X_ATOM_E_COMP_DUMP }, + { "_E_COMP_PIXMAP", &ECORE_X_ATOM_E_COMP_PIXMAP }, + { "_E_VIDEO_PARENT", &ECORE_X_ATOM_E_VIDEO_PARENT }, + { "_E_VIDEO_POSITION", &ECORE_X_ATOM_E_VIDEO_POSITION } +}; + +void +_ecore_xcb_atoms_init(void) +{ + int i = 0, num = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + num = (sizeof(atoms) / sizeof(Xcb_Atom)); + for (i = 0; i < num; i++) + { + cookies[i] = + xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, + strlen(atoms[i].name), atoms[i].name); + } +} + +void +_ecore_xcb_atoms_finalize(void) +{ + int i = 0, num = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + num = (sizeof(atoms) / sizeof(Xcb_Atom)); + for (i = 0; i < num; i++) + { + xcb_intern_atom_reply_t *reply = NULL; + + if (!(reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], 0))) + continue; + *(atoms[i].atom) = reply->atom; + free(reply); + } +} + +/** + * @defgroup Ecore_X_Atom_Group XCB Atom Functions + * + * Functions that operate on atoms + */ + +/** + * Retrieves the atom value associated to a name. + * + * @param name Unused. + * @return Associated atom value. + * + * Retrieves the atom value associated to a name. The reply is the + * returned value of the function ecore_xcb_intern_atom_reply(). If + * @p reply is @c NULL, the NULL atom is returned. Otherwise, the atom + * associated to the name is returned. + * + * To use this function, you must call before, and in order, + * ecore_x_atom_get_prefetch(), which sends the InternAtom request, + * then ecore_x_atom_get_fetch(), which gets the reply. + * + * @ingroup Ecore_X_Atom_Group + */ +EAPI Ecore_X_Atom +ecore_x_atom_get(const char *name) +{ + xcb_intern_atom_cookie_t cookie; + xcb_intern_atom_reply_t *reply; + Ecore_X_Atom a; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(name), name); + reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return XCB_ATOM_NONE; + a = reply->atom; + free(reply); + return a; +} + +/** + * Retrieves the name of the given atom. + * + * @param atom + * @return The name of the atom. + * + * @ingroup Ecore_X_Atom_Group + */ +EAPI char * +ecore_x_atom_name_get(Ecore_X_Atom atom) +{ + xcb_get_atom_name_cookie_t cookie; + xcb_get_atom_name_reply_t *reply; + char *name; + int len = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, atom); + reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return NULL; + len = xcb_get_atom_name_name_length(reply); + name = (char *)malloc(sizeof(char) * (len + 1)); + if (!name) + { + free(reply); + return NULL; + } + memcpy(name, xcb_get_atom_name_name(reply), len); + name[len] = '\0'; + + free(reply); + return name; +} + +EAPI void +ecore_x_atoms_get(const char **names, + int num, + Ecore_X_Atom *atoms) +{ + xcb_intern_atom_cookie_t cookies[num]; + int i = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + for (i = 0; i < num; i++) + { + cookies[i] = + xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, + strlen(names[i]), names[i]); + } + for (i = 0; i < num; i++) + { + xcb_intern_atom_reply_t *reply = NULL; + + if (!(reply = xcb_intern_atom_reply(_ecore_xcb_conn, cookies[i], 0))) + continue; + atoms[i] = reply->atom; + free(reply); + } +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_composite.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_composite.c new file mode 100644 index 0000000..f247b34 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_composite.c @@ -0,0 +1,289 @@ +#include "ecore_xcb_private.h" +#ifdef ECORE_XCB_COMPOSITE +# include +#endif + +/* local variables */ +static Eina_Bool _composite_avail = EINA_FALSE; + +void +_ecore_xcb_composite_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_COMPOSITE + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_composite_id); +#endif +} + +void +_ecore_xcb_composite_finalize(void) +{ +#ifdef ECORE_XCB_COMPOSITE + const xcb_query_extension_reply_t *ext_reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_COMPOSITE + ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_composite_id); + if ((ext_reply) && (ext_reply->present)) + { + xcb_composite_query_version_cookie_t cookie; + xcb_composite_query_version_reply_t *reply; + + cookie = + xcb_composite_query_version_unchecked(_ecore_xcb_conn, + XCB_COMPOSITE_MAJOR_VERSION, + XCB_COMPOSITE_MINOR_VERSION); + reply = + xcb_composite_query_version_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { +// if ((reply->major_version >= XCB_COMPOSITE_MAJOR_VERSION) && + if (reply->minor_version >= XCB_COMPOSITE_MINOR_VERSION) + { +# ifdef ECORE_XCB_RENDER + if (_ecore_xcb_render_avail_get()) + { +# ifdef ECORE_XCB_XFIXES + if (_ecore_xcb_xfixes_avail_get()) + _composite_avail = EINA_TRUE; +# endif + } +# endif + } + + free(reply); + } + } +#endif +} + +/** + * @defgroup Ecore_X_Composite_Group X Composite Extension Functions + * + * Functions related to the X Composite Extension + */ + +/** + * Return whether the Composite Extension is available + * + * @return EINA_TRUE is the Composite Extension is available, EINA_FALSE if not + * + * @ingroup Ecore_X_Composite_Group + */ +EAPI Eina_Bool +ecore_x_composite_query(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return _composite_avail; +} + +EAPI void +ecore_x_composite_redirect_window(Ecore_X_Window win, + Ecore_X_Composite_Update_Type type) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_composite_avail) return; + +#ifdef ECORE_XCB_COMPOSITE + uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; + + switch (type) + { + case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: + update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; + break; + + case ECORE_X_COMPOSITE_UPDATE_MANUAL: + update = XCB_COMPOSITE_REDIRECT_MANUAL; + break; + } + xcb_composite_redirect_window(_ecore_xcb_conn, win, update); +// ecore_x_flush(); +#endif +} + +EAPI void +ecore_x_composite_redirect_subwindows(Ecore_X_Window win, + Ecore_X_Composite_Update_Type type) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_composite_avail) return; + +#ifdef ECORE_XCB_COMPOSITE + uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; + + switch (type) + { + case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: + update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; + break; + + case ECORE_X_COMPOSITE_UPDATE_MANUAL: + update = XCB_COMPOSITE_REDIRECT_MANUAL; + break; + } + xcb_composite_redirect_subwindows(_ecore_xcb_conn, win, update); +// ecore_x_flush(); +#endif +} + +EAPI void +ecore_x_composite_unredirect_window(Ecore_X_Window win, + Ecore_X_Composite_Update_Type type) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_composite_avail) return; + +#ifdef ECORE_XCB_COMPOSITE + uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; + + switch (type) + { + case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: + update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; + break; + + case ECORE_X_COMPOSITE_UPDATE_MANUAL: + update = XCB_COMPOSITE_REDIRECT_MANUAL; + break; + } + xcb_composite_unredirect_window(_ecore_xcb_conn, win, update); +// ecore_x_flush(); +#endif +} + +EAPI void +ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, + Ecore_X_Composite_Update_Type type) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_composite_avail) return; + +#ifdef ECORE_XCB_COMPOSITE + uint8_t update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; + + switch (type) + { + case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: + update = XCB_COMPOSITE_REDIRECT_AUTOMATIC; + break; + + case ECORE_X_COMPOSITE_UPDATE_MANUAL: + update = XCB_COMPOSITE_REDIRECT_MANUAL; + break; + } + xcb_composite_unredirect_subwindows(_ecore_xcb_conn, win, update); +// ecore_x_flush(); +#endif +} + +EAPI Ecore_X_Pixmap +ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win) +{ +#ifdef ECORE_XCB_COMPOSITE + Ecore_X_Pixmap pmap = XCB_NONE; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_composite_avail) return XCB_NONE; + +#ifdef ECORE_XCB_COMPOSITE + pmap = xcb_generate_id(_ecore_xcb_conn); + xcb_composite_name_window_pixmap(_ecore_xcb_conn, win, pmap); +// ecore_x_flush(); +#endif + + return pmap; +} + +EAPI void +ecore_x_composite_window_events_disable(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_composite_avail) return; + +#ifdef ECORE_XCB_SHAPE + ecore_x_window_shape_input_rectangle_set(win, -1, -1, 1, 1); +// ecore_x_flush(); +#else + return; + win = 0; +#endif +} + +EAPI void +ecore_x_composite_window_events_enable(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_composite_avail) return; + +#ifdef ECORE_XCB_SHAPE + ecore_x_window_shape_input_rectangle_set(win, 0, 0, 65535, 65535); +// ecore_x_flush(); +#else + return; + win = 0; +#endif +} + +EAPI Ecore_X_Window +ecore_x_composite_render_window_enable(Ecore_X_Window root) +{ + Ecore_X_Window win = 0; +#ifdef ECORE_XCB_COMPOSITE + xcb_composite_get_overlay_window_cookie_t cookie; + xcb_composite_get_overlay_window_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_composite_avail) return 0; + +#ifdef ECORE_XCB_COMPOSITE + cookie = xcb_composite_get_overlay_window_unchecked(_ecore_xcb_conn, root); + reply = + xcb_composite_get_overlay_window_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return win; + + win = reply->overlay_win; + free(reply); + + ecore_x_composite_window_events_disable(win); +// ecore_x_flush(); +#endif + + return win; +} + +EAPI void +ecore_x_composite_render_window_disable(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_composite_avail) return; + +#ifdef ECORE_XCB_COMPOSITE + xcb_composite_release_overlay_window(_ecore_xcb_conn, win); +// ecore_x_flush(); +#endif +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_cursor.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_cursor.c new file mode 100644 index 0000000..755df04 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_cursor.c @@ -0,0 +1,400 @@ +#include "ecore_xcb_private.h" +#ifdef ECORE_XCB_CURSOR +# include +# include +#endif + +/* local function prototypes */ +#ifdef ECORE_XCB_CURSOR +static xcb_render_pictforminfo_t *_ecore_xcb_cursor_format_get(void); +#endif +static void _ecore_xcb_cursor_default_size_get(void); +static void _ecore_xcb_cursor_dpi_size_get(void); +static void _ecore_xcb_cursor_guess_size(void); +#ifdef ECORE_XCB_CURSOR +static Ecore_X_Cursor _ecore_xcb_cursor_image_load_cursor(xcb_image_t *img, + int hot_x, + int hot_y); +#endif +static void _ecore_xcb_cursor_image_destroy(xcb_image_t *img); + +/* local variables */ +static int _ecore_xcb_cursor_size = 0; +static Eina_Bool _ecore_xcb_cursor = EINA_FALSE; +#ifdef ECORE_XCB_CURSOR +static uint32_t _ecore_xcb_cursor_format_id = 0; +// static xcb_render_pictforminfo_t *_ecore_xcb_cursor_format = NULL; +#endif + +void +_ecore_xcb_cursor_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* NB: No-op */ +} + +void +_ecore_xcb_cursor_finalize(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_CURSOR + _ecore_xcb_cursor = _ecore_xcb_render_argb_get(); + + /* find render pict format */ + if (_ecore_xcb_cursor_format_id <= 0) + _ecore_xcb_cursor_format_id = _ecore_xcb_cursor_format_get()->id; +#endif + + /* try to grab cursor size from XDefaults */ + _ecore_xcb_cursor_default_size_get(); + + /* if that failed, try to get it from Xft Dpi setting */ + if (_ecore_xcb_cursor_size == 0) + _ecore_xcb_cursor_dpi_size_get(); + + /* if that failed, try to guess from display size */ + if (_ecore_xcb_cursor_size == 0) + _ecore_xcb_cursor_guess_size(); + + /* NB: Would normally add theme stuff here, but E cursor does not support + * xcursor themes. Delay parsing that stuff out until such time if/when the + * user selects to use X Cursor, rather than E cursor */ +} + +EAPI Eina_Bool +ecore_x_cursor_color_supported_get(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_cursor; +} + +EAPI Ecore_X_Cursor +ecore_x_cursor_new(Ecore_X_Window win, + int *pixels, + int w, + int h, + int hot_x, + int hot_y) +{ + Ecore_X_Cursor cursor = 0; + xcb_image_t *img; + +// LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_CURSOR + if (_ecore_xcb_cursor) + { + img = _ecore_xcb_image_create_native(w, h, XCB_IMAGE_FORMAT_Z_PIXMAP, + 32, NULL, (w * h * sizeof(int)), + (uint8_t *)pixels); + cursor = _ecore_xcb_cursor_image_load_cursor(img, hot_x, hot_y); + _ecore_xcb_cursor_image_destroy(img); + return cursor; + } + else +#endif + { + Ecore_X_GC gc; + xcb_pixmap_t pmap, mask; + uint32_t *pix; + uint8_t fr = 0x00, fg = 0x00, fb = 0x00; + uint8_t br = 0xff, bg = 0xff, bb = 0xff; + uint32_t brightest = 0, darkest = 255 * 3; + uint16_t x, y; + const uint32_t dither[2][2] = + { + {0, 2}, + {3, 1} + }; + + img = _ecore_xcb_image_create_native(w, h, XCB_IMAGE_FORMAT_Z_PIXMAP, + 1, NULL, ~0, NULL); + if (img->data) free(img->data); + img->data = malloc(img->size); + + pmap = xcb_generate_id(_ecore_xcb_conn); + xcb_create_pixmap(_ecore_xcb_conn, 1, pmap, win, w, h); + mask = xcb_generate_id(_ecore_xcb_conn); + xcb_create_pixmap(_ecore_xcb_conn, 1, mask, win, w, h); + + pix = (uint32_t *)pixels; + for (y = 0; y < h; y++) + { + for (x = 0; x < w; x++) + { + uint8_t r, g, b, a; + + a = (pix[0] >> 24) & 0xff; + r = (pix[0] >> 16) & 0xff; + g = (pix[0] >> 8) & 0xff; + b = (pix[0]) & 0xff; + if (a > 0) + { + if ((uint32_t)(r + g + b) > brightest) + { + brightest = r + g + b; + br = r; + bg = g; + bb = b; + } + + if ((uint32_t)(r + g + b) < darkest) + { + darkest = r + g + b; + fr = r; + fg = g; + fb = b; + } + } + pix++; + } + } + + pix = (uint32_t *)pixels; + for (y = 0; y < h; y++) + { + for (x = 0; x < w; x++) + { + uint32_t v; + uint8_t r, g, b; + int32_t d1, d2; + + r = (pix[0] >> 16) & 0xff; + g = (pix[0] >> 8) & 0xff; + b = (pix[0]) & 0xff; + d1 = + ((r - fr) * (r - fr)) + + ((g - fg) * (g - fg)) + + ((b - fb) * (b - fb)); + d2 = + ((r - br) * (r - br)) + + ((g - bg) * (g - bg)) + + ((b - bb) * (b - bb)); + if (d1 + d2) + { + v = (((d2 * 255) / (d1 + d2)) * 5) / 256; + if (v > dither[x & 0x1][y & 0x1]) + v = 1; + else + v = 0; + } + else + v = 0; + + xcb_image_put_pixel(img, x, y, v); + pix++; + } + } + + gc = ecore_x_gc_new(pmap, 0, NULL); + xcb_put_image(_ecore_xcb_conn, img->format, pmap, gc, w, h, + 0, 0, 0, img->depth, img->size, img->data); + ecore_x_gc_free(gc); + + pix = (uint32_t *)pixels; + for (y = 0; y < h; y++) + { + for (x = 0; x < w; x++) + { + uint32_t v; + + v = (((pix[0] >> 24) & 0xff) * 5) / 256; + if (v > dither[x & 0x1][y & 0x1]) + v = 1; + else + v = 0; + + xcb_image_put_pixel(img, x, y, v); + pix++; + } + } + + gc = ecore_x_gc_new(mask, 0, NULL); + xcb_put_image(_ecore_xcb_conn, img->format, mask, gc, w, h, + 0, 0, 0, img->depth, img->size, img->data); + ecore_x_gc_free(gc); + + if (img->data) free(img->data); + _ecore_xcb_cursor_image_destroy(img); + + cursor = xcb_generate_id(_ecore_xcb_conn); + xcb_create_cursor(_ecore_xcb_conn, cursor, pmap, mask, + fr << 8 | fr, fg << 8 | fg, fb << 8 | fb, + br << 8 | br, bg << 8 | bg, bb << 8 | bb, + hot_x, hot_y); + + xcb_free_pixmap(_ecore_xcb_conn, pmap); + xcb_free_pixmap(_ecore_xcb_conn, mask); + + return cursor; + } + + return 0; +} + +EAPI void +ecore_x_cursor_free(Ecore_X_Cursor c) +{ +// LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_free_cursor(_ecore_xcb_conn, c); +} + +/* + * Returns the cursor for the given shape. + * Note that the return value must not be freed with + * ecore_x_cursor_free()! + */ +EAPI Ecore_X_Cursor +ecore_x_cursor_shape_get(int shape) +{ + Ecore_X_Cursor cursor = 0; + xcb_font_t font; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + font = xcb_generate_id(_ecore_xcb_conn); + xcb_open_font(_ecore_xcb_conn, font, strlen("cursor"), "cursor"); + + cursor = xcb_generate_id(_ecore_xcb_conn); + /* FIXME: Add request check ?? */ + xcb_create_glyph_cursor(_ecore_xcb_conn, cursor, font, font, + shape, shape + 1, 0, 0, 0, 65535, 65535, 65535); + + xcb_close_font(_ecore_xcb_conn, font); + return cursor; +} + +EAPI void +ecore_x_cursor_size_set(int size) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_xcb_cursor_size = size; + /* NB: May need to adjust size of current cursors here */ +} + +EAPI int +ecore_x_cursor_size_get(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_cursor_size; +} + +/* local functions */ +#ifdef ECORE_XCB_CURSOR +static xcb_render_pictforminfo_t * +_ecore_xcb_cursor_format_get(void) +{ + const xcb_render_query_pict_formats_reply_t *reply; + xcb_render_pictforminfo_t *ret = NULL; + + CHECK_XCB_CONN; + + reply = xcb_render_util_query_formats(_ecore_xcb_conn); + if (reply) + ret = xcb_render_util_find_standard_format(reply, + XCB_PICT_STANDARD_ARGB_32); + + return ret; +} + +#endif + +static void +_ecore_xcb_cursor_default_size_get(void) +{ + char *s = NULL; + int v = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + s = getenv("XCURSOR_SIZE"); + if (!s) + { + _ecore_xcb_xdefaults_init(); + v = _ecore_xcb_xdefaults_int_get("Xcursor", "size"); + _ecore_xcb_xdefaults_shutdown(); + } + else + v = atoi(s); + if (v) _ecore_xcb_cursor_size = ((v * 16) / 72); +} + +static void +_ecore_xcb_cursor_dpi_size_get(void) +{ + int v = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_xcb_xdefaults_init(); + v = _ecore_xcb_xdefaults_int_get("Xft", "dpi"); + if (v) _ecore_xcb_cursor_size = ((v * 16) / 72); + _ecore_xcb_xdefaults_shutdown(); +} + +static void +_ecore_xcb_cursor_guess_size(void) +{ + int w = 0, h = 0, s = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_screen_size_get(_ecore_xcb_screen, &w, &h); + if (h < w) s = h; + else s = w; + _ecore_xcb_cursor_size = (s / 48); +} + +#ifdef ECORE_XCB_CURSOR +static Ecore_X_Cursor +_ecore_xcb_cursor_image_load_cursor(xcb_image_t *img, + int hot_x, + int hot_y) +{ + Ecore_X_Cursor cursor = 0; + Ecore_X_GC gc; + xcb_pixmap_t pmap; + xcb_render_picture_t pict; + + CHECK_XCB_CONN; + + pmap = xcb_generate_id(_ecore_xcb_conn); + xcb_create_pixmap(_ecore_xcb_conn, img->depth, pmap, + ((xcb_screen_t *)_ecore_xcb_screen)->root, + img->width, img->height); + + gc = ecore_x_gc_new(pmap, 0, NULL); + xcb_put_image(_ecore_xcb_conn, img->format, pmap, gc, + img->width, img->height, 0, 0, 0, img->depth, + img->size, img->data); + ecore_x_gc_free(gc); + + pict = xcb_generate_id(_ecore_xcb_conn); + xcb_render_create_picture(_ecore_xcb_conn, pict, pmap, + _ecore_xcb_cursor_format_id, 0, NULL); + xcb_free_pixmap(_ecore_xcb_conn, pmap); + + cursor = xcb_generate_id(_ecore_xcb_conn); + xcb_render_create_cursor(_ecore_xcb_conn, cursor, pict, hot_x, hot_y); + xcb_render_free_picture(_ecore_xcb_conn, pict); + + return cursor; +} + +#endif + +static void +_ecore_xcb_cursor_image_destroy(xcb_image_t *img) +{ + CHECK_XCB_CONN; + if (img) xcb_image_destroy(img); +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_damage.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_damage.c new file mode 100644 index 0000000..d0ffde1 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_damage.c @@ -0,0 +1,155 @@ +#include "ecore_xcb_private.h" +# ifdef ECORE_XCB_DAMAGE +# include +# endif + +/* local variables */ +static Eina_Bool _damage_avail = EINA_FALSE; + +/* external variables */ +int _ecore_xcb_event_damage = -1; + +void +_ecore_xcb_damage_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_DAMAGE + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_damage_id); +#endif +} + +void +_ecore_xcb_damage_finalize(void) +{ +#ifdef ECORE_XCB_DAMAGE + const xcb_query_extension_reply_t *ext_reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_DAMAGE + ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_damage_id); + if ((ext_reply) && (ext_reply->present)) + { + xcb_damage_query_version_cookie_t cookie; + xcb_damage_query_version_reply_t *reply; + + cookie = + xcb_damage_query_version_unchecked(_ecore_xcb_conn, + XCB_DAMAGE_MAJOR_VERSION, + XCB_DAMAGE_MINOR_VERSION); + reply = xcb_damage_query_version_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + _damage_avail = EINA_TRUE; + free(reply); + } + + if (_damage_avail) + _ecore_xcb_event_damage = ext_reply->first_event; + } +#endif +} + +/** + * @defgroup Ecore_X_Damage_Group X Damage Extension Functions + * + * Functions related to the X Damage Extension. + */ + +EAPI Eina_Bool +ecore_x_damage_query(void) +{ + return _damage_avail; +} + +/** + * Create a damage object + * + * @param drawable The drawable to monitor + * @param level The level of the damage report + * @return The damage object + * + * Creates a damage object to monitor changes to @p drawable, + * with the level @p level. + * + * @ingroup Ecore_X_Damage_Group + */ +EAPI Ecore_X_Damage +ecore_x_damage_new(Ecore_X_Drawable drawable, + Ecore_X_Damage_Report_Level level) +{ + Ecore_X_Damage damage = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_damage_avail) return 0; + +#ifdef ECORE_XCB_DAMAGE + damage = xcb_generate_id(_ecore_xcb_conn); + xcb_damage_create(_ecore_xcb_conn, damage, drawable, level); +// ecore_x_flush(); +#endif + + return damage; +} + +/** + * Destroy a damage object + * + * @param The damage object to destroy + * + * Destroys the damage object @p damage + * + * @ingroup Ecore_X_Damage_Group + */ +EAPI void +ecore_x_damage_free(Ecore_X_Damage damage) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_damage_avail) return; + +#ifdef ECORE_XCB_DAMAGE + xcb_damage_destroy(_ecore_xcb_conn, damage); +// ecore_x_flush(); +#endif +} + +/** + * Synchronously modifies the region + * + * @param damage The damage object to destroy + * @param repair The repair region + * @param parts The parts region + * + * Synchronously modifies the regions in the following manner: + * If @p repair is @c XCB_NONE: + * 1) parts = damage + * 2) damage = + * Otherwise: + * 1) parts = damage INTERSECT repair + * 2) damage = damage - parts + * 3) Generate DamageNotify for remaining damage areas + * + * @ingroup Ecore_X_Damage_Group + */ +EAPI void +ecore_x_damage_subtract(Ecore_X_Damage damage, + Ecore_X_Region repair, + Ecore_X_Region parts) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_damage_avail) return; + +#ifdef ECORE_XCB_DAMAGE + xcb_damage_subtract(_ecore_xcb_conn, damage, repair, parts); +// ecore_x_flush(); +#endif +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dnd.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dnd.c new file mode 100644 index 0000000..677de38 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dnd.c @@ -0,0 +1,689 @@ +#include "ecore_xcb_private.h" + +#ifndef MIN +# define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#endif + +/* local structures */ +typedef struct _Version_Cache_Item +{ + Ecore_X_Window win; + int ver; +} Version_Cache_Item; + +/* local function prototypes */ +static Eina_Bool _ecore_xcb_dnd_converter_copy(char *target __UNUSED__, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *tprop __UNUSED__, + int *count __UNUSED__); + +/* local variables */ +static int _ecore_xcb_dnd_init_count = 0; +static Ecore_X_DND_Source *_source = NULL; +static Ecore_X_DND_Target *_target = NULL; +static Version_Cache_Item *_version_cache = NULL; +static int _version_cache_num = 0, _version_cache_alloc = 0; +static void (*_posupdatecb)(void *, + Ecore_X_Xdnd_Position *); +static void *_posupdatedata; + +/* external variables */ +EAPI int ECORE_X_EVENT_XDND_ENTER = 0; +EAPI int ECORE_X_EVENT_XDND_POSITION = 0; +EAPI int ECORE_X_EVENT_XDND_STATUS = 0; +EAPI int ECORE_X_EVENT_XDND_LEAVE = 0; +EAPI int ECORE_X_EVENT_XDND_DROP = 0; +EAPI int ECORE_X_EVENT_XDND_FINISHED = 0; + +void +_ecore_xcb_dnd_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!_ecore_xcb_dnd_init_count) + { + _source = calloc(1, sizeof(Ecore_X_DND_Source)); + if (!_source) return; + _source->version = ECORE_X_DND_VERSION; + _source->win = XCB_NONE; + _source->dest = XCB_NONE; + _source->state = ECORE_X_DND_SOURCE_IDLE; + _source->prev.window = 0; + + _target = calloc(1, sizeof(Ecore_X_DND_Target)); + if (!_target) + { + free(_source); + _source = NULL; + return; + } + _target->win = XCB_NONE; + _target->source = XCB_NONE; + _target->state = ECORE_X_DND_TARGET_IDLE; + + ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new(); + ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new(); + ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new(); + ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new(); + ECORE_X_EVENT_XDND_DROP = ecore_event_type_new(); + ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new(); + } + _ecore_xcb_dnd_init_count++; +} + +void +_ecore_xcb_dnd_shutdown(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_xcb_dnd_init_count--; + if (_ecore_xcb_dnd_init_count > 0) return; + if (_source) free(_source); + _source = NULL; + if (_target) free(_target); + _target = NULL; + _ecore_xcb_dnd_init_count = 0; +} + +EAPI void +ecore_x_dnd_send_status(Eina_Bool will_accept, + Eina_Bool suppress, + Ecore_X_Rectangle rect, + Ecore_X_Atom action) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (_target->state == ECORE_X_DND_TARGET_IDLE) return; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + _target->will_accept = will_accept; + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.type = ECORE_X_ATOM_XDND_STATUS; + ev.format = 32; + ev.window = _target->source; + ev.data.data32[0] = _target->win; + ev.data.data32[1] = 0; + if (will_accept) ev.data.data32[1] |= 0x1UL; + if (!suppress) ev.data.data32[1] |= 0x2UL; + + ev.data.data32[2] = rect.x; + ev.data.data32[2] <<= 16; + ev.data.data32[2] |= rect.y; + ev.data.data32[3] = rect.width; + ev.data.data32[3] <<= 16; + ev.data.data32[3] |= rect.height; + + if (will_accept) + ev.data.data32[4] = action; + else + ev.data.data32[4] = XCB_NONE; + _target->accepted_action = action; + + xcb_send_event(_ecore_xcb_conn, 0, _target->source, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); +} + +EAPI Eina_Bool +ecore_x_dnd_drop(void) +{ + xcb_client_message_event_t ev; + Eina_Bool status = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + if (_source->dest) + { + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = _source->dest; + + if (_source->will_accept) + { + ev.type = ECORE_X_ATOM_XDND_DROP; + ev.data.data32[0] = _source->win; + ev.data.data32[1] = 0; + ev.data.data32[2] = _source->time; + + xcb_send_event(_ecore_xcb_conn, 0, _source->dest, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); + _source->state = ECORE_X_DND_SOURCE_DROPPED; + status = EINA_TRUE; + } + else + { + ev.type = ECORE_X_ATOM_XDND_LEAVE; + ev.data.data32[0] = _source->win; + ev.data.data32[1] = 0; + + xcb_send_event(_ecore_xcb_conn, 0, _source->dest, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); + _source->state = ECORE_X_DND_SOURCE_IDLE; + } + } + else + { + ecore_x_selection_xdnd_clear(); + _source->state = ECORE_X_DND_SOURCE_IDLE; + } + + ecore_x_window_ignore_set(_source->win, 0); + _source->prev.window = 0; + + return status; +} + +EAPI void +ecore_x_dnd_aware_set(Ecore_X_Window win, + Eina_Bool on) +{ + Ecore_X_Atom prop_data = ECORE_X_DND_VERSION; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (on) + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_AWARE, + ECORE_X_ATOM_ATOM, 32, &prop_data, 1); + else + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_AWARE); +} + +EAPI int +ecore_x_dnd_version_get(Ecore_X_Window win) +{ + unsigned char *data; + int num = 0; + Version_Cache_Item *t; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (_source->state == ECORE_X_DND_SOURCE_DRAGGING) + { + if (_version_cache) + { + int i = 0; + + for (i = 0; i < _version_cache_num; i++) + { + if (_version_cache[i].win == win) + return _version_cache[i].ver; + } + } + } + + if (ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_AWARE, + ECORE_X_ATOM_ATOM, 32, &data, &num)) + { + int version = 0; + + version = (int)*data; + free(data); + if (_source->state == ECORE_X_DND_SOURCE_DRAGGING) + { + _version_cache_num++; + if (_version_cache_num > _version_cache_alloc) + _version_cache_alloc += 16; + t = realloc(_version_cache, + _version_cache_alloc * sizeof(Version_Cache_Item)); + if (!t) return 0; + _version_cache = t; + _version_cache[_version_cache_num - 1].win = win; + _version_cache[_version_cache_num - 1].ver = version; + } + return version; + } + + if (_source->state == ECORE_X_DND_SOURCE_DRAGGING) + { + _version_cache_num++; + if (_version_cache_num > _version_cache_alloc) + _version_cache_alloc += 16; + t = realloc(_version_cache, + _version_cache_alloc * sizeof(Version_Cache_Item)); + if (!t) return 0; + _version_cache = t; + _version_cache[_version_cache_num - 1].win = win; + _version_cache[_version_cache_num - 1].ver = 0; + } + + return 0; +} + +EAPI Eina_Bool +ecore_x_dnd_type_isset(Ecore_X_Window win, + const char *type) +{ + int num = 0, i = 0; + Eina_Bool ret = EINA_FALSE; + unsigned char *data; + Ecore_X_Atom *atoms, atom; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST, + ECORE_X_ATOM_ATOM, 32, &data, &num)) + return ret; + + atom = ecore_x_atom_get(type); + atoms = (Ecore_X_Atom *)data; + for (i = 0; i < num; ++i) + { + if (atom == atoms[i]) + { + ret = EINA_TRUE; + break; + } + } + + free(data); + return ret; +} + +EAPI void +ecore_x_dnd_type_set(Ecore_X_Window win, + const char *type, + Eina_Bool on) +{ + Ecore_X_Atom atom, *oldset = NULL, *newset = NULL; + int i = 0, j = 0, num = 0; + unsigned char *data = NULL, *old_data = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + atom = ecore_x_atom_get(type); + ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST, + ECORE_X_ATOM_ATOM, 32, &old_data, &num); + oldset = (Ecore_X_Atom *)old_data; + if (on) + { + if (ecore_x_dnd_type_isset(win, type)) + { + free(old_data); + return; + } + newset = calloc(num + 1, sizeof(Ecore_X_Atom)); + if (!newset) return; + data = (unsigned char *)newset; + for (i = 0; i < num; i++) + newset[i + 1] = oldset[i]; + newset[0] = atom; + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST, + ECORE_X_ATOM_ATOM, 32, data, num + 1); + } + else + { + if (!ecore_x_dnd_type_isset(win, type)) + { + free(old_data); + return; + } + newset = calloc(num - 1, sizeof(Ecore_X_Atom)); + if (!newset) + { + free(old_data); + return; + } + data = (unsigned char *)newset; + for (i = 0; i < num; i++) + if (oldset[i] != atom) + newset[j++] = oldset[i]; + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST, + ECORE_X_ATOM_ATOM, 32, data, num - 1); + } + free(oldset); + free(newset); +} + +EAPI void +ecore_x_dnd_types_set(Ecore_X_Window win, + const char **types, + unsigned int num_types) +{ + Ecore_X_Atom *newset = NULL; + unsigned int i; + unsigned char *data = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!num_types) + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_TYPE_LIST); + else + { + newset = calloc(num_types, sizeof(Ecore_X_Atom)); + if (!newset) return; + + data = (unsigned char *)newset; + for (i = 0; i < num_types; i++) + { + newset[i] = ecore_x_atom_get(types[i]); + ecore_x_selection_converter_atom_add(newset[i], + _ecore_xcb_dnd_converter_copy); + } + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST, + ECORE_X_ATOM_ATOM, 32, data, + num_types); + free(newset); + } +} + +EAPI void +ecore_x_dnd_actions_set(Ecore_X_Window win, + Ecore_X_Atom *actions, + unsigned int num_actions) +{ + unsigned int i; + unsigned char *data = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!num_actions) + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_ACTION_LIST); + else + { + data = (unsigned char *)actions; + for (i = 0; i < num_actions; i++) + ecore_x_selection_converter_atom_add(actions[i], + _ecore_xcb_dnd_converter_copy); + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_ACTION_LIST, + ECORE_X_ATOM_ATOM, 32, data, + num_actions); + } +} + +/** + * The DND position update cb is called Ecore_X sends a DND position to a + * client. + * + * It essentially mirrors some of the data sent in the position message. + * Generally this cb should be set just before position update is called. + * Please note well you need to look after your own data pointer if someone + * trashes you position update cb set. + * + * It is considered good form to clear this when the dnd event finishes. + * + * @param cb Callback to updated each time ecore_x sends a position update. + * @param data User data. + */ +EAPI void +ecore_x_dnd_callback_pos_update_set(void (*cb)(void *, + Ecore_X_Xdnd_Position *data), + const void *data) +{ + _posupdatecb = cb; + _posupdatedata = (void *)data; +} + +EAPI Eina_Bool +ecore_x_dnd_begin(Ecore_X_Window source, + unsigned char *data, + int size) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_dnd_version_get(source)) return EINA_FALSE; + + /* Take ownership of XdndSelection */ + if (!ecore_x_selection_xdnd_set(source, data, size)) return EINA_FALSE; + + if (_version_cache) + { + free(_version_cache); + _version_cache = NULL; + _version_cache_num = 0; + _version_cache_alloc = 0; + } + + ecore_x_window_shadow_tree_flush(); + + _source->win = source; + ecore_x_window_ignore_set(_source->win, 1); + _source->state = ECORE_X_DND_SOURCE_DRAGGING; + _source->time = _ecore_xcb_events_last_time_get(); + _source->prev.window = 0; + + /* Default Accepted Action: move */ + _source->action = ECORE_X_ATOM_XDND_ACTION_MOVE; + _source->accepted_action = XCB_NONE; + _source->dest = XCB_NONE; + + return EINA_TRUE; +} + +EAPI void +ecore_x_dnd_send_finished(void) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (_target->state == ECORE_X_DND_TARGET_IDLE) return; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.type = ECORE_X_ATOM_XDND_FINISHED; + ev.window = _target->source; + ev.data.data32[0] = _target->win; + ev.data.data32[1] = 0; + ev.data.data32[2] = 0; + if (_target->will_accept) + { + ev.data.data32[1] |= 0x1UL; + ev.data.data32[2] = _target->accepted_action; + } + + xcb_send_event(_ecore_xcb_conn, 0, _target->source, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); + _target->state = ECORE_X_DND_TARGET_IDLE; +} + +EAPI void +ecore_x_dnd_source_action_set(Ecore_X_Atom action) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _source->action = action; + if (_source->prev.window) + _ecore_xcb_dnd_drag(_source->prev.window, + _source->prev.x, _source->prev.y); +} + +Ecore_X_DND_Source * +_ecore_xcb_dnd_source_get(void) +{ + return _source; +} + +Ecore_X_DND_Target * +_ecore_xcb_dnd_target_get(void) +{ + return _target; +} + +void +_ecore_xcb_dnd_drag(Ecore_X_Window root, + int x, + int y) +{ + xcb_client_message_event_t ev; + Ecore_X_Window win, *skip; + Ecore_X_Xdnd_Position pos; + int num = 0; + + if (_source->state != ECORE_X_DND_SOURCE_DRAGGING) return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + + skip = ecore_x_window_ignore_list(&num); + win = ecore_x_window_shadow_tree_at_xy_with_skip_get(root, x, y, skip, num); + while ((win) && !(ecore_x_dnd_version_get(win))) + win = ecore_x_window_shadow_parent_get(root, win); + + if ((_source->dest) && (win != _source->dest)) + { + ev.window = _source->dest; + ev.type = ECORE_X_ATOM_XDND_LEAVE; + ev.data.data32[0] = _source->win; + ev.data.data32[1] = 0; + + xcb_send_event(_ecore_xcb_conn, 0, _source->dest, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); + _source->suppress = 0; + } + + if (win) + { + int x1, x2, y1, y2; + + _source->version = MIN(ECORE_X_DND_VERSION, + ecore_x_dnd_version_get(win)); + if (win != _source->dest) + { + int i = 0; + unsigned char *data; + Ecore_X_Atom *types; + + ecore_x_window_prop_property_get(_source->win, + ECORE_X_ATOM_XDND_TYPE_LIST, + ECORE_X_ATOM_ATOM, 32, + &data, &num); + types = (Ecore_X_Atom *)data; + ev.window = win; + ev.type = ECORE_X_ATOM_XDND_ENTER; + ev.data.data32[0] = _source->win; + ev.data.data32[1] = 0; + if (num > 3) + ev.data.data32[1] |= 0x1UL; + else + ev.data.data32[1] &= 0xfffffffeUL; + ev.data.data32[1] |= ((unsigned long)_source->version) << 24; + + for (i = 2; i < 5; i++) + ev.data.data32[i] = 0; + for (i = 0; i < MIN(num, 3); ++i) + ev.data.data32[i + 2] = types[i]; + free(data); + + xcb_send_event(_ecore_xcb_conn, 0, win, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); + _source->await_status = 0; + _source->will_accept = 0; + } + + x1 = _source->rectangle.x; + x2 = _source->rectangle.x + _source->rectangle.width; + y1 = _source->rectangle.y; + y2 = _source->rectangle.y + _source->rectangle.height; + + if ((!_source->await_status) || (!_source->suppress) || + ((x < x1) || (x > x2) || (y < y1) || (y > y2))) + { + ev.window = win; + ev.type = ECORE_X_ATOM_XDND_POSITION; + ev.data.data32[0] = _source->win; + ev.data.data32[1] = 0; + ev.data.data32[2] = ((x << 16) & 0xffff0000) | (y & 0xffff); + ev.data.data32[3] = _source->time; + ev.data.data32[4] = _source->action; + + xcb_send_event(_ecore_xcb_conn, 0, win, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); + _source->await_status = 1; + } + } + + if (_posupdatecb) + { + pos.position.x = x; + pos.position.y = y; + pos.win = win; + pos.prev = _source->dest; + _posupdatecb(_posupdatedata, &pos); + } + + _source->prev.x = x; + _source->prev.y = y; + _source->prev.window = root; + _source->dest = win; +} + +EAPI Ecore_X_Atom +ecore_x_dnd_source_action_get(void) +{ + return _source->action; +} + +/* local functions */ +static Eina_Bool +_ecore_xcb_dnd_converter_copy(char *target __UNUSED__, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *tprop __UNUSED__, + int *count __UNUSED__) +{ + Ecore_Xcb_Textproperty text_prop; + Ecore_Xcb_Encoding_Style style = XcbTextStyle; + char *mystr; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if ((!data) || (!size)) return EINA_FALSE; + + mystr = calloc(1, size + 1); + if (!mystr) return EINA_FALSE; + + memcpy(mystr, data, size); + if (_ecore_xcb_mb_textlist_to_textproperty(&mystr, 1, style, &text_prop)) + { + int len; + + len = strlen((char *)text_prop.value) + 1; + if (!(*data_ret = malloc(len))) + { + free(mystr); + return EINA_FALSE; + } + memcpy(*data_ret, text_prop.value, len); + *size_ret = len; + free(text_prop.value); + free(mystr); + return EINA_TRUE; + } + else + { + free(mystr); + return EINA_FALSE; + } +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dpms.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dpms.c new file mode 100644 index 0000000..63b7f1e --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_dpms.c @@ -0,0 +1,318 @@ +#include "ecore_xcb_private.h" +#ifdef ECORE_XCB_DAMAGE +# include +#endif + +/* local variables */ +static Eina_Bool _dpms_avail = EINA_FALSE; + +void +_ecore_xcb_dpms_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_DPMS + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_dpms_id); +#endif +} + +void +_ecore_xcb_dpms_finalize(void) +{ +#ifdef ECORE_XCB_DPMS + const xcb_query_extension_reply_t *ext_reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_DPMS + ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_dpms_id); + if ((ext_reply) && (ext_reply->present)) + { + xcb_dpms_get_version_cookie_t cookie; + xcb_dpms_get_version_reply_t *reply; + + cookie = + xcb_dpms_get_version_unchecked(_ecore_xcb_conn, + XCB_DPMS_MAJOR_VERSION, + XCB_DPMS_MINOR_VERSION); + reply = xcb_dpms_get_version_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + if (reply->server_major_version >= 1) + _dpms_avail = EINA_TRUE; + free(reply); + } + } +#endif +} + +/** + * @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions + * + * Functions related to the X DPMS Extension + */ + +/** + * Checks if the DPMS extension is available or not. + * + * @return @c EINA_TRUE if the DPMS extension is available, + * @c EINA_FALSE otherwise. + * + * Return EINA_TRUE if the X server supports the DPMS Extension version 1.0, + * EINA_FALSE otherwise. + * + * @ingroup Ecore_X_DPMS_Group + */ +EAPI Eina_Bool +ecore_x_dpms_query(void) +{ +// LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _dpms_avail; +} + +/** + * Checks if the X server is capable of DPMS. + * @return @c 1 if the X server is capable of DPMS, @c 0 otherwise. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI Eina_Bool +ecore_x_dpms_capable_get(void) +{ + Eina_Bool ret = EINA_FALSE; +#ifdef ECORE_XCB_DPMS + xcb_dpms_capable_cookie_t cookie; + xcb_dpms_capable_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_dpms_avail) return EINA_FALSE; + +#ifdef ECORE_XCB_DPMS + cookie = xcb_dpms_capable_unchecked(_ecore_xcb_conn); + reply = xcb_dpms_capable_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + ret = reply->capable; + free(reply); + } +#endif + + return ret; +} + +/** + * Checks the DPMS state of the display. + * @return @c EINA_TRUE if DPMS is enabled, @c EINA_FALSE otherwise. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI Eina_Bool +ecore_x_dpms_enabled_get(void) +{ + Eina_Bool ret = EINA_FALSE; +#ifdef ECORE_XCB_DPMS + xcb_dpms_info_cookie_t cookie; + xcb_dpms_info_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_dpms_avail) return EINA_FALSE; + +#ifdef ECORE_XCB_DPMS + cookie = xcb_dpms_info_unchecked(_ecore_xcb_conn); + reply = xcb_dpms_info_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + if (reply->state) ret = EINA_TRUE; + free(reply); +#endif + + return ret; +} + +/** + * Sets the DPMS state of the display. + * @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI void +ecore_x_dpms_enabled_set(int enabled) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_dpms_avail) return; + +#ifdef ECORE_XCB_DPMS + if (enabled) + xcb_dpms_enable(_ecore_xcb_conn); + else + xcb_dpms_disable(_ecore_xcb_conn); +#endif +} + +/** + * Gets the timeouts. The values are in unit of seconds. + * @param standby Amount of time of inactivity before standby mode will be invoked. + * @param suspend Amount of time of inactivity before the screen is placed into suspend mode. + * @param off Amount of time of inactivity before the monitor is shut off. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI void +ecore_x_dpms_timeouts_get(unsigned int *standby, + unsigned int *suspend, + unsigned int *off) +{ +#ifdef ECORE_XCB_DPMS + xcb_dpms_get_timeouts_cookie_t cookie; + xcb_dpms_get_timeouts_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (standby) *standby = 0; + if (suspend) *suspend = 0; + if (off) *off = 0; + + if (!_dpms_avail) return; + +#ifdef ECORE_XCB_DPMS + cookie = xcb_dpms_get_timeouts_unchecked(_ecore_xcb_conn); + reply = xcb_dpms_get_timeouts_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return; + if (standby) *standby = reply->standby_timeout; + if (suspend) *suspend = reply->suspend_timeout; + if (off) *off = reply->off_timeout; + free(reply); +#endif +} + +/** + * Sets the timeouts. The values are in unit of seconds. + * @param standby Amount of time of inactivity before standby mode will be invoked. + * @param suspend Amount of time of inactivity before the screen is placed into suspend mode. + * @param off Amount of time of inactivity before the monitor is shut off. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI Eina_Bool +ecore_x_dpms_timeouts_set(unsigned int standby, + unsigned int suspend, + unsigned int off) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_dpms_avail) return EINA_FALSE; + +#ifdef ECORE_XCB_DPMS + // FIXME: Add request check + xcb_dpms_set_timeouts(_ecore_xcb_conn, standby, suspend, off); + return EINA_TRUE; +#endif + + return EINA_FALSE; +} + +/** + * Returns the amount of time of inactivity before standby mode is invoked. + * @return The standby timeout value. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI unsigned int +ecore_x_dpms_timeout_standby_get(void) +{ + unsigned int standby = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_dpms_timeouts_get(&standby, NULL, NULL); + return standby; +} + +/** + * Returns the amount of time of inactivity before the second level of + * power saving is invoked. + * @return The suspend timeout value. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI unsigned int +ecore_x_dpms_timeout_suspend_get(void) +{ + unsigned int suspend = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_dpms_timeouts_get(NULL, &suspend, NULL); + return suspend; +} + +/** + * Returns the amount of time of inactivity before the third and final + * level of power saving is invoked. + * @return The off timeout value. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI unsigned int +ecore_x_dpms_timeout_off_get(void) +{ + unsigned int off = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_dpms_timeouts_get(NULL, NULL, &off); + return off; +} + +/** + * Sets the standby timeout (in unit of seconds). + * @param new_standby Amount of time of inactivity before standby mode will be invoked. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI void +ecore_x_dpms_timeout_standby_set(unsigned int new_timeout) +{ + unsigned int standby = 0, suspend = 0, off = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_dpms_timeouts_get(&standby, &suspend, &off); + ecore_x_dpms_timeouts_set(new_timeout, suspend, off); +} + +/** + * Sets the suspend timeout (in unit of seconds). + * @param suspend Amount of time of inactivity before the screen is placed into suspend mode. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI void +ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout) +{ + unsigned int standby = 0, suspend = 0, off = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_dpms_timeouts_get(&standby, &suspend, &off); + ecore_x_dpms_timeouts_set(standby, new_timeout, off); +} + +/** + * Sets the off timeout (in unit of seconds). + * @param off Amount of time of inactivity before the monitor is shut off. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI void +ecore_x_dpms_timeout_off_set(unsigned int new_timeout) +{ + unsigned int standby = 0, suspend = 0, off = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_dpms_timeouts_get(&standby, &suspend, &off); + ecore_x_dpms_timeouts_set(standby, suspend, new_timeout); +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_drawable.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_drawable.c new file mode 100644 index 0000000..4e9a356 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_drawable.c @@ -0,0 +1,123 @@ +#include "ecore_xcb_private.h" + +/** + * @defgroup Ecore_X_Drawable_Group X Drawable Functions + * + * Functions that operate on drawables. + */ + +/** + * Fill the specified rectangle on a drawable. + * @param d The given drawable. + * @param gc The graphic context that controls the fill rules. + * @param x The X coordinate of the top-left corner of the rectangle. + * @param y The Y coordinate of the top-left corner of the rectangle. + * @param width The width of the rectangle. + * @param height The height of the rectangle. + */ +EAPI void +ecore_x_drawable_rectangle_fill(Ecore_X_Drawable draw, + Ecore_X_GC gc, + int x, + int y, + int w, + int h) +{ + xcb_rectangle_t rect; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + xcb_poly_fill_rectangle(_ecore_xcb_conn, draw, gc, 1, + (const xcb_rectangle_t *)&rect); +// ecore_x_flush(); +} + +/** + * Retrieves the geometry of the given drawable. + * @param d The given drawable. + * @param x Pointer to an integer into which the X position is to be stored. + * @param y Pointer to an integer into which the Y position is to be stored. + * @param w Pointer to an integer into which the width is to be stored. + * @param h Pointer to an integer into which the height is to be stored. + * @ingroup Ecore_X_Drawable_Group + */ +EAPI void +ecore_x_drawable_geometry_get(Ecore_X_Drawable draw, + int *x, + int *y, + int *w, + int *h) +{ + xcb_get_geometry_cookie_t cookie; + xcb_get_geometry_reply_t *reply; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = 0; + if (h) *h = 0; + cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, draw); + reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return; + if (x) *x = reply->x; + if (y) *y = reply->y; + if (w) *w = (int)reply->width; + if (h) *h = (int)reply->height; + free(reply); +} + +/** + * Retrieves the width of the border of the given drawable. + * @param d The given drawable. + * @return The border width of the given drawable. + * @ingroup Ecore_X_Drawable_Group + */ +EAPI int +ecore_x_drawable_border_width_get(Ecore_X_Drawable d) +{ + xcb_get_geometry_cookie_t cookie; + xcb_get_geometry_reply_t *reply; + int ret = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, d); + reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return 0; + ret = (int)reply->border_width; + free(reply); + return ret; +} + +/** + * Retrieves the depth of the given drawable. + * @param d The given drawable. + * @return The depth of the given drawable. + * @ingroup Ecore_X_Drawable_Group + */ +EAPI int +ecore_x_drawable_depth_get(Ecore_X_Drawable d) +{ + xcb_get_geometry_cookie_t cookie; + xcb_get_geometry_reply_t *reply; + int ret = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, d); + reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return 0; + ret = (int)reply->depth; + free(reply); + return ret; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_e.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_e.c new file mode 100644 index 0000000..c868f5e --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_e.c @@ -0,0 +1,1071 @@ +#include "ecore_xcb_private.h" + +/* local function prototypes */ +static Ecore_X_Atom _ecore_xcb_e_vkbd_atom_get(Ecore_X_Virtual_Keyboard_State state); +static Ecore_X_Virtual_Keyboard_State _ecore_xcb_e_vkbd_state_get(Ecore_X_Atom atom); +static Ecore_X_Atom _ecore_xcb_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state); +static Ecore_X_Illume_Quickpanel_State _ecore_xcb_e_quickpanel_state_get(Ecore_X_Atom atom); +static Ecore_X_Atom _ecore_xcb_e_illume_atom_get(Ecore_X_Illume_Mode mode); +static Ecore_X_Illume_Mode _ecore_xcb_e_illume_mode_get(Ecore_X_Atom atom); + +EAPI void +ecore_x_e_init(void) +{ +} + +EAPI void +ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root, + Ecore_X_Window win) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE; + ev.data.data32[0] = win; + ev.data.data32[1] = 0; + ev.data.data32[2] = 0; + ev.data.data32[3] = 0; + ev.data.data32[4] = 0; + + xcb_send_event(_ecore_xcb_conn, 0, root, + (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev); +// ecore_x_flush(); +} + +EAPI void +ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root, + Ecore_X_Window win, + int w, + int h) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE; + ev.data.data32[0] = win; + ev.data.data32[1] = 1; + ev.data.data32[2] = w; + ev.data.data32[3] = h; + ev.data.data32[4] = 0; + + xcb_send_event(_ecore_xcb_conn, 0, root, + (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev); +// ecore_x_flush(); +} + +EAPI void +ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, + Ecore_X_Sync_Counter counter) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (counter) + ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER, + ECORE_X_ATOM_CARDINAL, &counter, 1); + else + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER); +} + +EAPI Ecore_X_Sync_Counter +ecore_x_e_comp_sync_counter_get(Ecore_X_Window win) +{ + Ecore_X_Sync_Counter counter = 0; + int ret = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ret = ecore_x_window_prop_xid_get(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER, + ECORE_X_ATOM_CARDINAL, &counter, 1); + if (ret != 1) return 0; + return counter; +} + +EAPI Eina_Bool +ecore_x_e_comp_sync_supported_get(Ecore_X_Window root) +{ + Ecore_X_Window win, win2; + int ret = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + ret = + ecore_x_window_prop_xid_get(root, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, + ECORE_X_ATOM_WINDOW, &win, 1); + if ((ret == 1) && (win)) + { + ret = + ecore_x_window_prop_xid_get(win, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, + ECORE_X_ATOM_WINDOW, &win2, 1); + if ((ret == 1) && (win2 == win)) + return EINA_TRUE; + } + return EINA_FALSE; +} + +EAPI void +ecore_x_e_comp_sync_supported_set(Ecore_X_Window root, + Eina_Bool enabled) +{ + Ecore_X_Window win; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + if (enabled) + { + win = ecore_x_window_new(root, 1, 2, 3, 4); + ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, + ECORE_X_ATOM_WINDOW, &win, 1); + ecore_x_window_prop_xid_set(root, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, + ECORE_X_ATOM_WINDOW, &win, 1); + } + else + { + int ret = 0; + + ret = ecore_x_window_prop_xid_get(root, + ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, + ECORE_X_ATOM_WINDOW, &win, 1); + if ((ret == 1) && (win)) + { + ecore_x_window_prop_property_del(root, + ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED); + ecore_x_window_free(win); + } + } +} + +EAPI void +ecore_x_e_comp_sync_begin_send(Ecore_X_Window win) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = ECORE_X_ATOM_E_COMP_SYNC_BEGIN; + ev.data.data32[0] = win; + ev.data.data32[1] = 0; + ev.data.data32[2] = 0; + ev.data.data32[3] = 0; + ev.data.data32[4] = 0; + + xcb_send_event(_ecore_xcb_conn, 0, win, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); +} + +EAPI void +ecore_x_e_comp_sync_end_send(Ecore_X_Window win) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = ECORE_X_ATOM_E_COMP_SYNC_END; + ev.data.data32[0] = win; + ev.data.data32[1] = 0; + ev.data.data32[2] = 0; + ev.data.data32[3] = 0; + ev.data.data32[4] = 0; + + xcb_send_event(_ecore_xcb_conn, 0, win, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); +} + +EAPI void +ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = ECORE_X_ATOM_E_COMP_SYNC_CANCEL; + ev.data.data32[0] = win; + ev.data.data32[1] = 0; + ev.data.data32[2] = 0; + ev.data.data32[3] = 0; + ev.data.data32[4] = 0; + + xcb_send_event(_ecore_xcb_conn, 0, win, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); +} + +EAPI void +ecore_x_e_comp_flush_send(Ecore_X_Window win) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = ECORE_X_ATOM_E_COMP_FLUSH; + ev.data.data32[0] = win; + ev.data.data32[1] = 0; + ev.data.data32[2] = 0; + ev.data.data32[3] = 0; + ev.data.data32[4] = 0; + + xcb_send_event(_ecore_xcb_conn, 0, win, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); +} + +EAPI void +ecore_x_e_comp_dump_send(Ecore_X_Window win) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = ECORE_X_ATOM_E_COMP_DUMP; + ev.data.data32[0] = win; + ev.data.data32[1] = 0; + ev.data.data32[2] = 0; + ev.data.data32[3] = 0; + ev.data.data32[4] = 0; + + xcb_send_event(_ecore_xcb_conn, 0, win, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); +} + +EAPI void +ecore_x_e_comp_pixmap_set(Ecore_X_Window win, + Ecore_X_Pixmap pixmap) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (pixmap) + ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_PIXMAP, + ECORE_X_ATOM_PIXMAP, &pixmap, 1); + else + ecore_x_window_prop_property_del(win, pixmap); +} + +EAPI Ecore_X_Pixmap +ecore_x_e_comp_pixmap_get(Ecore_X_Window win) +{ + Ecore_X_Pixmap pixmap = 0; + int ret = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ret = ecore_x_window_prop_xid_get(win, ECORE_X_ATOM_E_COMP_PIXMAP, + ECORE_X_ATOM_PIXMAP, &pixmap, 1); + if (ret != 1) return 0; + return pixmap; +} + +EAPI void +ecore_x_e_frame_size_set(Ecore_X_Window win, + int fl, + int fr, + int ft, + int fb) +{ + uint32_t frames[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + frames[0] = fl; + frames[1] = fr; + frames[2] = ft; + frames[3] = fb; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_FRAME_SIZE, frames, 4); +} + +EAPI Ecore_X_Virtual_Keyboard_State +ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_atom_get(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE, + &atom, 1)) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN; + + return _ecore_xcb_e_vkbd_state_get(atom); +} + +EAPI void +ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win, + Ecore_X_Virtual_Keyboard_State state) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + atom = _ecore_xcb_e_vkbd_atom_get(state); + ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE, + &atom, 1); +} + +EAPI void +ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win, + Ecore_X_Virtual_Keyboard_State state) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + _ecore_xcb_e_vkbd_atom_get(state), + 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_virtual_keyboard_set(Ecore_X_Window win, + unsigned int is_keyboard) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD, + &is_keyboard, 1); +} + +EAPI Eina_Bool +ecore_x_e_virtual_keyboard_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD, + &val, 1)) + return EINA_FALSE; + + return val ? EINA_TRUE : EINA_FALSE; +} + +EAPI int +ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR, + &val, 1)) + return 0; + + return val; +} + +EAPI void +ecore_x_e_illume_quickpanel_priority_major_set(Ecore_X_Window win, + unsigned int priority) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR, + &priority, 1); +} + +EAPI int +ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR, + &val, 1)) + return 0; + + return val; +} + +EAPI void +ecore_x_e_illume_quickpanel_priority_minor_set(Ecore_X_Window win, + unsigned int priority) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR, + &priority, 1); +} + +EAPI void +ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win, + unsigned int zone) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE, + &zone, 1); +} + +EAPI int +ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE, + &val, 1)) + return 0; + + return val; +} + +EAPI void +ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_client_message32_send(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} + +EAPI Eina_Bool +ecore_x_e_illume_conformant_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT, + &val, 1)) + return EINA_FALSE; + + return val ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_x_e_illume_conformant_set(Ecore_X_Window win, + unsigned int is_conformant) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT, + &is_conformant, 1); +} + +EAPI void +ecore_x_e_illume_softkey_geometry_set(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + geom[0] = x; + geom[1] = y; + geom[2] = w; + geom[3] = h; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY, + geom, 4); +} + +EAPI Eina_Bool +ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *w, + int *h) +{ + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = 0; + if (h) *h = 0; + + if (ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY, + geom, 4) != 4) + return EINA_FALSE; + + if (x) *x = geom[0]; + if (y) *y = geom[1]; + if (w) *w = geom[2]; + if (h) *h = geom[3]; + + return EINA_TRUE; +} + +EAPI void +ecore_x_e_illume_indicator_geometry_set(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + geom[0] = x; + geom[1] = y; + geom[2] = w; + geom[3] = h; + ecore_x_window_prop_card32_set(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY, + geom, 4); +} + +EAPI Eina_Bool +ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *w, + int *h) +{ + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = 0; + if (h) *h = 0; + + if (ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY, + geom, 4) != 4) + return EINA_FALSE; + + if (x) *x = geom[0]; + if (y) *y = geom[1]; + if (w) *w = geom[2]; + if (h) *h = geom[3]; + + return EINA_TRUE; +} + +EAPI void +ecore_x_e_illume_keyboard_geometry_set(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + geom[0] = x; + geom[1] = y; + geom[2] = w; + geom[3] = h; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY, + geom, 4); +} + +EAPI Eina_Bool +ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *w, + int *h) +{ + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = 0; + if (h) *h = 0; + + if (ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY, + geom, 4) != 4) + return EINA_FALSE; + + if (x) *x = geom[0]; + if (y) *y = geom[1]; + if (w) *w = geom[2]; + if (h) *h = geom[3]; + + return EINA_TRUE; +} + +EAPI void +ecore_x_e_illume_quickpanel_set(Ecore_X_Window win, + unsigned int is_quickpanel) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL, + &is_quickpanel, 1); +} + +EAPI Eina_Bool +ecore_x_e_illume_quickpanel_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL, + &val, 1)) + return EINA_FALSE; + + return val ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win, + Ecore_X_Illume_Quickpanel_State state) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + atom = _ecore_xcb_e_quickpanel_atom_get(state); + ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE, + &atom, 1); +} + +EAPI Ecore_X_Illume_Quickpanel_State +ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_atom_get(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE, + &atom, 1)) + return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN; + + return _ecore_xcb_e_quickpanel_state_get(atom); +} + +EAPI void +ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win, + Ecore_X_Illume_Quickpanel_State state) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + _ecore_xcb_e_quickpanel_atom_get(state), + 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 0, 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_illume_mode_set(Ecore_X_Window win, + Ecore_X_Illume_Mode mode) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + atom = _ecore_xcb_e_illume_atom_get(mode); + ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_MODE, &atom, 1); +} + +EAPI Ecore_X_Illume_Mode +ecore_x_e_illume_mode_get(Ecore_X_Window win) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_atom_get(win, ECORE_X_ATOM_E_ILLUME_MODE, &atom, 1)) + return ECORE_X_ILLUME_MODE_UNKNOWN; + + return _ecore_xcb_e_illume_mode_get(atom); +} + +EAPI void +ecore_x_e_illume_mode_send(Ecore_X_Window win, + Ecore_X_Illume_Mode mode) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_MODE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + _ecore_xcb_e_illume_atom_get(mode), + 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_illume_focus_back_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_BACK, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_illume_focus_forward_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_illume_focus_home_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_HOME, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_illume_close_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_CLOSE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_illume_home_new_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_NEW, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_illume_home_del_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_DEL, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_illume_drag_set(Ecore_X_Window win, + unsigned int drag) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG, &drag, 1); +} + +EAPI void +ecore_x_e_illume_drag_locked_set(Ecore_X_Window win, + unsigned int is_locked) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED, + &is_locked, 1); +} + +EAPI Eina_Bool +ecore_x_e_illume_drag_locked_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED, + &val, 1)) + return EINA_FALSE; + + return val ? EINA_TRUE : EINA_FALSE; +} + +EAPI Eina_Bool +ecore_x_e_illume_drag_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_DRAG, &val, 1)) + return EINA_FALSE; + + return val ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_x_e_illume_drag_start_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_DRAG_START, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_illume_drag_end_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_DRAG_END, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} + +EAPI void +ecore_x_e_illume_zone_set(Ecore_X_Window win, + Ecore_X_Window zone) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE, &zone, 1); +} + +EAPI Ecore_X_Window +ecore_x_e_illume_zone_get(Ecore_X_Window win) +{ + Ecore_X_Window zone; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_window_get(win, ECORE_X_ATOM_E_ILLUME_ZONE, + &zone, 1)) + return 0; + + return zone; +} + +EAPI void +ecore_x_e_illume_zone_list_set(Ecore_X_Window win, + Ecore_X_Window *zones, + unsigned int num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE_LIST, + zones, num); +} + +/* local functions */ +static Ecore_X_Atom +_ecore_xcb_e_vkbd_atom_get(Ecore_X_Virtual_Keyboard_State state) +{ + switch (state) + { + case ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_ON: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_IP: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_URL: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME; + + default: + break; + } + return 0; +} + +static Ecore_X_Virtual_Keyboard_State +_ecore_xcb_e_vkbd_state_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_ON; + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF; + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA; + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC; + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN; + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER; + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX; + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL; + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD; + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_IP; + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST; + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE; + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_URL; + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD; + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME; + + return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN; +} + +static Ecore_X_Atom +_ecore_xcb_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state) +{ + switch (state) + { + case ECORE_X_ILLUME_QUICKPANEL_STATE_ON: + return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON; + + case ECORE_X_ILLUME_QUICKPANEL_STATE_OFF: + return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF; + + default: + break; + } + return 0; +} + +static Ecore_X_Illume_Quickpanel_State +_ecore_xcb_e_quickpanel_state_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON) + return ECORE_X_ILLUME_QUICKPANEL_STATE_ON; + if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF) + return ECORE_X_ILLUME_QUICKPANEL_STATE_OFF; + + return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN; +} + +static Ecore_X_Atom +_ecore_xcb_e_illume_atom_get(Ecore_X_Illume_Mode mode) +{ + switch (mode) + { + case ECORE_X_ILLUME_MODE_SINGLE: + return ECORE_X_ATOM_E_ILLUME_MODE_SINGLE; + + case ECORE_X_ILLUME_MODE_DUAL_TOP: + return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP; + + case ECORE_X_ILLUME_MODE_DUAL_LEFT: + return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT; + + default: + break; + } + return ECORE_X_ILLUME_MODE_UNKNOWN; +} + +static Ecore_X_Illume_Mode +_ecore_xcb_e_illume_mode_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE) + return ECORE_X_ILLUME_MODE_SINGLE; + if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP) + return ECORE_X_ILLUME_MODE_DUAL_TOP; + if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT) + return ECORE_X_ILLUME_MODE_DUAL_LEFT; + + return ECORE_X_ILLUME_MODE_UNKNOWN; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c new file mode 100644 index 0000000..bbd9c2a --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_error.c @@ -0,0 +1,109 @@ +#include "ecore_xcb_private.h" +#include + +/* local variables */ +static void (*_error_func)(void *data) = NULL; +static void *_error_data = NULL; +static void (*_io_error_func)(void *data) = NULL; +static void *_io_error_data = NULL; +static int _error_request_code = 0; +static int _error_code = 0; + +/** + * Set the error handler. + * @param func The error handler function + * @param data The data to be passed to the handler function + * + * Set the X error handler function + */ +EAPI void +ecore_x_error_handler_set(void (*func)(void *data), + const void *data) +{ + _error_func = func; + _error_data = (void *)data; +} + +/** + * Set the I/O error handler. + * @param func The I/O error handler function + * @param data The data to be passed to the handler function + * + * Set the X I/O error handler function + */ +EAPI void +ecore_x_io_error_handler_set(void (*func)(void *data), + const void *data) +{ + _io_error_func = func; + _io_error_data = (void *)data; +} + +/** + * Get the request code that caused the error. + * @return The request code causing the X error + * + * Return the X request code that caused the last X error + */ +EAPI int +ecore_x_error_request_get(void) +{ + return _error_request_code; +} + +/** + * Get the error code from the error. + * @return The error code from the X error + * + * Return the error code from the last X error + */ +EAPI int +ecore_x_error_code_get(void) +{ + return _error_code; +} + +int +_ecore_xcb_error_handle(xcb_generic_error_t *err) +{ + WRN("Got Error:"); + WRN("\tEvent: %s", xcb_event_get_request_label(err->major_code)); + WRN("\tError: %s", xcb_event_get_error_label(err->error_code)); + +#ifdef OLD_XCB_VERSION + if (err->error_code == XCB_EVENT_ERROR_BAD_VALUE) + WRN("\tBad Value: %d", ((xcb_value_error_t *)err)->bad_value); + else if (err->error_code == XCB_EVENT_ERROR_BAD_WINDOW) + WRN("\tBad Window: %d", ((xcb_window_error_t *)err)->bad_value); +#else + if (err->error_code == XCB_VALUE) + WRN("\tBad Value: %d", ((xcb_value_error_t *)err)->bad_value); + else if (err->error_code == XCB_WINDOW) + WRN("\tBad Window: %d", ((xcb_window_error_t *)err)->bad_value); +#endif + + _error_request_code = err->sequence; + _error_code = err->error_code; + if (_error_func) + _error_func(_error_data); + + return 0; +} + +int +_ecore_xcb_io_error_handle(xcb_generic_error_t *err) +{ + CRIT("IO Error:"); + if (err) + { + CRIT("\tRequest: %d", err->sequence); + CRIT("\tCode: %d", err->error_code); + } + if (_io_error_func) + _io_error_func(_io_error_data); + else + exit(-1); + + return 0; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_events.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_events.c new file mode 100644 index 0000000..8a18140 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_events.c @@ -0,0 +1,2805 @@ +#include "ecore_xcb_private.h" +//#include "Ecore_X_Atoms.h" +#include +#include +#include +# ifdef ECORE_XCB_DAMAGE +# include +# endif +# ifdef ECORE_XCB_RANDR +# include +# endif +# ifdef ECORE_XCB_SCREENSAVER +# include +# endif +# ifdef ECORE_XCB_SYNC +# include +# endif +# ifdef ECORE_XCB_XFIXES +# include +# endif +# ifdef ECORE_XCB_XGESTURE +# include +# endif + +#ifndef CODESET +# define CODESET "INVALID" +#endif + +typedef struct _Ecore_X_Mouse_Down_Info +{ + EINA_INLIST; + int dev; + Ecore_X_Time last_time; + Ecore_X_Time last_last_time; + Ecore_X_Window last_win; + Ecore_X_Window last_last_win; + Ecore_X_Window last_event_win; + Ecore_X_Window last_last_event_win; + Eina_Bool did_double : 1; + Eina_Bool did_triple : 1; +} Ecore_X_Mouse_Down_Info; + +/* local function prototypes */ +static void _ecore_xcb_event_handle_any_event(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_key_press(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_key_release(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_button_press(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_button_release(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_motion_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_enter_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_leave_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_keymap_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_focus_in(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_focus_out(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_expose(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_graphics_exposure(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_visibility_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_create_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_destroy_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_map_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_unmap_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_map_request(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_reparent_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_configure_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_configure_request(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_gravity_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_resize_request(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_circulate_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_circulate_request(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_property_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_selection_clear(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_selection_request(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_selection_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_colormap_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_client_message(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_mapping_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_damage_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_randr_change(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_randr_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_randr_crtc_change(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_randr_output_change(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_randr_output_property_change(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_screensaver_notify(xcb_generic_event_t *event); +#ifdef ECORE_XCB_XGESTURE +static void _ecore_xcb_event_handle_gesture_notify_flick(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_gesture_notify_pan(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_gesture_notify_pinchrotation(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_gesture_notify_tap(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_gesture_notify_tapnhold(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_gesture_notify_hold(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_gesture_notify_group(xcb_generic_event_t *event); +#endif +#ifdef ECORE_XCB_SHAPE +static void _ecore_xcb_event_handle_shape_change(xcb_generic_event_t *event); +#endif +static void _ecore_xcb_event_handle_sync_counter(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_sync_alarm(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_xfixes_selection_notify(xcb_generic_event_t *event __UNUSED__); +static void _ecore_xcb_event_handle_xfixes_cursor_notify(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_generic_event(xcb_generic_event_t *event); +static void _ecore_xcb_event_handle_input_event(xcb_generic_event_t *event); + +static void _ecore_xcb_event_key_press(xcb_generic_event_t *event); +static void _ecore_xcb_event_key_release(xcb_generic_event_t *event); +static void _ecore_xcb_event_mouse_move_free(void *data __UNUSED__, + void *event); +static Ecore_X_Event_Mode _ecore_xcb_event_mode_get(uint8_t mode); +static Ecore_X_Event_Detail _ecore_xcb_event_detail_get(uint8_t detail); +static void _ecore_xcb_event_xdnd_enter_free(void *data __UNUSED__, + void *event); +static void _ecore_xcb_event_selection_notify_free(void *data __UNUSED__, + void *event); +static void _ecore_xcb_event_generic_event_free(void *data, + void *event); +static void _ecore_xcb_event_mouse_down_info_clear(void); +static Ecore_X_Mouse_Down_Info *_ecore_xcb_event_mouse_down_info_get(int dev); + +/* local variables */ +static Eina_Bool _ecore_xcb_event_last_mouse_move = EINA_FALSE; +//static Ecore_Event *_ecore_xcb_event_last_mouse_move_event = NULL; +static Eina_Inlist *_ecore_xcb_mouse_down_info_list = NULL; +static Ecore_X_Time _ecore_xcb_event_last_time; +static Ecore_X_Window _ecore_xcb_event_last_window = 0; + +/* public variables */ +int16_t _ecore_xcb_event_last_root_x = 0; +int16_t _ecore_xcb_event_last_root_y = 0; + +EAPI int ECORE_X_EVENT_ANY = 0; +EAPI int ECORE_X_EVENT_MOUSE_IN = 0; +EAPI int ECORE_X_EVENT_MOUSE_OUT = 0; +EAPI int ECORE_X_EVENT_WINDOW_FOCUS_IN = 0; +EAPI int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0; +EAPI int ECORE_X_EVENT_WINDOW_KEYMAP = 0; +EAPI int ECORE_X_EVENT_WINDOW_DAMAGE = 0; +EAPI int ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = 0; +EAPI int ECORE_X_EVENT_WINDOW_CREATE = 0; +EAPI int ECORE_X_EVENT_WINDOW_DESTROY = 0; +EAPI int ECORE_X_EVENT_WINDOW_HIDE = 0; +EAPI int ECORE_X_EVENT_WINDOW_SHOW = 0; +EAPI int ECORE_X_EVENT_WINDOW_SHOW_REQUEST = 0; +EAPI int ECORE_X_EVENT_WINDOW_REPARENT = 0; +EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE = 0; +EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = 0; +EAPI int ECORE_X_EVENT_WINDOW_GRAVITY = 0; +EAPI int ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = 0; +EAPI int ECORE_X_EVENT_WINDOW_STACK = 0; +EAPI int ECORE_X_EVENT_WINDOW_STACK_REQUEST = 0; +EAPI int ECORE_X_EVENT_WINDOW_PROPERTY = 0; +EAPI int ECORE_X_EVENT_WINDOW_COLORMAP = 0; +EAPI int ECORE_X_EVENT_WINDOW_MAPPING = 0; +EAPI int ECORE_X_EVENT_MAPPING_CHANGE = 0; +EAPI int ECORE_X_EVENT_SELECTION_CLEAR = 0; +EAPI int ECORE_X_EVENT_SELECTION_REQUEST = 0; +EAPI int ECORE_X_EVENT_SELECTION_NOTIFY = 0; +EAPI int ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = 0; +EAPI int ECORE_X_EVENT_CLIENT_MESSAGE = 0; +EAPI int ECORE_X_EVENT_WINDOW_SHAPE = 0; +EAPI int ECORE_X_EVENT_SCREENSAVER_NOTIFY = 0; +EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_FLICK = 0; +EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PAN = 0; +EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION = 0; +EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAP = 0; +EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD = 0; +EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_HOLD = 0; +EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_GROUP = 0; +EAPI int ECORE_X_EVENT_SYNC_COUNTER = 0; +EAPI int ECORE_X_EVENT_SYNC_ALARM = 0; +EAPI int ECORE_X_EVENT_SCREEN_CHANGE = 0; +EAPI int ECORE_X_EVENT_DAMAGE_NOTIFY = 0; +EAPI int ECORE_X_EVENT_RANDR_CRTC_CHANGE = 0; +EAPI int ECORE_X_EVENT_RANDR_OUTPUT_CHANGE = 0; +EAPI int ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY = 0; +EAPI int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0; +EAPI int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0; +EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0; +EAPI int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = 0; +EAPI int ECORE_X_EVENT_PING = 0; +EAPI int ECORE_X_EVENT_DESKTOP_CHANGE = 0; +EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = 0; +EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = 0; +EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = 0; +EAPI int ECORE_X_EVENT_GENERIC = 0; + +void +_ecore_xcb_events_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ECORE_X_EVENT_ANY) + { + ECORE_X_EVENT_ANY = ecore_event_type_new(); + ECORE_X_EVENT_MOUSE_IN = ecore_event_type_new(); + ECORE_X_EVENT_MOUSE_OUT = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_KEYMAP = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_DAMAGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_CREATE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_DESTROY = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_HIDE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_SHOW = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_SHOW_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_REPARENT = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_CONFIGURE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_GRAVITY = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_STACK = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_STACK_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_PROPERTY = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_COLORMAP = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_MAPPING = ecore_event_type_new(); + ECORE_X_EVENT_MAPPING_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_SELECTION_CLEAR = ecore_event_type_new(); + ECORE_X_EVENT_SELECTION_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_SELECTION_NOTIFY = ecore_event_type_new(); + ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = ecore_event_type_new(); + ECORE_X_EVENT_CLIENT_MESSAGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_SHAPE = ecore_event_type_new(); + ECORE_X_EVENT_SCREENSAVER_NOTIFY = ecore_event_type_new(); + ECORE_X_EVENT_GESTURE_NOTIFY_FLICK = ecore_event_type_new(); + ECORE_X_EVENT_GESTURE_NOTIFY_PAN = ecore_event_type_new(); + ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION = ecore_event_type_new(); + ECORE_X_EVENT_GESTURE_NOTIFY_TAP = ecore_event_type_new(); + ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD = ecore_event_type_new(); + ECORE_X_EVENT_GESTURE_NOTIFY_HOLD = ecore_event_type_new(); + ECORE_X_EVENT_GESTURE_NOTIFY_GROUP = ecore_event_type_new(); + ECORE_X_EVENT_SYNC_COUNTER = ecore_event_type_new(); + ECORE_X_EVENT_SYNC_ALARM = ecore_event_type_new(); + ECORE_X_EVENT_SCREEN_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_RANDR_CRTC_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_RANDR_OUTPUT_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY = ecore_event_type_new(); + ECORE_X_EVENT_DAMAGE_NOTIFY = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_DESKTOP_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_STATE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_PING = ecore_event_type_new(); + ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = ecore_event_type_new(); + ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = ecore_event_type_new(); + ECORE_X_EVENT_GENERIC = ecore_event_type_new(); + } +} + +void +_ecore_xcb_events_shutdown(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_xcb_event_mouse_down_info_clear(); + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; +// if (_ecore_xcb_event_last_mouse_move_event) +// { +// ecore_event_del(_ecore_xcb_event_last_mouse_move_event); +// _ecore_xcb_event_last_mouse_move_event = NULL; +// } +} + +void +_ecore_xcb_events_handle(xcb_generic_event_t *ev) +{ + uint8_t response = 0; + +// LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + /* strip highest bit (set if event is generated) */ + response = (ev->response_type & ~0x80); + if (response == 0) + { + xcb_generic_error_t *err; + + err = (xcb_generic_error_t *)ev; + + /* NB: There is no way to check access of destroyed windows, + * so trap those cases and ignore. We also ignore BadValue from + * xcb_grab/ungrab_button (happens when we are using any_mod) + * and a few others */ +#ifdef OLD_XCB_VERSION + if (err->error_code == XCB_EVENT_ERROR_BAD_WINDOW) return; + else if (err->error_code == XCB_EVENT_ERROR_BAD_MATCH) + { + if ((err->major_code == XCB_SET_INPUT_FOCUS) || + (err->major_code == XCB_CONFIGURE_WINDOW)) + return; + } + else if (err->error_code == XCB_EVENT_ERROR_BAD_VALUE) + { + if ((err->major_code == XCB_KILL_CLIENT) || + (err->major_code == XCB_GRAB_BUTTON) || + (err->major_code == XCB_UNGRAB_BUTTON)) + return; + } +#else + if (err->error_code == XCB_WINDOW) return; + else if (err->error_code == XCB_MATCH) + { + if ((err->major_code == XCB_SET_INPUT_FOCUS) || + (err->major_code == XCB_CONFIGURE_WINDOW)) + return; + } + else if (err->error_code == XCB_VALUE) + { + if ((err->major_code == XCB_KILL_CLIENT) || + (err->major_code == XCB_GRAB_BUTTON) || + (err->major_code == XCB_UNGRAB_BUTTON)) + return; + } +#endif + WRN("Got Event Error:"); + WRN("\tMajor Code: %d", err->major_code); + WRN("\tMinor Code: %d", err->minor_code); + WRN("\tRequest: %s", xcb_event_get_request_label(err->major_code)); + WRN("\tError: %s", xcb_event_get_error_label(err->error_code)); + if (err->error_code == 2) // bad value + WRN("\tValue: %d", ((xcb_value_error_t *)err)->bad_value); + else if (err->error_code == 8) // bad match + WRN("\tMatch: %d", ((xcb_match_error_t *)err)->bad_value); + + if (err->major_code == XCB_SEND_EVENT) + { + WRN("\tSend Event Error"); + WRN("\t\tSeq: %d", ev->sequence); + WRN("\t\tFull Seq: %d", ev->full_sequence); + WRN("\t\tType: %d", ev->response_type); + } + /* if (err->major_code == 148) */ + /* { */ + /* printf("GOT 148 Error\n"); */ + /* } */ + return; + } + + /* FIXME: Filter event for xim when xcb supports xim */ + + _ecore_xcb_event_handle_any_event(ev); + + if (response == XCB_KEY_PRESS) + _ecore_xcb_event_handle_key_press(ev); + else if (response == XCB_KEY_RELEASE) + _ecore_xcb_event_handle_key_release(ev); + else if (response == XCB_BUTTON_PRESS) + _ecore_xcb_event_handle_button_press(ev); + else if (response == XCB_BUTTON_RELEASE) + _ecore_xcb_event_handle_button_release(ev); + else if (response == XCB_MOTION_NOTIFY) + _ecore_xcb_event_handle_motion_notify(ev); + else if (response == XCB_ENTER_NOTIFY) + _ecore_xcb_event_handle_enter_notify(ev); + else if (response == XCB_LEAVE_NOTIFY) + _ecore_xcb_event_handle_leave_notify(ev); + else if (response == XCB_KEYMAP_NOTIFY) + _ecore_xcb_event_handle_keymap_notify(ev); + else if (response == XCB_FOCUS_IN) + _ecore_xcb_event_handle_focus_in(ev); + else if (response == XCB_FOCUS_OUT) + _ecore_xcb_event_handle_focus_out(ev); + else if (response == XCB_EXPOSE) + _ecore_xcb_event_handle_expose(ev); + else if (response == XCB_GRAPHICS_EXPOSURE) + _ecore_xcb_event_handle_graphics_exposure(ev); + else if (response == XCB_VISIBILITY_NOTIFY) + _ecore_xcb_event_handle_visibility_notify(ev); + else if (response == XCB_CREATE_NOTIFY) + _ecore_xcb_event_handle_create_notify(ev); + else if (response == XCB_DESTROY_NOTIFY) + _ecore_xcb_event_handle_destroy_notify(ev); + else if (response == XCB_MAP_NOTIFY) + _ecore_xcb_event_handle_map_notify(ev); + else if (response == XCB_UNMAP_NOTIFY) + _ecore_xcb_event_handle_unmap_notify(ev); + else if (response == XCB_MAP_REQUEST) + _ecore_xcb_event_handle_map_request(ev); + else if (response == XCB_REPARENT_NOTIFY) + _ecore_xcb_event_handle_reparent_notify(ev); + else if (response == XCB_CONFIGURE_NOTIFY) + _ecore_xcb_event_handle_configure_notify(ev); + else if (response == XCB_CONFIGURE_REQUEST) + _ecore_xcb_event_handle_configure_request(ev); + else if (response == XCB_GRAVITY_NOTIFY) + _ecore_xcb_event_handle_gravity_notify(ev); + else if (response == XCB_RESIZE_REQUEST) + _ecore_xcb_event_handle_resize_request(ev); + else if (response == XCB_CIRCULATE_NOTIFY) + _ecore_xcb_event_handle_circulate_notify(ev); + else if (response == XCB_CIRCULATE_REQUEST) + _ecore_xcb_event_handle_circulate_request(ev); + else if (response == XCB_PROPERTY_NOTIFY) + _ecore_xcb_event_handle_property_notify(ev); + else if (response == XCB_SELECTION_CLEAR) + _ecore_xcb_event_handle_selection_clear(ev); + else if (response == XCB_SELECTION_REQUEST) + _ecore_xcb_event_handle_selection_request(ev); + else if (response == XCB_SELECTION_NOTIFY) + _ecore_xcb_event_handle_selection_notify(ev); + else if (response == XCB_COLORMAP_NOTIFY) + _ecore_xcb_event_handle_colormap_notify(ev); + else if (response == XCB_CLIENT_MESSAGE) + _ecore_xcb_event_handle_client_message(ev); + else if (response == XCB_MAPPING_NOTIFY) + _ecore_xcb_event_handle_mapping_notify(ev); + else if (response == 35) /* GenericEvent == 35 */ + _ecore_xcb_event_handle_generic_event(ev); +#ifdef ECORE_XCB_DAMAGE + else if ((_ecore_xcb_event_damage >= 0) && + (response == (_ecore_xcb_event_damage + XCB_DAMAGE_NOTIFY))) + _ecore_xcb_event_handle_damage_notify(ev); +#endif +#ifdef ECORE_XCB_RANDR + else if ((_ecore_xcb_event_randr >= 0) && + (response == + _ecore_xcb_event_randr + XCB_RANDR_SCREEN_CHANGE_NOTIFY)) + _ecore_xcb_event_handle_randr_change(ev); + else if ((_ecore_xcb_event_randr >= 0) && + (response == (_ecore_xcb_event_randr + XCB_RANDR_NOTIFY))) + _ecore_xcb_event_handle_randr_notify(ev); +#endif +#ifdef ECORE_XCB_SCREENSAVER + else if ((_ecore_xcb_event_screensaver >= 0) && + (response == + _ecore_xcb_event_screensaver + XCB_SCREENSAVER_NOTIFY)) + _ecore_xcb_event_handle_screensaver_notify(ev); +#endif +#ifdef ECORE_XCB_XGESTURE + else if ((_ecore_xcb_event_gesture >= 0) && + (response == + _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_FLICK)) + _ecore_xcb_event_handle_gesture_notify_flick(ev); + else if ((_ecore_xcb_event_gesture >= 0) && + (response == + _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_PAN)) + _ecore_xcb_event_handle_gesture_notify_pan(ev); + else if ((_ecore_xcb_event_gesture >= 0) && + (response == + _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_PINCH_ROTATION)) + _ecore_xcb_event_handle_gesture_notify_pinchrotation(ev); + else if ((_ecore_xcb_event_gesture >= 0) && + (response == + _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_TAP)) + _ecore_xcb_event_handle_gesture_notify_tap(ev); + else if ((_ecore_xcb_event_gesture >= 0) && + (response == + _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_TAP_N_HOLD)) + _ecore_xcb_event_handle_gesture_notify_tapnhold(ev); + else if ((_ecore_xcb_event_gesture >= 0) && + (response == + _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_HOLD)) + _ecore_xcb_event_handle_gesture_notify_hold(ev); + else if ((_ecore_xcb_event_gesture >= 0) && + (response == + _ecore_xcb_event_gesture + XCB_GESTURE_NOTIFY_GROUP)) + _ecore_xcb_event_handle_gesture_notify_group(ev); +#endif +#ifdef ECORE_XCB_SHAPE + else if ((_ecore_xcb_event_shape >= 0) && + (response == (_ecore_xcb_event_shape + XCB_SHAPE_NOTIFY))) + _ecore_xcb_event_handle_shape_change(ev); +#endif +#ifdef ECORE_XCB_SYNC + else if ((_ecore_xcb_event_sync >= 0) && + (response == (_ecore_xcb_event_sync + XCB_SYNC_COUNTER_NOTIFY))) + _ecore_xcb_event_handle_sync_counter(ev); + else if ((_ecore_xcb_event_sync >= 0) && + (response == (_ecore_xcb_event_sync + XCB_SYNC_ALARM_NOTIFY))) + _ecore_xcb_event_handle_sync_alarm(ev); +#endif +#ifdef ECORE_XCB_XFIXES + else if ((_ecore_xcb_event_xfixes >= 0) && + (response == + _ecore_xcb_event_xfixes + XCB_XFIXES_SELECTION_NOTIFY)) + _ecore_xcb_event_handle_xfixes_selection_notify(ev); + else if ((_ecore_xcb_event_xfixes >= 0) && + (response == (_ecore_xcb_event_xfixes + XCB_XFIXES_CURSOR_NOTIFY))) + _ecore_xcb_event_handle_xfixes_cursor_notify(ev); +#endif +} + +Ecore_X_Time +_ecore_xcb_events_last_time_get(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_event_last_time; +} + +EAPI void +ecore_x_event_mask_set(Ecore_X_Window win, + Ecore_X_Event_Mask mask) +{ + xcb_get_window_attributes_cookie_t cookie; + xcb_get_window_attributes_reply_t *reply; + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; + cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, win); + reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return; + + list = (mask | reply->your_event_mask); + free(reply); + xcb_change_window_attributes(_ecore_xcb_conn, win, + XCB_CW_EVENT_MASK, &list); +// ecore_x_flush(); +} + +EAPI void +ecore_x_event_mask_unset(Ecore_X_Window win, + Ecore_X_Event_Mask mask) +{ + xcb_get_window_attributes_cookie_t cookie; + xcb_get_window_attributes_reply_t *reply; + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; + cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, win); + reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return; + + list = (reply->your_event_mask & ~mask); + free(reply); + xcb_change_window_attributes(_ecore_xcb_conn, win, + XCB_CW_EVENT_MASK, &list); +// ecore_x_flush(); +} + +unsigned int +_ecore_xcb_events_modifiers_get(unsigned int state) +{ + unsigned int modifiers = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (state & ECORE_X_MODIFIER_SHIFT) + modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + if (state & ECORE_X_MODIFIER_CTRL) + modifiers |= ECORE_EVENT_MODIFIER_CTRL; + if (state & ECORE_X_MODIFIER_ALT) + modifiers |= ECORE_EVENT_MODIFIER_ALT; + if (state & ECORE_X_MODIFIER_WIN) + modifiers |= ECORE_EVENT_MODIFIER_WIN; + if (state & ECORE_X_LOCK_SCROLL) + modifiers |= ECORE_EVENT_LOCK_SCROLL; + if (state & ECORE_X_LOCK_CAPS) + modifiers |= ECORE_EVENT_LOCK_CAPS; + if (state & ECORE_X_LOCK_NUM) + modifiers |= ECORE_EVENT_LOCK_NUM; + if (state & ECORE_X_LOCK_SHIFT) + modifiers |= ECORE_EVENT_LOCK_SHIFT; + + return modifiers; +} + +/* local functions */ +static void +_ecore_xcb_event_handle_any_event(xcb_generic_event_t *event) +{ + xcb_generic_event_t *ev; + +// LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ev = malloc(sizeof(xcb_generic_event_t)); + if (!ev) return; + + memcpy(ev, event, sizeof(xcb_generic_event_t)); + ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_key_press(xcb_generic_event_t *event) +{ + _ecore_xcb_event_key_press(event); +} + +static void +_ecore_xcb_event_handle_key_release(xcb_generic_event_t *event) +{ + _ecore_xcb_event_key_release(event); +} + +static void +_ecore_xcb_event_handle_button_press(xcb_generic_event_t *event) +{ + xcb_button_press_event_t *ev; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + + ev = (xcb_button_press_event_t *)event; + if ((ev->detail > 3) && (ev->detail < 8)) + { + Ecore_Event_Mouse_Wheel *e; + + if (!(e = malloc(sizeof(Ecore_Event_Mouse_Wheel)))) return; + + e->timestamp = ev->time; + e->modifiers = _ecore_xcb_events_modifiers_get(ev->state); + switch (ev->detail) + { + case 4: + e->direction = 0; + e->z = -1; + break; + + case 5: + e->direction = 0; + e->z = 1; + break; + + case 6: + e->direction = 1; + e->z = -1; + break; + + case 7: + e->direction = 1; + e->z = 1; + break; + + default: + e->direction = 0; + e->z = 0; + break; + } + e->x = ev->event_x; + e->y = ev->event_y; + e->root.x = ev->root_x; + e->root.y = ev->root_y; + if (ev->child) + e->window = ev->child; + else + e->window = ev->event; + + e->event_window = ev->event; + e->same_screen = ev->same_screen; + e->root_window = ev->root; + + _ecore_xcb_event_last_time = e->timestamp; + _ecore_xcb_event_last_window = e->window; + _ecore_xcb_event_last_root_x = e->root.x; + _ecore_xcb_event_last_root_y = e->root.y; + + ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL); + + _ecore_xcb_window_grab_allow_events(ev->event, ev->child, + ECORE_EVENT_MOUSE_WHEEL, + e, ev->time); + } + else + { + Ecore_Event_Mouse_Button *e; + unsigned int child_win = 0; + + child_win = (ev->child ? ev->child : ev->event); + + _ecore_xcb_event_mouse_move(ev->time, ev->state, + ev->event_x, ev->event_y, + ev->root_x, ev->root_y, + ev->event, child_win, + ev->root, ev->same_screen, + 0, 1, 1, 1.0, 0.0, + ev->event_x, ev->event_y, + ev->root_x, ev->root_y); + + e = _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN, + ev->time, + ev->state, ev->detail, + ev->event_x, ev->event_y, + ev->root_x, ev->root_y, ev->event, + child_win, + ev->root, ev->same_screen, + 0, 1, 1, 1.0, 0.0, + ev->event_x, ev->event_y, + ev->root_x, ev->root_y); + if (e) + _ecore_xcb_window_grab_allow_events(ev->event, ev->child, + ECORE_EVENT_MOUSE_BUTTON_DOWN, + e, ev->time); + } +} + +static void +_ecore_xcb_event_handle_button_release(xcb_generic_event_t *event) +{ + xcb_button_release_event_t *ev; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_button_release_event_t *)event; + if ((ev->detail <= 3) || (ev->detail > 7)) + { + _ecore_xcb_event_mouse_move(ev->time, ev->state, + ev->event_x, ev->event_y, + ev->root_x, ev->root_y, + ev->event, + (ev->child ? ev->child : ev->event), + ev->root, ev->same_screen, + 0, 1, 1, 1.0, 0.0, + ev->event_x, ev->event_y, + ev->root_x, ev->root_y); + + _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP, ev->time, + ev->state, ev->detail, + ev->event_x, ev->event_y, ev->root_x, + ev->root_y, ev->event, + (ev->child ? ev->child : ev->event), + ev->root, ev->same_screen, + 0, 1, 1, 1.0, 0.0, + ev->event_x, ev->event_y, + ev->root_x, ev->root_y); + } +} + +static void +_ecore_xcb_event_handle_motion_notify(xcb_generic_event_t *event) +{ + xcb_motion_notify_event_t *ev; + + ev = (xcb_motion_notify_event_t *)event; + + /* if (_ecore_xcb_event_last_mouse_move_event) */ + /* { */ + /* ecore_event_del(_ecore_xcb_event_last_mouse_move_event); */ + /* _ecore_xcb_event_last_mouse_move = EINA_FALSE; */ + /* _ecore_xcb_event_last_mouse_move_event = NULL; */ + /* } */ + + _ecore_xcb_event_mouse_move(ev->time, ev->state, + ev->event_x, ev->event_y, + ev->root_x, ev->root_y, + ev->event, + (ev->child ? ev->child : ev->event), + ev->root, ev->same_screen, + 0, 1, 1, 1.0, 0.0, + ev->event_x, ev->event_y, + ev->root_x, ev->root_y); + _ecore_xcb_event_last_mouse_move = EINA_TRUE; + + _ecore_xcb_dnd_drag(ev->root, ev->root_x, ev->root_y); +} + +static void +_ecore_xcb_event_handle_enter_notify(xcb_generic_event_t *event) +{ + xcb_enter_notify_event_t *ev; + Ecore_X_Event_Mouse_In *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_enter_notify_event_t *)event; + + _ecore_xcb_event_mouse_move(ev->time, ev->state, + ev->event_x, ev->event_y, + ev->root_x, ev->root_y, + ev->event, + (ev->child ? ev->child : ev->event), + ev->root, ev->same_screen_focus, + 0, 1, 1, 1.0, 0.0, + ev->event_x, ev->event_y, + ev->root_x, ev->root_y); + + if (!(e = calloc(1, sizeof(Ecore_X_Event_Mouse_In)))) return; + + e->modifiers = _ecore_xcb_events_modifiers_get(ev->state); + e->x = ev->event_x; + e->y = ev->event_y; + e->root.x = ev->root_x; + e->root.y = ev->root_y; + if (ev->child) + e->win = ev->child; + else + e->win = ev->event; + e->event_win = ev->event; + e->same_screen = ev->same_screen_focus; + e->root_win = ev->root; + e->mode = _ecore_xcb_event_mode_get(ev->mode); + e->detail = _ecore_xcb_event_detail_get(ev->detail); + e->time = ev->time; + _ecore_xcb_event_last_time = e->time; + + ecore_event_add(ECORE_X_EVENT_MOUSE_IN, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_leave_notify(xcb_generic_event_t *event) +{ + xcb_leave_notify_event_t *ev; + Ecore_X_Event_Mouse_Out *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_enter_notify_event_t *)event; + + _ecore_xcb_event_mouse_move(ev->time, ev->state, + ev->event_x, ev->event_y, + ev->root_x, ev->root_y, + ev->event, + (ev->child ? ev->child : ev->event), + ev->root, ev->same_screen_focus, + 0, 1, 1, 1.0, 0.0, + ev->event_x, ev->event_y, + ev->root_x, ev->root_y); + + if (!(e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out)))) return; + + e->modifiers = _ecore_xcb_events_modifiers_get(ev->state); + e->x = ev->event_x; + e->y = ev->event_y; + e->root.x = ev->root_x; + e->root.y = ev->root_y; + if (ev->child) + e->win = ev->child; + else + e->win = ev->event; + e->event_win = ev->event; + e->same_screen = ev->same_screen_focus; + e->root_win = ev->root; + e->mode = _ecore_xcb_event_mode_get(ev->mode); + e->detail = _ecore_xcb_event_detail_get(ev->detail); + + e->time = ev->time; + _ecore_xcb_event_last_time = e->time; + _ecore_xcb_event_last_window = e->win; + _ecore_xcb_event_last_root_x = e->root.x; + _ecore_xcb_event_last_root_y = e->root.y; + + ecore_event_add(ECORE_X_EVENT_MOUSE_OUT, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_keymap_notify(xcb_generic_event_t *event __UNUSED__) +{ +// LOGFN(__FILE__, __LINE__, __FUNCTION__); + + // FIXME: handle this event type + _ecore_xcb_event_last_mouse_move = EINA_FALSE; +} + +static void +_ecore_xcb_event_handle_focus_in(xcb_generic_event_t *event) +{ + xcb_focus_in_event_t *ev; + Ecore_X_Event_Window_Focus_In *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_focus_in_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In)))) return; + + e->win = ev->event; + e->mode = _ecore_xcb_event_mode_get(ev->mode); + e->detail = _ecore_xcb_event_detail_get(ev->detail); + + e->time = _ecore_xcb_event_last_time; + _ecore_xcb_event_last_time = e->time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_focus_out(xcb_generic_event_t *event) +{ + xcb_focus_out_event_t *ev; + Ecore_X_Event_Window_Focus_Out *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_focus_out_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out)))) return; + + e->win = ev->event; + e->mode = _ecore_xcb_event_mode_get(ev->mode); + e->detail = _ecore_xcb_event_detail_get(ev->detail); + + e->time = _ecore_xcb_event_last_time; + _ecore_xcb_event_last_time = e->time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_expose(xcb_generic_event_t *event) +{ + xcb_expose_event_t *ev; + Ecore_X_Event_Window_Damage *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_expose_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Damage)))) return; + + e->win = ev->window; + e->time = _ecore_xcb_event_last_time; + e->x = ev->x; + e->y = ev->y; + e->w = ev->width; + e->h = ev->height; + e->count = ev->count; + + ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_graphics_exposure(xcb_generic_event_t *event) +{ + xcb_graphics_exposure_event_t *ev; + Ecore_X_Event_Window_Damage *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_graphics_exposure_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Damage)))) return; + + e->win = ev->drawable; + e->x = ev->x; + e->y = ev->y; + e->w = ev->width; + e->h = ev->height; + e->count = ev->count; + e->time = _ecore_xcb_event_last_time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_visibility_notify(xcb_generic_event_t *event) +{ + xcb_visibility_notify_event_t *ev; + Ecore_X_Event_Window_Visibility_Change *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_visibility_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change)))) + return; + + e->win = ev->window; + e->time = _ecore_xcb_event_last_time; + if (ev->state == XCB_VISIBILITY_FULLY_OBSCURED) + e->fully_obscured = 1; + else + e->fully_obscured = 0; + + ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_create_notify(xcb_generic_event_t *event) +{ + xcb_create_notify_event_t *ev; + Ecore_X_Event_Window_Create *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_create_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Create)))) return; + + e->win = ev->window; + e->parent = ev->parent; + if (ev->override_redirect) + e->override = 1; + else + e->override = 0; + e->x = ev->x; + e->y = ev->y; + e->w = ev->width; + e->h = ev->height; + e->border = ev->border_width; + e->time = _ecore_xcb_event_last_time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_CREATE, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_destroy_notify(xcb_generic_event_t *event) +{ + xcb_destroy_notify_event_t *ev; + Ecore_X_Event_Window_Destroy *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_destroy_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Destroy)))) return; + + e->win = ev->window; + e->event_win = ev->event; + if (e->win == _ecore_xcb_event_last_window) + _ecore_xcb_event_last_window = 0; + e->time = _ecore_xcb_event_last_time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_DESTROY, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_map_notify(xcb_generic_event_t *event) +{ + xcb_map_notify_event_t *ev; + Ecore_X_Event_Window_Show *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_map_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Show)))) return; + + e->win = ev->window; + e->event_win = ev->event; + e->time = _ecore_xcb_event_last_time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_unmap_notify(xcb_generic_event_t *event) +{ + xcb_unmap_notify_event_t *ev; + Ecore_X_Event_Window_Hide *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_unmap_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Hide)))) return; + + e->win = ev->window; + e->event_win = ev->event; + e->time = _ecore_xcb_event_last_time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_map_request(xcb_generic_event_t *event) +{ + xcb_map_request_event_t *ev; + Ecore_X_Event_Window_Show_Request *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_map_request_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Show_Request)))) return; + + e->win = ev->window; + e->parent = ev->parent; + e->time = _ecore_xcb_event_last_time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_reparent_notify(xcb_generic_event_t *event) +{ + xcb_reparent_notify_event_t *ev; + Ecore_X_Event_Window_Reparent *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_reparent_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Reparent)))) return; + + e->win = ev->window; + e->event_win = ev->event; + e->parent = ev->parent; + e->time = _ecore_xcb_event_last_time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_REPARENT, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_configure_notify(xcb_generic_event_t *event) +{ + xcb_configure_notify_event_t *ev; + Ecore_X_Event_Window_Configure *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_configure_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Configure)))) return; + + e->win = ev->window; + e->event_win = ev->event; + e->abovewin = ev->above_sibling; + e->x = ev->x; + e->y = ev->y; + e->w = ev->width; + e->h = ev->height; + e->border = ev->border_width; + e->override = ev->override_redirect; + /* send_event is bit 7 (0x80) of response_type */ + e->from_wm = ((ev->response_type & 0x80) ? 1 : 0); + e->time = _ecore_xcb_event_last_time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_configure_request(xcb_generic_event_t *event) +{ + xcb_configure_request_event_t *ev; + Ecore_X_Event_Window_Configure_Request *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_configure_request_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Configure_Request)))) + return; + + e->win = ev->window; + e->parent_win = ev->parent; + e->abovewin = ev->sibling; + e->x = ev->x; + e->y = ev->y; + e->w = ev->width; + e->h = ev->height; + e->border = ev->border_width; + e->value_mask = ev->value_mask; + switch (ev->stack_mode) + { + case XCB_STACK_MODE_ABOVE: + e->detail = ECORE_X_WINDOW_STACK_ABOVE; + break; + + case XCB_STACK_MODE_BELOW: + e->detail = ECORE_X_WINDOW_STACK_BELOW; + break; + + case XCB_STACK_MODE_TOP_IF: + e->detail = ECORE_X_WINDOW_STACK_TOP_IF; + break; + + case XCB_STACK_MODE_BOTTOM_IF: + e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF; + break; + + case XCB_STACK_MODE_OPPOSITE: + e->detail = ECORE_X_WINDOW_STACK_OPPOSITE; + break; + } + e->time = _ecore_xcb_event_last_time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_gravity_notify(xcb_generic_event_t *event __UNUSED__) +{ +/* + xcb_gravity_notify_event_t *ev; + Ecore_X_Event_Window_Gravity *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_gravity_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Gravity)))) return; + + e->win = ev->window; + e->event_win = ev->event; + e->time = _ecore_xcb_event_last_time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_GRAVITY, e, NULL, NULL); + */ +} + +static void +_ecore_xcb_event_handle_resize_request(xcb_generic_event_t *event) +{ + xcb_resize_request_event_t *ev; + Ecore_X_Event_Window_Resize_Request *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_resize_request_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Resize_Request)))) return; + + e->win = ev->window; + e->w = ev->width; + e->h = ev->height; + e->time = _ecore_xcb_event_last_time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_circulate_notify(xcb_generic_event_t *event) +{ + xcb_circulate_notify_event_t *ev; + Ecore_X_Event_Window_Stack *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_circulate_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Stack)))) return; + + e->win = ev->window; + e->event_win = ev->event; + if (ev->place == XCB_PLACE_ON_TOP) + e->detail = ECORE_X_WINDOW_STACK_ABOVE; + else + e->detail = ECORE_X_WINDOW_STACK_BELOW; + e->time = _ecore_xcb_event_last_time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_STACK, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_circulate_request(xcb_generic_event_t *event) +{ + xcb_circulate_request_event_t *ev; + Ecore_X_Event_Window_Stack_Request *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_circulate_request_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Stack_Request)))) return; + + e->win = ev->window; + e->parent = ev->event; + if (ev->place == XCB_PLACE_ON_TOP) + e->detail = ECORE_X_WINDOW_STACK_ABOVE; + else + e->detail = ECORE_X_WINDOW_STACK_BELOW; + e->time = _ecore_xcb_event_last_time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_STACK_REQUEST, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_property_notify(xcb_generic_event_t *event) +{ + xcb_property_notify_event_t *ev; + Ecore_X_Event_Window_Property *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_property_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Property)))) return; + + e->win = ev->window; + e->atom = ev->atom; + e->time = ev->time; + _ecore_xcb_event_last_time = e->time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_PROPERTY, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_selection_clear(xcb_generic_event_t *event) +{ + xcb_selection_clear_event_t *ev; + Ecore_X_Event_Selection_Clear *e; + Ecore_X_Atom sel; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_selection_clear_event_t *)event; + if (!(e = malloc(sizeof(Ecore_X_Event_Selection_Clear)))) return; + + e->win = ev->owner; + e->atom = sel = ev->selection; + if (sel == ECORE_X_ATOM_SELECTION_PRIMARY) + e->selection = ECORE_X_SELECTION_PRIMARY; + else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY) + e->selection = ECORE_X_SELECTION_SECONDARY; + else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD) + e->selection = ECORE_X_SELECTION_CLIPBOARD; + else + e->selection = ECORE_X_SELECTION_OTHER; + e->time = ev->time; + + ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_selection_request(xcb_generic_event_t *event) +{ + xcb_selection_request_event_t *ev; + Ecore_X_Event_Selection_Request *e; + Ecore_X_Selection_Intern *sd; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_selection_request_event_t *)event; + if (!(e = malloc(sizeof(Ecore_X_Event_Selection_Request)))) return; + + e->owner = ev->owner; + e->requestor = ev->requestor; + e->selection = ev->selection; + e->target = ev->target; + e->property = ev->property; + e->time = ev->time; + + ecore_event_add(ECORE_X_EVENT_SELECTION_REQUEST, e, NULL, NULL); + + if ((sd = _ecore_xcb_selection_get(ev->selection)) && + (sd->win == ev->owner)) + { + Ecore_X_Selection_Intern *si; + + si = _ecore_xcb_selection_get(ev->selection); + if (si->data) + { + Ecore_X_Atom property = XCB_NONE, type; + void *data = NULL; + int len = 0, typesize = 0; + + type = ev->target; + typesize = 8; + len = sd->length; + + if (!ecore_x_selection_convert(ev->selection, ev->target, + &data, &len, &type, &typesize)) + property = XCB_NONE; + else if (data) + { + ecore_x_window_prop_property_set(ev->requestor, ev->property, + type, typesize, data, len); + property = ev->property; + free(data); + } + ecore_x_selection_notify_send(ev->requestor, ev->selection, + ev->target, property, ev->time); + } + } +} + +static void +_ecore_xcb_event_handle_selection_notify(xcb_generic_event_t *event) +{ + xcb_selection_notify_event_t *ev; + Ecore_X_Event_Selection_Notify *e; + unsigned char *data = NULL; + Ecore_X_Atom selection; + int num = 0, format = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_selection_notify_event_t *)event; + selection = ev->selection; + if (ev->target == ECORE_X_ATOM_SELECTION_TARGETS) + { + format = + ecore_x_window_prop_property_get(ev->requestor, ev->property, + XCB_ATOM_ATOM, 32, &data, &num); + if (!format) return; + } + else + { + format = + ecore_x_window_prop_property_get(ev->requestor, ev->property, + XCB_GET_PROPERTY_TYPE_ANY, 8, + &data, &num); + if (!format) return; + } + + e = calloc(1, sizeof(Ecore_X_Event_Selection_Notify)); + if (!e) return; + e->win = ev->requestor; + e->time = ev->time; + e->atom = selection; + e->target = _ecore_xcb_selection_target_get(ev->target); + + if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) + e->selection = ECORE_X_SELECTION_PRIMARY; + else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) + e->selection = ECORE_X_SELECTION_SECONDARY; + else if (selection == ECORE_X_ATOM_SELECTION_XDND) + e->selection = ECORE_X_SELECTION_XDND; + else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) + e->selection = ECORE_X_SELECTION_CLIPBOARD; + else + e->selection = ECORE_X_SELECTION_OTHER; + + e->data = _ecore_xcb_selection_parse(e->target, data, num, format); + + ecore_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e, + _ecore_xcb_event_selection_notify_free, NULL); +} + +static void +_ecore_xcb_event_handle_colormap_notify(xcb_generic_event_t *event) +{ + xcb_colormap_notify_event_t *ev; + Ecore_X_Event_Window_Colormap *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_colormap_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Colormap)))) return; + + e->win = ev->window; + e->cmap = ev->colormap; + if (ev->state == XCB_COLORMAP_STATE_INSTALLED) + e->installed = 1; + else + e->installed = 0; + e->time = _ecore_xcb_event_last_time; + + ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_client_message(xcb_generic_event_t *event) +{ + xcb_client_message_event_t *ev; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_client_message_event_t *)event; + + /* Special client message event handling here. need to put LOTS of if */ + /* checks here and generate synthetic events per special message known */ + /* otherwise generate generic client message event. this would handle*/ + /* netwm, ICCCM, gnomewm, old kde and mwm hint client message protocols */ + + if ((ev->type == ECORE_X_ATOM_WM_PROTOCOLS) && (ev->format == 32) && + (ev->data.data32[0] == ECORE_X_ATOM_WM_DELETE_WINDOW)) + { + Ecore_X_Event_Window_Delete_Request *e; + + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Delete_Request)))) + return; + e->win = ev->window; + e->time = _ecore_xcb_event_last_time; + ecore_event_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL); + } + else if ((ev->type == ECORE_X_ATOM_NET_WM_MOVERESIZE) && + (ev->format == 32) && (ev->data.data32[2] < 9)) + { + Ecore_X_Event_Window_Move_Resize_Request *e; + + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Move_Resize_Request)))) + return; + e->win = ev->window; + e->x = ev->data.data32[0]; + e->y = ev->data.data32[1]; + e->direction = ev->data.data32[2]; + e->button = ev->data.data32[3]; + e->source = ev->data.data32[4]; + ecore_event_add(ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, e, NULL, NULL); + } + else if (ev->type == ECORE_X_ATOM_XDND_ENTER) + { + Ecore_X_Event_Xdnd_Enter *e; + Ecore_X_DND_Target *target; + + DBG("Got Xdnd Enter Event"); + if (!(e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter)))) return; + target = _ecore_xcb_dnd_target_get(); + target->state = ECORE_X_DND_TARGET_ENTERED; + target->source = ev->data.data32[0]; + target->win = ev->window; + target->version = (int)(ev->data.data32[1] >> 24); + if (target->version > ECORE_X_DND_VERSION) + { + WRN("DND: Requested version %d but we only support up to %d", + target->version, ECORE_X_DND_VERSION); + free(e); + return; + } + if (ev->data.data32[1] & 0x1UL) + { + unsigned char *data; + Ecore_X_Atom *types; + int num_ret = 0; + + if (!ecore_x_window_prop_property_get(target->source, + ECORE_X_ATOM_XDND_TYPE_LIST, + ECORE_X_ATOM_ATOM, 32, + &data, &num_ret)) + { + WRN("DND: Could not fetch data type list from source window"); + free(e); + return; + } + types = (Ecore_X_Atom *)data; + e->types = calloc(num_ret, sizeof(char *)); + if (e->types) + { + int i = 0; + + for (i = 0; i < num_ret; i++) + e->types[i] = ecore_x_atom_name_get(types[i]); + } + e->num_types = num_ret; + } + else + { + int i = 0; + + e->types = calloc(3, sizeof(char *)); + if (e->types) + { + while ((i < 3) && (ev->data.data32[i + 2])) + { + e->types[i] = + ecore_x_atom_name_get(ev->data.data32[i + 2]); + i++; + } + } + e->num_types = i; + } + + e->win = target->win; + e->source = target->source; + ecore_event_add(ECORE_X_EVENT_XDND_ENTER, e, + _ecore_xcb_event_xdnd_enter_free, NULL); + } + else if (ev->type == ECORE_X_ATOM_XDND_POSITION) + { + Ecore_X_Event_Xdnd_Position *e; + Ecore_X_DND_Target *target; + + DBG("Got Xdnd Position Event"); + target = _ecore_xcb_dnd_target_get(); + if ((target->source != (Ecore_X_Window)ev->data.data32[0]) || + (target->win != ev->window)) return; + target->pos.x = ev->data.data32[2] >> 16; + target->pos.y = ev->data.data32[2] & 0xFFFFUL; + target->action = ev->data.data32[4]; + target->time = (target->version >= 1) ? + (Ecore_X_Time)ev->data.data32[3] : XCB_CURRENT_TIME; + + e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position)); + if (!e) return; + e->win = target->win; + e->source = target->source; + e->position.x = target->pos.x; + e->position.y = target->pos.y; + e->action = target->action; + ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, NULL, NULL); + } + else if (ev->type == ECORE_X_ATOM_XDND_STATUS) + { + Ecore_X_Event_Xdnd_Status *e; + Ecore_X_DND_Source *source; + + DBG("Got Xdnd Status Event"); + source = _ecore_xcb_dnd_source_get(); + if ((source->win != ev->window) || + (source->dest != (Ecore_X_Window)ev->data.data32[0])) + return; + + source->await_status = 0; + source->will_accept = ev->data.data32[1] & 0x1UL; + source->suppress = (ev->data.data32[1] & 0x2UL) ? 0 : 1; + source->rectangle.x = ev->data.data32[2] >> 16; + source->rectangle.y = ev->data.data32[2] & 0xFFFFUL; + source->rectangle.width = ev->data.data32[3] >> 16; + source->rectangle.height = ev->data.data32[3] & 0xFFFFUL; + source->accepted_action = ev->data.data32[4]; + + e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status)); + if (!e) return; + e->win = source->win; + e->target = source->dest; + e->will_accept = source->will_accept; + e->rectangle.x = source->rectangle.x; + e->rectangle.y = source->rectangle.y; + e->rectangle.width = source->rectangle.width; + e->rectangle.height = source->rectangle.height; + e->action = source->accepted_action; + + ecore_event_add(ECORE_X_EVENT_XDND_STATUS, e, NULL, NULL); + } + else if (ev->type == ECORE_X_ATOM_XDND_LEAVE) + { + Ecore_X_Event_Xdnd_Leave *e; + Ecore_X_DND_Target *target; + + DBG("Got Xdnd Leave Event"); + target = _ecore_xcb_dnd_target_get(); + if ((target->source != (Ecore_X_Window)ev->data.data32[0]) || + (target->win != ev->window)) + return; + target->state = ECORE_X_DND_TARGET_IDLE; + e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave)); + if (!e) return; + e->win = ev->window; + e->source = (Ecore_X_Window)ev->data.data32[0]; + ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL); + } + else if (ev->type == ECORE_X_ATOM_XDND_DROP) + { + Ecore_X_Event_Xdnd_Drop *e; + Ecore_X_DND_Target *target; + + DBG("Got Xdnd Drop Event"); + target = _ecore_xcb_dnd_target_get(); + if ((target->source != (Ecore_X_Window)ev->data.data32[0]) || + (target->win != ev->window)) + return; + target->time = (target->version >= 1) ? + (Ecore_X_Time)ev->data.data32[2] : _ecore_xcb_event_last_time; + + e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop)); + if (!e) return; + e->win = target->win; + e->source = target->source; + e->action = target->action; + e->position.x = target->pos.x; + e->position.y = target->pos.y; + ecore_event_add(ECORE_X_EVENT_XDND_DROP, e, NULL, NULL); + } + else if (ev->type == ECORE_X_ATOM_XDND_FINISHED) + { + Ecore_X_Event_Xdnd_Finished *e; + Ecore_X_DND_Source *source; + Eina_Bool completed = EINA_TRUE; + + DBG("Got Xdnd Finished Event"); + source = _ecore_xcb_dnd_source_get(); + if ((source->win != ev->window) || + (source->dest != (Ecore_X_Window)ev->data.data32[0])) + return; + if ((source->version < 5) || (ev->data.data32[1] & 0x1UL)) + { + ecore_x_selection_xdnd_clear(); + source->state = ECORE_X_DND_SOURCE_IDLE; + } + else if (source->version >= 5) + { + completed = EINA_FALSE; + source->state = ECORE_X_DND_SOURCE_CONVERTING; + /* FIXME: Probably need to add a timer to switch back to idle + * and discard the selection data */ + } + + if (!(e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Finished)))) + return; + e->win = source->win; + e->target = source->dest; + e->completed = completed; + if (source->version >= 5) + { + source->accepted_action = ev->data.data32[2]; + e->action = source->accepted_action; + } + else + { + source->accepted_action = 0; + e->action = source->action; + } + ecore_event_add(ECORE_X_EVENT_XDND_FINISHED, e, NULL, NULL); + } + else if (ev->type == ECORE_X_ATOM_NET_WM_STATE) + { + Ecore_X_Event_Window_State_Request *e; + + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request)))) + return; + e->win = ev->window; + if (ev->data.data32[0] == 0) + e->action = ECORE_X_WINDOW_STATE_ACTION_REMOVE; + else if (ev->data.data32[0] == 1) + e->action = ECORE_X_WINDOW_STATE_ACTION_ADD; + else if (ev->data.data32[0] == 2) + e->action = ECORE_X_WINDOW_STATE_ACTION_TOGGLE; + else + { + free(e); + return; + } + e->state[0] = _ecore_xcb_netwm_window_state_get(ev->data.data32[1]); + if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN) + { + /* FIXME */ + } + e->state[1] = _ecore_xcb_netwm_window_state_get(ev->data.data32[2]); + if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN) + { + /* FIXME */ + } + e->source = ev->data.data32[3]; + ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL); + } +#ifdef OLD_XCB_VERSION + else if ((ev->type == ECORE_X_ATOM_WM_CHANGE_STATE) && + (ev->format == 32) && (ev->data.data32[0] == XCB_WM_STATE_ICONIC)) +#else + else if ((ev->type == ECORE_X_ATOM_WM_CHANGE_STATE) && (ev->format == 32) && + (ev->data.data32[0] == XCB_ICCCM_WM_STATE_ICONIC)) +#endif + { + Ecore_X_Event_Window_State_Request *e; + + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request)))) + return; + e->win = ev->window; + e->action = ECORE_X_WINDOW_STATE_ACTION_ADD; + e->state[0] = ECORE_X_WINDOW_STATE_ICONIFIED; + ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL); + } + else if ((ev->type == ECORE_X_ATOM_NET_WM_DESKTOP) && (ev->format == 32)) + { + Ecore_X_Event_Desktop_Change *e; + + if (!(e = calloc(1, sizeof(Ecore_X_Event_Desktop_Change)))) + return; + e->win = ev->window; + e->desk = ev->data.data32[0]; + e->source = ev->data.data32[1]; + ecore_event_add(ECORE_X_EVENT_DESKTOP_CHANGE, e, NULL, NULL); + } + else if (ev->type == ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS) + { + Ecore_X_Event_Frame_Extents_Request *e; + + if (!(e = calloc(1, sizeof(Ecore_X_Event_Frame_Extents_Request)))) + return; + e->win = ev->window; + ecore_event_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, e, NULL, NULL); + } + else if ((ev->type == ECORE_X_ATOM_WM_PROTOCOLS) && + ((Ecore_X_Atom)ev->data.data32[0] == ECORE_X_ATOM_NET_WM_PING) && + (ev->format == 32)) + { + Ecore_X_Event_Ping *e; + Ecore_X_Window root = 0; + int count = 0; + + if (!(e = calloc(1, sizeof(Ecore_X_Event_Ping)))) return; + e->win = ev->window; + e->time = ev->data.data32[1]; + e->event_win = ev->data.data32[2]; + ecore_event_add(ECORE_X_EVENT_PING, e, NULL, NULL); + + CHECK_XCB_CONN; + + count = xcb_setup_roots_length(xcb_get_setup(_ecore_xcb_conn)); + if (count > 1) + root = ecore_x_window_root_get(e->win); + else + root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + if (ev->window != root) + { + ev->window = root; + xcb_send_event(_ecore_xcb_conn, 0, root, + (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), + (const char *)&ev); +// ecore_x_flush(); + } + } + else if ((ev->type == ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN) && + (ev->format == 8)) + { + _ecore_xcb_netwm_startup_info_begin(ev->window, ev->data.data8[0]); + } + else if ((ev->type == ECORE_X_ATOM_NET_STARTUP_INFO) && (ev->format == 8)) + { + _ecore_xcb_netwm_startup_info(ev->window, ev->data.data8[0]); + } + else if ((ev->type == 27777) && (ev->data.data32[0] == 0x7162534) && + (ev->format == 32)) // && (ev->window = _private_window)) + { + if (ev->data.data32[1] == 0x10000001) + _ecore_xcb_window_button_grab_remove(ev->data.data32[2]); + else if (ev->data.data32[1] == 0x10000002) + _ecore_xcb_window_key_grab_remove(ev->data.data32[2]); + } + else + { + Ecore_X_Event_Client_Message *e; + int i = 0; + + if (!(e = calloc(1, sizeof(Ecore_X_Event_Client_Message)))) + return; + + e->win = ev->window; + e->message_type = ev->type; + e->format = ev->format; + for (i = 0; i < 5; i++) + e->data.l[i] = ev->data.data32[i]; + ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL); + } +} + +static void +_ecore_xcb_event_handle_mapping_notify(xcb_generic_event_t *event) +{ + xcb_mapping_notify_event_t *ev; + Ecore_X_Event_Mapping_Change *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + + ev = (xcb_mapping_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Mapping_Change)))) return; + + _ecore_xcb_keymap_refresh(ev); + _ecore_xcb_modifiers_get(); + + switch (ev->request) + { + case XCB_MAPPING_MODIFIER: + e->type = ECORE_X_MAPPING_MODIFIER; + break; + + case XCB_MAPPING_KEYBOARD: + e->type = ECORE_X_MAPPING_KEYBOARD; + break; + + case XCB_MAPPING_POINTER: + default: + e->type = ECORE_X_MAPPING_MOUSE; + break; + } + e->keycode = ev->first_keycode; + e->num = ev->count; + + ecore_event_add(ECORE_X_EVENT_MAPPING_CHANGE, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_damage_notify(xcb_generic_event_t *event) +{ +#ifdef ECORE_XCB_DAMAGE + xcb_damage_notify_event_t *ev; + Ecore_X_Event_Damage *e; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; +#ifdef ECORE_XCB_DAMAGE + ev = (xcb_damage_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Damage)))) return; + + e->level = ev->level; + e->drawable = ev->drawable; + e->damage = ev->damage; + e->time = ev->timestamp; + e->area.x = ev->area.x; + e->area.y = ev->area.y; + e->area.width = ev->area.width; + e->area.height = ev->area.height; + e->geometry.x = ev->geometry.x; + e->geometry.y = ev->geometry.y; + e->geometry.width = ev->geometry.width; + e->geometry.height = ev->geometry.height; + + ecore_event_add(ECORE_X_EVENT_DAMAGE_NOTIFY, e, NULL, NULL); +#endif +} + +static void +_ecore_xcb_event_handle_randr_change(xcb_generic_event_t *event) +{ +#ifdef ECORE_XCB_RANDR + xcb_randr_screen_change_notify_event_t *ev; + Ecore_X_Event_Screen_Change *e; +#endif + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; +#ifdef ECORE_XCB_RANDR + ev = (xcb_randr_screen_change_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Screen_Change)))) return; + + e->win = ev->request_window; + e->root = ev->root; + e->size.width = ev->width; + e->size.height = ev->height; + e->time = ev->timestamp; + e->config_time = ev->config_timestamp; + e->size.width_mm = ev->mwidth; + e->size.height_mm = ev->mheight; + e->orientation = ev->rotation; + e->subpixel_order = ev->subpixel_order; + + ecore_event_add(ECORE_X_EVENT_SCREEN_CHANGE, e, NULL, NULL); +#endif +} + +static void +_ecore_xcb_event_handle_randr_notify(xcb_generic_event_t *event) +{ +#ifdef ECORE_XCB_RANDR + xcb_randr_notify_event_t *ev; +#endif + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; +#ifdef ECORE_XCB_RANDR + ev = (xcb_randr_notify_event_t *)event; + switch (ev->subCode) + { + case XCB_RANDR_NOTIFY_CRTC_CHANGE: + _ecore_xcb_event_handle_randr_crtc_change(event); + break; + + case XCB_RANDR_NOTIFY_OUTPUT_CHANGE: + _ecore_xcb_event_handle_randr_output_change(event); + break; + + case XCB_RANDR_NOTIFY_OUTPUT_PROPERTY: + _ecore_xcb_event_handle_randr_output_property_change(event); + break; + + default: + break; + } +#endif +} + +static void +_ecore_xcb_event_handle_randr_crtc_change(xcb_generic_event_t *event) +{ +#ifdef ECORE_XCB_RANDR + xcb_randr_notify_event_t *ev; + Ecore_X_Event_Randr_Crtc_Change *e; +#endif + +#ifdef ECORE_XCB_RANDR + ev = (xcb_randr_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Randr_Crtc_Change)))) + return; + + e->win = ev->u.cc.window; + e->crtc = ev->u.cc.crtc; + e->mode = ev->u.cc.mode; + e->orientation = ev->u.cc.rotation; + e->geo.x = ev->u.cc.x; + e->geo.y = ev->u.cc.y; + e->geo.w = ev->u.cc.width; + e->geo.h = ev->u.cc.height; + + ecore_event_add(ECORE_X_EVENT_RANDR_CRTC_CHANGE, e, NULL, NULL); +#endif +} + +static void +_ecore_xcb_event_handle_randr_output_change(xcb_generic_event_t *event) +{ +#ifdef ECORE_XCB_RANDR + xcb_randr_notify_event_t *ev; + Ecore_X_Event_Randr_Output_Change *e; +#endif + +#ifdef ECORE_XCB_RANDR + ev = (xcb_randr_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Randr_Crtc_Change)))) + return; + + e->win = ev->u.oc.window; + e->output = ev->u.oc.output; + e->crtc = ev->u.oc.crtc; + e->mode = ev->u.oc.mode; + e->orientation = ev->u.oc.rotation; + e->connection = ev->u.oc.connection; + e->subpixel_order = ev->u.oc.subpixel_order; + + ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_CHANGE, e, NULL, NULL); +#endif +} + +static void +_ecore_xcb_event_handle_randr_output_property_change(xcb_generic_event_t *event) +{ +#ifdef ECORE_XCB_RANDR + xcb_randr_notify_event_t *ev; + Ecore_X_Event_Randr_Output_Property_Notify *e; +#endif + +#ifdef ECORE_XCB_RANDR + ev = (xcb_randr_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Property_Notify)))) + return; + + e->win = ev->u.op.window; + e->output = ev->u.op.output; + e->property = ev->u.op.atom; + e->time = ev->u.op.timestamp; + if (ev->u.op.status == XCB_PROPERTY_NEW_VALUE) + e->state = ECORE_X_RANDR_PROPERTY_CHANGE_ADD; + else + e->state = ECORE_X_RANDR_PROPERTY_CHANGE_DEL; + + ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, e, NULL, NULL); +#endif +} + +static void +_ecore_xcb_event_handle_screensaver_notify(xcb_generic_event_t *event) +{ +#ifdef ECORE_XCB_SCREENSAVER + xcb_screensaver_notify_event_t *ev; + Ecore_X_Event_Screensaver_Notify *e; +#endif + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; +#ifdef ECORE_XCB_SCREENSAVER + ev = (xcb_screensaver_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Screensaver_Notify)))) return; + + e->win = ev->window; + e->on = EINA_FALSE; + if (ev->state == XCB_SCREENSAVER_STATE_ON) e->on = EINA_TRUE; + e->time = ev->time; + + ecore_event_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY, e, NULL, NULL); +#endif +} + +#ifdef ECORE_XCB_XGESTURE +static void +_ecore_xcb_event_handle_gesture_notify_flick(xcb_generic_event_t *event) +{ + xcb_gesture_notify_flick_event_t *ev; + Ecore_X_Event_Gesture_Notify_Flick *e; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__); + + ev = (xcb_gesture_notify_flick_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Flick)))) return; + + e->win = ev->window; + e->time = ev->time; + e->subtype = ev->kind; + e->num_fingers = ev->num_finger; + e->distance = ev->distance; + e->duration = ev->duration; + e->direction = ev->direction; + e->angle = XFixedToDouble(ev->angle); + + ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_FLICK, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_gesture_notify_pan(xcb_generic_event_t *event) +{ + xcb_gesture_notify_pan_event_t *ev; + Ecore_X_Event_Gesture_Notify_Pan *e; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__); + + ev = (xcb_gesture_notify_pan_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Pan)))) return; + + e->win = ev->window; + e->time = ev->time; + e->subtype = ev->kind; + e->num_fingers = ev->num_finger; + e->dx = ev->dx; + e->dy = ev->dy; + e->distance = ev->distance; + e->duration = ev->duration; + e->direction = ev->direction; + + ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PAN, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_gesture_notify_pinchrotation(xcb_generic_event_t *event) +{ + xcb_gesture_notify_pinch_rotation_event_t *ev; + Ecore_X_Event_Gesture_Notify_PinchRotation *e; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__); + + ev = (xcb_gesture_notify_pinch_rotation_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_PinchRotation)))) return; + + e->win = ev->window; + e->time = ev->time; + e->subtype = ev->kind; + e->num_fingers = ev->num_finger; + e->distance = ev->distance; + e->cx = ev->cx; + e->cy = ev->cy; + e->zoom = XFixedToDouble(ev->zoom); + e->angle = XFixedToDouble(ev->angle); + + ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_gesture_notify_tap(xcb_generic_event_t *event) +{ + xcb_gesture_notify_tap_event_t *ev; + Ecore_X_Event_Gesture_Notify_Tap *e; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__); + + ev = (xcb_gesture_notify_tap_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Tap)))) return; + + e->win = ev->window; + e->time = ev->time; + e->subtype = ev->kind; + e->num_fingers = ev->num_finger; + e->cx = ev->cx; + e->cy = ev->cy; + e->tap_repeat = ev->tap_repeat; + e->interval = ev->interval; + + ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAP, e, NULL, NULL); +} + +static void +_ecore_xcb_event_handle_gesture_notify_tapnhold(xcb_generic_event_t *event) +{ + xcb_gesture_notify_tap_n_hold_event_t *ev; + Ecore_X_Event_Gesture_Notify_TapNHold *e; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__); + + ev = (xcb_gesture_notify_tap_n_hold_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_TapNHold)))) return; + + e->win = ev->window; + e->time = ev->time; + e->subtype = ev->kind; + e->num_fingers = ev->num_finger; + e->cx = ev->cx; + e->cy = ev->cy; + e->interval = ev->interval; + e->hold_time = ev->holdtime; + + ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD, e, NULL, NULL); +} + +static void + _ecore_xcb_event_handle_gesture_notify_hold(xcb_generic_event_t *event) +{ + xcb_gesture_notify_hold_event_t *ev; + Ecore_X_Event_Gesture_Notify_Hold *e; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__); + + ev = (xcb_gesture_notify_hold_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Hold)))) return; + + e->win = ev->window; + e->time = ev->time; + e->subtype = ev->kind; + e->num_fingers = ev->num_finger; + e->cx = ev->cx; + e->cy = ev->cy; + e->hold_time = ev->holdtime; + + ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_HOLD, e, NULL, NULL); +} + +static void + _ecore_xcb_event_handle_gesture_notify_group(xcb_generic_event_t *event) +{ + xcb_gesture_notify_group_event_t *ev; + Ecore_X_Event_Gesture_Notify_Group *e; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + fprintf(stderr, "[ECORE_XCB][%s]...\n", __FUNCTION__); + + ev = (xcb_gesture_notify_group_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Group)))) return; + + e->win = ev->window; + e->time = ev->time; + e->subtype = ev->kind; + e->num_groups = ev->num_group; + e->group_id = ev->groupid; + + ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_GROUP, e, NULL, NULL); +} +#endif + +#ifdef ECORE_XCB_SHAPE +static void +_ecore_xcb_event_handle_shape_change(xcb_generic_event_t *event) +{ + xcb_shape_notify_event_t *ev; + Ecore_X_Event_Window_Shape *e; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + ev = (xcb_shape_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Window_Shape)))) return; + + e->win = ev->affected_window; + e->time = ev->server_time; + switch (ev->shape_kind) + { + case XCB_SHAPE_SK_BOUNDING: + e->type = ECORE_X_SHAPE_BOUNDING; + break; + + case XCB_SHAPE_SK_CLIP: + e->type = ECORE_X_SHAPE_CLIP; + break; + + case XCB_SHAPE_SK_INPUT: + e->type = ECORE_X_SHAPE_INPUT; + break; + + default: + break; + } + e->x = ev->extents_x; + e->y = ev->extents_y; + e->w = ev->extents_width; + e->h = ev->extents_height; + e->shaped = ev->shaped; + + ecore_event_add(ECORE_X_EVENT_WINDOW_SHAPE, e, NULL, NULL); +} + +#endif + +static void +_ecore_xcb_event_handle_sync_counter(xcb_generic_event_t *event) +{ +#ifdef ECORE_XCB_SYNC + xcb_sync_counter_notify_event_t *ev; + Ecore_X_Event_Sync_Counter *e; +#endif + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + +#ifdef ECORE_XCB_SYNC + ev = (xcb_sync_counter_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Sync_Counter)))) return; + + e->time = ev->timestamp; + + ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL); +#endif +} + +static void +_ecore_xcb_event_handle_sync_alarm(xcb_generic_event_t *event) +{ +#ifdef ECORE_XCB_SYNC + xcb_sync_alarm_notify_event_t *ev; + Ecore_X_Event_Sync_Alarm *e; +#endif + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; +#ifdef ECORE_XCB_SYNC + ev = (xcb_sync_alarm_notify_event_t *)event; + if (!(e = calloc(1, sizeof(Ecore_X_Event_Sync_Alarm)))) return; + + e->time = ev->timestamp; + e->alarm = ev->alarm; + + ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL); +#endif +} + +static void +_ecore_xcb_event_handle_xfixes_selection_notify(xcb_generic_event_t *event) +{ +#ifdef ECORE_XCB_XFIXES + Ecore_X_Event_Fixes_Selection_Notify *e; + Ecore_X_Atom sel; + xcb_xfixes_selection_notify_event_t *ev; +#endif + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; +#ifdef ECORE_XCB_XFIXES + ev = (xcb_xfixes_selection_notify_event_t *)event; + + if (!(e = calloc(1, sizeof(*e)))) return; + + e->win = ev->window; + e->owner = ev->owner; + e->time = ev->timestamp; + e->selection_time = ev->selection_timestamp; + e->atom = sel = ev->selection; + if (sel == ECORE_X_ATOM_SELECTION_PRIMARY) + e->selection = ECORE_X_SELECTION_PRIMARY; + else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY) + e->selection = ECORE_X_SELECTION_SECONDARY; + else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD) + e->selection = ECORE_X_SELECTION_CLIPBOARD; + else + e->selection = ECORE_X_SELECTION_OTHER; + e->reason = ev->subtype; + + ecore_event_add(ECORE_X_EVENT_FIXES_SELECTION_NOTIFY, e, NULL, NULL); +#endif +} + +static void +_ecore_xcb_event_handle_xfixes_cursor_notify(xcb_generic_event_t *event __UNUSED__) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); +// FIXME: TBD +} + +static void +_ecore_xcb_event_handle_generic_event(xcb_generic_event_t *event) +{ + xcb_ge_event_t *ev; + Ecore_X_Event_Generic *e; + + ev = (xcb_ge_event_t *)event; + + /* pad0 *IS* extension - bug in xcb */ + if (ev->pad0 == _ecore_xcb_event_input) + { + _ecore_xcb_event_handle_input_event(event); +// FIXME: should we generate generic events as WELL as input events? +// return; + } + + if (!(e = calloc(1, sizeof(Ecore_X_Event_Generic)))) + return; + + DBG("Handle Generic Event: %d", ev->event_type); + + e->cookie = ev->sequence; + /* NB: These are bugs in xcb ge_event structure. The struct should have a + * field for extension & data, but does not. + * + * XCB people have been notified of this issue */ + e->extension = ev->pad0; + /* e->data = ev->pad1; */ + if (ev->length > 0) + { + int len = ev->length * sizeof(int); + e->data = malloc(len); + if (e->data) memcpy(e->data, &(event[1]), len); + } + + e->evtype = ev->event_type; + + ecore_event_add(ECORE_X_EVENT_GENERIC, e, + _ecore_xcb_event_generic_event_free, e->data); +} + +static void +_ecore_xcb_event_handle_input_event(xcb_generic_event_t *event) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_xcb_input_handle_event(event); +} + +static void +_ecore_xcb_event_key_press(xcb_generic_event_t *event) +{ + Ecore_Event_Key *e; + xcb_keysym_t sym = XCB_NO_SYMBOL; + xcb_keycode_t keycode = 0; + xcb_key_press_event_t *xevent; + char *keyname = NULL, *key = NULL; + char *compose = NULL; + char compose_buffer[256]; + int val = 0; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + + xevent = (xcb_key_press_event_t *)event; + keycode = xevent->detail; + + sym = _ecore_xcb_keymap_keycode_to_keysym(keycode, xevent->state); + keyname = _ecore_xcb_keymap_keysym_to_string(sym); + if (!keyname) + { + char buff[256]; + + snprintf(buff, sizeof(buff), "Keycode-%i", keycode); + keyname = buff; + } + + val = + _ecore_xcb_keymap_lookup_string(keycode, xevent->state, compose_buffer, + sizeof(compose_buffer), &sym); + if (val > 0) + { + compose_buffer[val] = 0; + compose = + eina_str_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer); + if (!compose) + ERR("Ecore_X cannot convert input key string '%s' to UTF-8. " + "Is Eina built with iconv support?", compose_buffer); + } + + key = _ecore_xcb_keymap_keysym_to_string(sym); + if (!key) key = keyname; + + e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + + (compose ? strlen(compose) : 0) + 3); + if (e) + { + e->keyname = (char *)(e + 1); + e->key = e->keyname + strlen(keyname) + 1; + + e->compose = NULL; + if (compose) e->compose = (e->key + strlen(key) + 1); + e->string = e->compose; + + strcpy((char *)e->keyname, keyname); + strcpy((char *)e->key, key); + if (compose) strcpy((char *)e->compose, compose); + + e->modifiers = _ecore_xcb_events_modifiers_get(xevent->state); + e->timestamp = xevent->time; + e->window = xevent->child ? xevent->child : xevent->event; + e->event_window = xevent->event; + e->same_screen = xevent->same_screen; + e->root_window = xevent->root; + + DBG("Sending Key Down Event: %s", e->keyname); + ecore_event_add(ECORE_EVENT_KEY_DOWN, e, NULL, NULL); + } + _ecore_xcb_event_last_time = xevent->time; +} + +static void +_ecore_xcb_event_key_release(xcb_generic_event_t *event) +{ + Ecore_Event_Key *e; + xcb_keysym_t sym = XCB_NO_SYMBOL; + xcb_keycode_t keycode = 0; + xcb_key_release_event_t *xevent; + char *keyname = NULL, *key = NULL; + char *compose = NULL; + char compose_buffer[256]; + int val = 0; + + _ecore_xcb_event_last_mouse_move = EINA_FALSE; + + xevent = (xcb_key_release_event_t *)event; + keycode = xevent->detail; + + sym = _ecore_xcb_keymap_keycode_to_keysym(keycode, xevent->state); + keyname = _ecore_xcb_keymap_keysym_to_string(sym); + if (!keyname) + { + char buff[256]; + + snprintf(buff, sizeof(buff), "Keycode-%i", keycode); + keyname = buff; + } + + val = + _ecore_xcb_keymap_lookup_string(keycode, xevent->state, compose_buffer, + sizeof(compose_buffer), &sym); + if (val > 0) + { + compose_buffer[val] = 0; + compose = + eina_str_convert(nl_langinfo(CODESET), "UTF-8", compose_buffer); +// tmp = compose; + } + + key = _ecore_xcb_keymap_keysym_to_string(sym); + if (!key) key = keyname; + + e = malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + + (compose ? strlen(compose) : 0) + 3); + if (e) + { + e->keyname = (char *)(e + 1); + e->key = e->keyname + strlen(keyname) + 1; + + e->compose = NULL; + if (compose) e->compose = (e->key + strlen(key) + 1); + e->string = e->compose; + + strcpy((char *)e->keyname, keyname); + strcpy((char *)e->key, key); + if (compose) strcpy((char *)e->compose, compose); + + e->modifiers = _ecore_xcb_events_modifiers_get(xevent->state); + e->timestamp = xevent->time; + e->window = xevent->child ? xevent->child : xevent->event; + e->event_window = xevent->event; + e->same_screen = xevent->same_screen; + e->root_window = xevent->root; + + ecore_event_add(ECORE_EVENT_KEY_UP, e, NULL, NULL); + } + _ecore_xcb_event_last_time = xevent->time; +} + +void +_ecore_xcb_event_mouse_move(uint16_t timestamp, + uint16_t modifiers, + int16_t x, + int16_t y, + int16_t root_x, + int16_t root_y, + xcb_window_t event_win, + xcb_window_t win, + xcb_window_t root_win, + uint8_t same_screen, + int dev, + double radx, + double rady, + double pressure, + double angle, + int16_t mx, + int16_t my, + int16_t mrx, + int16_t mry) +{ + Ecore_Event_Mouse_Move *e; + Ecore_Event *event; + + if (!(e = malloc(sizeof(Ecore_Event_Mouse_Move)))) return; + + e->window = win; + e->root_window = root_win; + e->timestamp = timestamp; + e->same_screen = same_screen; + e->event_window = event_win; + e->modifiers = _ecore_xcb_events_modifiers_get(modifiers); + e->x = x; + e->y = y; + e->root.x = root_x; + e->root.y = root_y; + e->multi.device = dev; + e->multi.radius = ((radx + rady) / 2); + e->multi.radius_x = radx; + e->multi.radius_y = rady; + e->multi.pressure = pressure; + e->multi.angle = angle; + e->multi.x = mx; + e->multi.y = my; + e->multi.root.x = mrx; + e->multi.root.y = mry; + + event = ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, + _ecore_xcb_event_mouse_move_free, NULL); + + _ecore_xcb_event_last_time = e->timestamp; + _ecore_xcb_event_last_window = e->window; + _ecore_xcb_event_last_root_x = root_x; + _ecore_xcb_event_last_root_y = root_y; +// _ecore_xcb_event_last_mouse_move_event = event; +} + +static void +_ecore_xcb_event_mouse_move_free(void *data __UNUSED__, + void *event) +{ + Ecore_Event_Mouse_Move *ev; + + ev = event; +// if (_ecore_xcb_event_last_mouse_move_event) +// { +// _ecore_xcb_event_last_mouse_move = EINA_FALSE; +// _ecore_xcb_event_last_mouse_move_event = NULL; +// } + if (ev) free(ev); +} + +Ecore_Event_Mouse_Button * +_ecore_xcb_event_mouse_button(int event, + uint16_t timestamp, + uint16_t modifiers, + xcb_button_t buttons, + int16_t x, + int16_t y, + int16_t root_x, + int16_t root_y, + xcb_window_t event_win, + xcb_window_t win, + xcb_window_t root_win, + uint8_t same_screen, + int dev, + double radx, + double rady, + double pressure, + double angle, + int16_t mx, + int16_t my, + int16_t mrx, + int16_t mry) +{ + Ecore_Event_Mouse_Button *e; + Ecore_X_Mouse_Down_Info *info = NULL; + + if (!(e = malloc(sizeof(Ecore_Event_Mouse_Button)))) return NULL; + + e->window = win; + e->root_window = root_win; + e->timestamp = timestamp; + e->same_screen = same_screen; + e->event_window = event_win; + e->buttons = buttons; + e->modifiers = _ecore_xcb_events_modifiers_get(modifiers); + e->double_click = 0; + e->triple_click = 0; + e->x = x; + e->y = y; + e->root.x = root_x; + e->root.y = root_y; + + if ((info = _ecore_xcb_event_mouse_down_info_get(dev))) + { + if ((event == ECORE_EVENT_MOUSE_BUTTON_DOWN) && + (info->did_triple)) + { + info->last_win = 0; + info->last_last_win = 0; + info->last_event_win = 0; + info->last_time = 0; + info->last_last_time = 0; + } + if (event_win == win) + { + if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) + { + if (((int)(timestamp - info->last_time) <= + (int)(1000 * _ecore_xcb_double_click_time)) && + (win == info->last_win) && + (event_win == info->last_event_win)) + { + e->double_click = 1; + info->did_double = EINA_TRUE; + } + else + { + info->did_double = EINA_FALSE; + info->did_triple = EINA_FALSE; + } + if (((int)(timestamp - info->last_last_time) <= + (int)(2 * 1000 * _ecore_xcb_double_click_time)) && + (win == info->last_win) && + (win == info->last_last_win) && + (event_win == info->last_event_win) && + (event_win == info->last_last_event_win)) + { + e->triple_click = 1; + info->did_triple = EINA_TRUE; + } + else + info->did_triple = EINA_FALSE; + } + else + { + if (info->did_double) e->double_click = 1; + if (info->did_triple) e->triple_click = 1; + } + } + } + + /* NB: Comment out right now because _ecore_xcb_mouse_up_count is + * only used here...nowhere else in the code */ + + /* if ((event == ECORE_EVENT_MOUSE_BUTTON_DOWN) && */ + /* (!e->double_click) && (!e->triple_click)) */ + /* _ecore_xcb_mouse_up_count = 0; */ + + e->multi.device = dev; + e->multi.radius = ((radx + rady) / 2); + e->multi.radius_x = radx; + e->multi.radius_y = rady; + e->multi.pressure = pressure; + e->multi.angle = angle; + e->multi.x = mx; + e->multi.y = my; + e->multi.root.x = mrx; + e->multi.root.y = mry; + + _ecore_xcb_event_last_time = e->timestamp; + _ecore_xcb_event_last_window = e->window; + _ecore_xcb_event_last_root_x = root_x; + _ecore_xcb_event_last_root_y = root_y; + + ecore_event_add(event, e, NULL, NULL); + + if ((info) && (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) && + (win == event_win) && (!info->did_triple)) + { + info->last_last_win = info->last_win; + info->last_win = win; + info->last_last_event_win = info->last_event_win; + info->last_event_win = event_win; + info->last_last_time = info->last_time; + info->last_time = timestamp; + } + + return e; +} + +static Ecore_X_Event_Mode +_ecore_xcb_event_mode_get(uint8_t mode) +{ + switch (mode) + { + case XCB_NOTIFY_MODE_NORMAL: + return ECORE_X_EVENT_MODE_NORMAL; + + case XCB_NOTIFY_MODE_WHILE_GRABBED: + return ECORE_X_EVENT_MODE_WHILE_GRABBED; + + case XCB_NOTIFY_MODE_GRAB: + return ECORE_X_EVENT_MODE_GRAB; + + case XCB_NOTIFY_MODE_UNGRAB: + return ECORE_X_EVENT_MODE_UNGRAB; + + default: + return ECORE_X_EVENT_MODE_NORMAL; + } +} + +static Ecore_X_Event_Detail +_ecore_xcb_event_detail_get(uint8_t detail) +{ + switch (detail) + { + case XCB_NOTIFY_DETAIL_ANCESTOR: + return ECORE_X_EVENT_DETAIL_ANCESTOR; + + case XCB_NOTIFY_DETAIL_VIRTUAL: + return ECORE_X_EVENT_DETAIL_VIRTUAL; + + case XCB_NOTIFY_DETAIL_INFERIOR: + return ECORE_X_EVENT_DETAIL_INFERIOR; + + case XCB_NOTIFY_DETAIL_NONLINEAR: + return ECORE_X_EVENT_DETAIL_NON_LINEAR; + + case XCB_NOTIFY_DETAIL_NONLINEAR_VIRTUAL: + return ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL; + + case XCB_NOTIFY_DETAIL_POINTER: + return ECORE_X_EVENT_DETAIL_POINTER; + + case XCB_NOTIFY_DETAIL_POINTER_ROOT: + return ECORE_X_EVENT_DETAIL_POINTER_ROOT; + + case XCB_NOTIFY_DETAIL_NONE: + default: + return ECORE_X_EVENT_DETAIL_ANCESTOR; + } +} + +static void +_ecore_xcb_event_xdnd_enter_free(void *data __UNUSED__, + void *event) +{ + Ecore_X_Event_Xdnd_Enter *e; + int i = 0; + + e = event; + for (i = 0; i < e->num_types; i++) + free(e->types[i]); + free(e->types); + free(e); +} + +static void +_ecore_xcb_event_selection_notify_free(void *data __UNUSED__, + void *event) +{ + Ecore_X_Event_Selection_Notify *e; + Ecore_X_Selection_Data *sel; + + e = event; + if (!(sel = e->data)) return; + if (sel->free) sel->free(sel); + free(e->target); + free(e); +} + +static void +_ecore_xcb_event_generic_event_free(void *data, + void *event) +{ + Ecore_X_Event_Generic *e; + + e = (Ecore_X_Event_Generic *)event; + if (e->data) free(data); + free(e); +} + +static void +_ecore_xcb_event_mouse_down_info_clear(void) +{ + Eina_Inlist *l; + Ecore_X_Mouse_Down_Info *info = NULL; + + l = _ecore_xcb_mouse_down_info_list; + while (l) + { + info = EINA_INLIST_CONTAINER_GET(l, Ecore_X_Mouse_Down_Info); + l = eina_inlist_remove(l, l); + free(info); + } + _ecore_xcb_mouse_down_info_list = NULL; +} + +static Ecore_X_Mouse_Down_Info * +_ecore_xcb_event_mouse_down_info_get(int dev) +{ + Eina_Inlist *l; + Ecore_X_Mouse_Down_Info *info = NULL; + + l = _ecore_xcb_mouse_down_info_list; + EINA_INLIST_FOREACH(l, info) + if (info->dev == dev) return info; + + if (!(info = calloc(1, sizeof(Ecore_X_Mouse_Down_Info)))) return NULL; + + info->dev = dev; + l = eina_inlist_append(l, (Eina_Inlist *)info); + _ecore_xcb_mouse_down_info_list = l; + + return info; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_extensions.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_extensions.c new file mode 100644 index 0000000..40c10ac --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_extensions.c @@ -0,0 +1,148 @@ +#include "ecore_xcb_private.h" + +void +_ecore_xcb_extensions_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_big_requests_id); + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_shm_id); + +#ifdef ECORE_XCB_SHAPE + _ecore_xcb_shape_init(); +#endif + +#ifdef ECORE_XCB_SCREENSAVER + _ecore_xcb_screensaver_init(); +#endif + +#ifdef ECORE_XCB_SYNC + _ecore_xcb_sync_init(); +#endif + +#ifdef ECORE_XCB_RANDR + _ecore_xcb_randr_init(); +#endif + +#ifdef ECORE_XCB_XFIXES + _ecore_xcb_xfixes_init(); +#endif + +#ifdef ECORE_XCB_DAMAGE + _ecore_xcb_damage_init(); +#endif + +#ifdef ECORE_XCB_RENDER + _ecore_xcb_render_init(); +#endif + +#ifdef ECORE_XCB_COMPOSITE + _ecore_xcb_composite_init(); +#endif + +#ifdef ECORE_XCB_DPMS + _ecore_xcb_dpms_init(); +#endif + +#ifdef ECORE_XCB_DPMS + _ecore_xcb_dpms_init(); +#endif + +#ifdef ECORE_XCB_CURSOR + _ecore_xcb_cursor_init(); +#endif + +#ifdef ECORE_XCB_XINERAMA + _ecore_xcb_xinerama_init(); +#endif + +#ifdef ECORE_XCB_XINPUT + _ecore_xcb_input_init(); +#endif + +#ifdef ECORE_XCB_GESTURE + _ecore_xcb_gesture_init(); +#endif + +/* #ifdef ECORE_XCB_DRI */ +/* _ecore_xcb_dri_init(); */ +/* #endif */ + +#ifdef ECORE_XCB_XTEST + _ecore_xcb_xtest_init(); +#endif + + xcb_prefetch_maximum_request_length(_ecore_xcb_conn); +} + +void +_ecore_xcb_extensions_finalize(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + xcb_get_extension_data(_ecore_xcb_conn, &xcb_big_requests_id); + xcb_get_extension_data(_ecore_xcb_conn, &xcb_shm_id); + +#ifdef ECORE_XCB_SHAPE + _ecore_xcb_shape_finalize(); +#endif + +#ifdef ECORE_XCB_SCREENSAVER + _ecore_xcb_screensaver_finalize(); +#endif + +#ifdef ECORE_XCB_SYNC + _ecore_xcb_sync_finalize(); +#endif + +#ifdef ECORE_XCB_RANDR + _ecore_xcb_randr_finalize(); +#endif + +#ifdef ECORE_XCB_XFIXES + _ecore_xcb_xfixes_finalize(); +#endif + +#ifdef ECORE_XCB_DAMAGE + _ecore_xcb_damage_finalize(); +#endif + +#ifdef ECORE_XCB_RENDER + _ecore_xcb_render_finalize(); +#endif + +#ifdef ECORE_XCB_COMPOSITE + _ecore_xcb_composite_finalize(); +#endif + +#ifdef ECORE_XCB_DPMS + _ecore_xcb_dpms_finalize(); +#endif + +#ifdef ECORE_XCB_CURSOR + _ecore_xcb_cursor_finalize(); +#endif + +#ifdef ECORE_XCB_XINERAMA + _ecore_xcb_xinerama_finalize(); +#endif + +#ifdef ECORE_XCB_XINPUT + _ecore_xcb_input_finalize(); +#endif + +#ifdef ECORE_XCB_GESTURE + _ecore_xcb_gesture_finalize(); +#endif + +/* #ifdef ECORE_XCB_DRI */ +/* _ecore_xcb_dri_finalize(); */ +/* #endif */ + +#ifdef ECORE_XCB_XTEST + _ecore_xcb_xtest_finalize(); +#endif + + xcb_get_maximum_request_length(_ecore_xcb_conn); +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gc.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gc.c new file mode 100644 index 0000000..d811b54 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gc.c @@ -0,0 +1,173 @@ +#include "ecore_xcb_private.h" + +/** + * Creates a new default graphics context associated with the given + * drawable. + * @param draw Drawable to create graphics context with. If @c 0 is + * given instead, the default root window is used. + * @param value_mask Bitmask values. + * @param value_list List of values. The order of values must be the + * same than the corresponding bitmaks. + * @return The new default graphics context. + */ +EAPI Ecore_X_GC +ecore_x_gc_new(Ecore_X_Drawable drawable, + Ecore_X_GC_Value_Mask value_mask, + const unsigned int *value_list) +{ + xcb_gcontext_t gc; + uint32_t vmask = 0; + int i = 0, mask = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!drawable) drawable = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + for (i = 0, mask = 1; i <= 22; i++, mask <<= 1) + { + switch (mask & value_mask) + { + case ECORE_X_GC_VALUE_MASK_FUNCTION: + vmask |= XCB_GC_FUNCTION; + break; + + case ECORE_X_GC_VALUE_MASK_PLANE_MASK: + vmask |= XCB_GC_PLANE_MASK; + break; + + case ECORE_X_GC_VALUE_MASK_FOREGROUND: + vmask |= XCB_GC_FOREGROUND; + break; + + case ECORE_X_GC_VALUE_MASK_BACKGROUND: + vmask |= XCB_GC_BACKGROUND; + break; + + case ECORE_X_GC_VALUE_MASK_LINE_WIDTH: + vmask |= XCB_GC_LINE_WIDTH; + break; + + case ECORE_X_GC_VALUE_MASK_LINE_STYLE: + vmask |= XCB_GC_LINE_STYLE; + break; + + case ECORE_X_GC_VALUE_MASK_CAP_STYLE: + vmask |= XCB_GC_CAP_STYLE; + break; + + case ECORE_X_GC_VALUE_MASK_JOIN_STYLE: + vmask |= XCB_GC_JOIN_STYLE; + break; + + case ECORE_X_GC_VALUE_MASK_FILL_STYLE: + vmask |= XCB_GC_FILL_STYLE; + break; + + case ECORE_X_GC_VALUE_MASK_FILL_RULE: + vmask |= XCB_GC_FILL_RULE; + break; + + case ECORE_X_GC_VALUE_MASK_TILE: + vmask |= XCB_GC_TILE; + break; + + case ECORE_X_GC_VALUE_MASK_STIPPLE: + vmask |= XCB_GC_STIPPLE; + break; + + case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_X: + vmask |= XCB_GC_TILE_STIPPLE_ORIGIN_X; + break; + + case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_Y: + vmask |= XCB_GC_TILE_STIPPLE_ORIGIN_Y; + break; + + case ECORE_X_GC_VALUE_MASK_FONT: + vmask |= XCB_GC_FONT; + break; + + case ECORE_X_GC_VALUE_MASK_SUBWINDOW_MODE: + vmask |= XCB_GC_SUBWINDOW_MODE; + break; + + case ECORE_X_GC_VALUE_MASK_GRAPHICS_EXPOSURES: + vmask |= XCB_GC_GRAPHICS_EXPOSURES; + break; + + case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_X: + vmask |= XCB_GC_CLIP_ORIGIN_X; + break; + + case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_Y: + vmask |= XCB_GC_CLIP_ORIGIN_Y; + break; + + case ECORE_X_GC_VALUE_MASK_CLIP_MASK: + vmask |= XCB_GC_CLIP_MASK; + break; + + case ECORE_X_GC_VALUE_MASK_DASH_OFFSET: + vmask |= XCB_GC_DASH_OFFSET; + break; + + case ECORE_X_GC_VALUE_MASK_DASH_LIST: + vmask |= XCB_GC_DASH_LIST; + break; + + case ECORE_X_GC_VALUE_MASK_ARC_MODE: + vmask |= XCB_GC_ARC_MODE; + break; + } + } + + gc = xcb_generate_id(_ecore_xcb_conn); + xcb_create_gc(_ecore_xcb_conn, gc, drawable, vmask, value_list); + +// ecore_x_flush(); + return gc; +} + +/** + * Deletes and frees the given graphics context. + * @param gc The given graphics context. + */ +EAPI void +ecore_x_gc_free(Ecore_X_GC gc) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_free_gc(_ecore_xcb_conn, gc); +// ecore_x_flush(); +} + +EAPI void +ecore_x_gc_foreground_set(Ecore_X_GC gc, + unsigned long foreground) +{ + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + list = foreground; + xcb_change_gc(_ecore_xcb_conn, gc, XCB_GC_FOREGROUND, &list); +// ecore_x_flush(); +} + +EAPI void +ecore_x_gc_background_set(Ecore_X_GC gc, + unsigned long background) +{ + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + list = background; + xcb_change_gc(_ecore_xcb_conn, gc, XCB_GC_BACKGROUND, &list); +// ecore_x_flush(); +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gesture.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gesture.c new file mode 100644 index 0000000..263dade --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_gesture.c @@ -0,0 +1,203 @@ +#include "ecore_xcb_private.h" +#ifdef ECORE_XCB_XGESTURE +# include +# include +#endif + +/* local variables */ +static Eina_Bool _gesture_available = EINA_FALSE; + +/* external variables */ +int _ecore_xcb_event_gesture = -1; + +void +_ecore_xcb_gesture_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_XGESTURE + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_gesture_id); +#endif +} + +void +_ecore_xcb_gesture_finalize(void) +{ +#ifdef ECORE_XCB_XGESTURE + xcb_gesture_query_version_cookie_t cookie; + xcb_gesture_query_version_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_XGESTURE + cookie = + xcb_gesture_query_version_unchecked(_ecore_xcb_conn); + reply = + xcb_gesture_query_version_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + _gesture_available = EINA_TRUE; + free(reply); + } + + if (_gesture_available) + { + const xcb_query_extension_reply_t *ext_reply; + + ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_gesture_id); + if (ext_reply) + _ecore_xcb_event_gesture = ext_reply->first_event; + } +#endif +} + +void +_ecore_xcb_gesture_shutdown(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); +} + +EAPI Eina_Bool +ecore_x_gesture_supported(void) +{ + return _gesture_available; +} + +#ifdef ECORE_XCB_XGESTURE +EAPI Eina_Bool +ecore_x_gesture_events_select(Ecore_X_Window win, + Ecore_X_Gesture_Event_Mask mask) +#else +EAPI Eina_Bool +ecore_x_gesture_events_select(Ecore_X_Window win __UNUSED__, + Ecore_X_Gesture_Event_Mask mask __UNUSED__) +#endif + +{ +#ifdef ECORE_XCB_XGESTURE + if (!_gesture_available) return EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN + + xcb_gesture_select_events(_ecore_xcb_conn, win, mask); + + return EINA_TRUE; +#else + return EINA_FALSE; +#endif +} + +#ifdef ECORE_XCB_XGESTURE +EAPI Ecore_X_Gesture_Event_Mask +ecore_x_gesture_events_selected_get(Ecore_X_Window win) +#else +EAPI Ecore_X_Gesture_Event_Mask +ecore_x_gesture_events_selected_get(Ecore_X_Window win __UNUSED__) +#endif +{ +#ifdef ECORE_XCB_XGESTURE + xcb_gesture_get_selected_events_cookie_t ecookie; + xcb_gesture_get_selected_events_reply_t *ereply; + Ecore_X_Gesture_Event_Mask mask = ECORE_X_GESTURE_EVENT_MASK_NONE; + + if (!_gesture_available) return mask; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN + + ecookie = xcb_gesture_get_selected_events(_ecore_xcb_conn, win); + ereply = + xcb_gesture_get_selected_events_reply(_ecore_xcb_conn, ecookie, NULL); + if (ereply) + { + mask = ereply->mask; + free(ereply); + } + + return mask; +#else + return ECORE_X_GESTURE_EVENT_MASK_NONE; +#endif +} + +#ifdef ECORE_XCB_XGESTURE +EAPI Eina_Bool +ecore_x_gesture_event_grab(Ecore_X_Window win, + Ecore_X_Gesture_Event_Type type, + int num_fingers) +#else +EAPI Eina_Bool +ecore_x_gesture_event_grab(Ecore_X_Window win __UNUSED__, + Ecore_X_Gesture_Event_Type type __UNUSED__, + int num_fingers __UNUSED__) +#endif +{ +#ifdef ECORE_XCB_XGESTURE + Eina_Bool status = EINA_TRUE; + xcb_gesture_grab_event_cookie_t ecookie; + xcb_gesture_grab_event_reply_t *ereply; + + if (!_gesture_available) return EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN + + ecookie = + xcb_gesture_grab_event(_ecore_xcb_conn, win, type, num_fingers, 0L); + ereply = xcb_gesture_grab_event_reply(_ecore_xcb_conn, ecookie, NULL); + + if (ereply) + { + if (ereply->status) status = EINA_FALSE; + free(ereply); + } + else + status = EINA_FALSE; + + return status; +#else + return EINA_FALSE; +#endif +} + +#ifdef ECORE_XCB_XGESTURE +EAPI Eina_Bool +ecore_x_gesture_event_ungrab(Ecore_X_Window win, + Ecore_X_Gesture_Event_Type type, + int num_fingers) +#else +EAPI Eina_Bool +ecore_x_gesture_event_ungrab(Ecore_X_Window win __UNUSED__, + Ecore_X_Gesture_Event_Type type __UNUSED__, + int num_fingers __UNUSED__) +#endif +{ +#ifdef ECORE_XCB_XGESTURE + Eina_Bool status = EINA_TRUE; + xcb_gesture_ungrab_event_cookie_t ecookie; + xcb_gesture_ungrab_event_reply_t *ereply; + + if (!_gesture_available) return EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN + + ecookie = + xcb_gesture_ungrab_event(_ecore_xcb_conn, win, type, num_fingers, 0L); + ereply = xcb_gesture_ungrab_event_reply(_ecore_xcb_conn, ecookie, NULL); + + if (ereply) + { + if (ereply->status) status = EINA_FALSE; + free(ereply); + } + else + status = EINA_FALSE; + + return status; +#else + return EINA_FALSE; +#endif +} diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c new file mode 100644 index 0000000..6459db7 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_icccm.c @@ -0,0 +1,1568 @@ +#include "ecore_xcb_private.h" +#include + +EAPI void +ecore_x_icccm_init(void) +{ +} + +/** + * Sets the WM_COMMAND property for @a win. + * + * @param win The window. + * @param argc Number of arguments. + * @param argv Arguments. + */ +EAPI void +ecore_x_icccm_command_set(Ecore_X_Window win, + int argc, + char **argv) +{ + void *buf; + char *b; + int nbytes, i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + for (i = 0, nbytes = 0; i < argc; i++) + if (argv[i]) nbytes += strlen(argv[i]) + 1; + + buf = malloc(sizeof(char) * nbytes); + if (!buf) return; + + b = (char *)buf; + for (i = 0; i < argc; i++) + { + if (argv[i]) + { + strcpy(b, argv[i]); + b += strlen(argv[i]) + 1; + } + else + *b++ = '\0'; + } + xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, + ECORE_X_ATOM_WM_COMMAND, ECORE_X_ATOM_STRING, 8, + nbytes, buf); + free(buf); +} + +/** + * Get the WM_COMMAND property for @a win. + * + * Return the command of a window. String must be free'd when done with. + * + * @param win The window. + * @param argc Number of arguments. + * @param argv Arguments. + */ +EAPI void +ecore_x_icccm_command_get(Ecore_X_Window win, + int *argc, + char ***argv) +{ + xcb_get_property_cookie_t cookie; + xcb_get_property_reply_t *reply; + int len = 0; + char **v, *data, *cp, *start; + int c = 0, i = 0, j = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (argc) *argc = 0; + if (argv) *argv = NULL; + + cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, + ECORE_X_ATOM_WM_COMMAND, + XCB_GET_PROPERTY_TYPE_ANY, + 0, 1000000L); + reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return; + + if ((reply->type != ECORE_X_ATOM_STRING) || (reply->format != 8)) + { + free(reply); + return; + } + + len = reply->value_len; + if (len < 1) + { + free(reply); + return; + } + + data = (char *)xcb_get_property_value(reply); + if (len && (data[len - 1] == '\0')) + len--; + + c = 1; + for (cp = (char *)data, i = len; i > 0; cp++, i--) + if (*cp == '\0') c++; + + v = (char **)malloc((c + 1) * sizeof(char *)); + if (!v) + { + free(reply); + return; + } + + start = (char *)malloc((len + 1) * sizeof(char)); + if (!start) + { + free(reply); + free(v); + return; + } + + memcpy(start, (char *)data, len); + start[len] = '\0'; + for (cp = start, i = len + 1, j = 0; i > 0; cp++, i--) + { + if (*cp == '\0') + { + v[j] = start; + start = (cp + 1); + j++; + } + } + + if (c < 1) + { + free(reply); + free(v); + return; + } + + if (argc) *argc = c; + + if (argv) + { + (*argv) = malloc(c * sizeof(char *)); + if (!*argv) + { + free(reply); + free(v); + if (argc) *argc = 0; + return; + } + + for (i = 0; i < c; i++) + { + if (v[i]) + (*argv)[i] = strdup(v[i]); + else + (*argv)[i] = strdup(""); + } + } + + free(reply); + free(v); +} + +EAPI char * +ecore_x_icccm_title_get(Ecore_X_Window win) +{ + xcb_get_property_cookie_t cookie; +#ifdef OLD_XCB_VERSION + xcb_get_text_property_reply_t prop; +#else + xcb_icccm_get_text_property_reply_t prop; +#endif + uint8_t ret = 0; + char *title = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) return NULL; +#ifdef OLD_XCB_VERSION + cookie = xcb_get_wm_name_unchecked(_ecore_xcb_conn, win); + ret = xcb_get_wm_name_reply(_ecore_xcb_conn, cookie, &prop, NULL); +#else + cookie = xcb_icccm_get_wm_name_unchecked(_ecore_xcb_conn, win); + ret = xcb_icccm_get_wm_name_reply(_ecore_xcb_conn, cookie, &prop, NULL); +#endif + if (ret == 0) return NULL; + if (prop.name_len < 1) + { +#ifdef OLD_XCB_VERSION + xcb_get_text_property_reply_wipe(&prop); +#else + xcb_icccm_get_text_property_reply_wipe(&prop); +#endif + return NULL; + } + + if (!(title = malloc((prop.name_len + 1) * sizeof(char *)))) + { +#ifdef OLD_XCB_VERSION + xcb_get_text_property_reply_wipe(&prop); +#else + xcb_icccm_get_text_property_reply_wipe(&prop); +#endif + return NULL; + } + memcpy(title, prop.name, sizeof(char *) * prop.name_len); + title[prop.name_len] = '\0'; + + if (prop.encoding != ECORE_X_ATOM_UTF8_STRING) + { + Ecore_Xcb_Textproperty tp; + int count = 0; + char **list = NULL; + Eina_Bool ret = EINA_FALSE; + + tp.value = strdup(title); + tp.nitems = prop.name_len; + tp.encoding = prop.encoding; +#ifdef HAVE_ICONV + ret = _ecore_xcb_utf8_textproperty_to_textlist(&tp, &list, &count); +#else + ret = _ecore_xcb_mb_textproperty_to_textlist(&tp, &list, &count); +#endif + if (ret) + { + if (count > 0) + title = strdup(list[0]); + + if (list) free(list); + } + } + +#ifdef OLD_XCB_VERSION + xcb_get_text_property_reply_wipe(&prop); +#else + xcb_icccm_get_text_property_reply_wipe(&prop); +#endif + return title; +} + +EAPI void +ecore_x_icccm_title_set(Ecore_X_Window win, + const char *title) +{ + Ecore_Xcb_Textproperty prop; + char *list[1]; + Eina_Bool ret = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!title) return; + + prop.value = NULL; + list[0] = strdup(title); + +#ifdef HAVE_ICONV + ret = _ecore_xcb_utf8_textlist_to_textproperty(list, 1, XcbUTF8StringStyle, + &prop); +#else + ret = _ecore_xcb_mb_textlist_to_textproperty(list, 1, XcbStdICCTextStyle, + &prop); +#endif + + if (ret) + { +#ifdef OLD_XCB_VERSION + xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, + strlen(prop.value), prop.value); +#else + xcb_icccm_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, 8, + strlen(prop.value), prop.value); +#endif + if (prop.value) free(prop.value); + } + else +#ifdef OLD_XCB_VERSION + xcb_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, + strlen(title), title); +#else + xcb_icccm_set_wm_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, 8, + strlen(title), title); +#endif + free(list[0]); +} + +/** + * Get a window name & class. + * @param win The window + * @param n The name string + * @param c The class string + * + * Get a window name * class + */ +EAPI void +ecore_x_icccm_name_class_get(Ecore_X_Window win, + char **name, + char **class) +{ + xcb_get_property_cookie_t cookie; +#ifdef OLD_XCB_VERSION + xcb_get_wm_class_reply_t prop; +#else + xcb_icccm_get_wm_class_reply_t prop; +#endif + uint8_t ret = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (name) *name = NULL; + if (class) *class = NULL; + +#ifdef OLD_XCB_VERSION + cookie = xcb_get_wm_class_unchecked(_ecore_xcb_conn, win); + ret = xcb_get_wm_class_reply(_ecore_xcb_conn, cookie, &prop, NULL); +#else + cookie = xcb_icccm_get_wm_class_unchecked(_ecore_xcb_conn, win); + ret = xcb_icccm_get_wm_class_reply(_ecore_xcb_conn, cookie, &prop, NULL); +#endif + if (ret == 0) return; + + if (name) *name = strdup(prop.instance_name); + if (class) *class = strdup(prop.class_name); + +#ifdef OLD_XCB_VERSION + xcb_get_wm_class_reply_wipe(&prop); +#else + xcb_icccm_get_wm_class_reply_wipe(&prop); +#endif +} + +/** + * Set a window name & class. + * @param win The window + * @param n The name string + * @param c The class string + * + * Set a window name * class + */ +EAPI void +ecore_x_icccm_name_class_set(Ecore_X_Window win, + const char *name, + const char *class) +{ + char *class_string, *s; + int length_name, length_class; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + length_name = strlen(name); + length_class = strlen(class); + class_string = + (char *)malloc(sizeof(char) * (length_name + length_class + 2)); + if (!class_string) return; + + s = class_string; + if (length_name) + { + strcpy(s, name); + s += length_name + 1; + } + else + *s++ = '\0'; + + if (length_class) + strcpy(s, class); + else + *s = '\0'; + + xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, + ECORE_X_ATOM_WM_CLASS, ECORE_X_ATOM_STRING, 8, + length_name + length_class + 2, (void *)class_string); + free(class_string); +} + +/** + * Specify that a window is transient for another top-level window and should be handled accordingly. + * @param win the transient window + * @param forwin the toplevel window + */ +EAPI void +ecore_x_icccm_transient_for_set(Ecore_X_Window win, + Ecore_X_Window forwindow) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, + ECORE_X_ATOM_WM_TRANSIENT_FOR, ECORE_X_ATOM_WINDOW, 32, + 1, (void *)&forwindow); +} + +/** + * Remove the transient_for setting from a window. + * @param The window + */ +EAPI void +ecore_x_icccm_transient_for_unset(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_WM_TRANSIENT_FOR); +} + +/** + * Get the window this window is transient for, if any. + * @param win The window to check + * @return The window ID of the top-level window, or 0 if the property does not exist. + */ +EAPI Ecore_X_Window +ecore_x_icccm_transient_for_get(Ecore_X_Window win) +{ + Ecore_X_Window forwin = 0; + xcb_get_property_cookie_t cookie; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef OLD_XCB_VERSION + cookie = xcb_get_wm_transient_for_unchecked(_ecore_xcb_conn, win); + xcb_get_wm_transient_for_reply(_ecore_xcb_conn, cookie, &forwin, NULL); +#else + cookie = xcb_icccm_get_wm_transient_for_unchecked(_ecore_xcb_conn, win); + xcb_icccm_get_wm_transient_for_reply(_ecore_xcb_conn, cookie, &forwin, NULL); +#endif + + return forwin; +} + +/** + * Get the window role. + * @param win The window + * @return The window's role string. + */ +EAPI char * +ecore_x_icccm_window_role_get(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_WINDOW_ROLE); +} + +/** + * Set the window role hint. + * @param win The window + * @param role The role string + */ +EAPI void +ecore_x_icccm_window_role_set(Ecore_X_Window win, + const char *role) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_WINDOW_ROLE, role); +} + +/** + * Get the window's client leader. + * @param win The window + * @return The window's client leader window, or 0 if unset + */ +EAPI Ecore_X_Window +ecore_x_icccm_client_leader_get(Ecore_X_Window win) +{ + Ecore_X_Window leader; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (ecore_x_window_prop_window_get(win, ECORE_X_ATOM_WM_CLIENT_LEADER, + &leader, 1) > 0) + return leader; + + return 0; +} + +/** + * Set the window's client leader. + * @param win The window + * @param l The client leader window + * + * All non-transient top-level windows created by an app other than + * the main window must have this property set to the app's main window. + */ +EAPI void +ecore_x_icccm_client_leader_set(Ecore_X_Window win, + Ecore_X_Window leader) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER, + &leader, 1); +} + +EAPI Ecore_X_Window_State_Hint +ecore_x_icccm_state_get(Ecore_X_Window win) +{ + xcb_get_property_cookie_t cookie; + xcb_get_property_reply_t *reply; + Ecore_X_Window_State_Hint hint = ECORE_X_WINDOW_STATE_HINT_NONE; + uint8_t *prop; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = + xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, + ECORE_X_ATOM_WM_STATE, ECORE_X_ATOM_WM_STATE, + 0L, 0x7fffffff); + reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return hint; + if ((reply->type == 0) || (reply->format != 8) || (reply->value_len != 2)) + { + free(reply); + return hint; + } + + prop = (uint8_t *)xcb_get_property_value(reply); +#ifdef OLD_XCB_VERSION + switch (prop[0]) + { + case XCB_WM_STATE_WITHDRAWN: + hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; + break; + + case XCB_WM_STATE_NORMAL: + hint = ECORE_X_WINDOW_STATE_HINT_NORMAL; + break; + + case XCB_WM_STATE_ICONIC: + hint = ECORE_X_WINDOW_STATE_HINT_ICONIC; + break; + + default: + break; + } +#else + switch (prop[0]) + { + case XCB_ICCCM_WM_STATE_WITHDRAWN: + hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; + break; + + case XCB_ICCCM_WM_STATE_NORMAL: + hint = ECORE_X_WINDOW_STATE_HINT_NORMAL; + break; + + case XCB_ICCCM_WM_STATE_ICONIC: + hint = ECORE_X_WINDOW_STATE_HINT_ICONIC; + break; + + default: + break; + } +#endif + + free(reply); + return hint; +} + +EAPI void +ecore_x_icccm_state_set(Ecore_X_Window win, + Ecore_X_Window_State_Hint state) +{ +#ifdef OLD_XCB_VERSION + xcb_wm_hints_t hints; +#else + xcb_icccm_wm_hints_t hints; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef OLD_XCB_VERSION + xcb_wm_hints_set_none(&hints); + + hints.flags = XCB_WM_HINT_STATE; + + if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) + xcb_wm_hints_set_withdrawn(&hints); + else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL) + xcb_wm_hints_set_normal(&hints); + else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC) + xcb_wm_hints_set_iconic(&hints); + + xcb_set_wm_hints(_ecore_xcb_conn, win, &hints); +#else + xcb_icccm_wm_hints_set_none(&hints); + + hints.flags = XCB_ICCCM_WM_HINT_STATE; + + if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) + xcb_icccm_wm_hints_set_withdrawn(&hints); + else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL) + xcb_icccm_wm_hints_set_normal(&hints); + else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC) + xcb_icccm_wm_hints_set_iconic(&hints); + + xcb_icccm_set_wm_hints(_ecore_xcb_conn, win, &hints); +#endif +} + +EAPI void +ecore_x_icccm_delete_window_send(Ecore_X_Window win, + Ecore_X_Time t) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, + ECORE_X_EVENT_MASK_NONE, + ECORE_X_ATOM_WM_DELETE_WINDOW, t, 0, 0, 0); +} + +EAPI void +ecore_x_icccm_hints_set(Ecore_X_Window win, + Eina_Bool accepts_focus, + Ecore_X_Window_State_Hint initial_state, + Ecore_X_Pixmap icon_pixmap, + Ecore_X_Pixmap icon_mask, + Ecore_X_Window icon_window, + Ecore_X_Window window_group, + Eina_Bool is_urgent) +{ +#ifdef OLD_XCB_VERSION + xcb_wm_hints_t hints; +#else + xcb_icccm_wm_hints_t hints; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef OLD_XCB_VERSION + xcb_wm_hints_set_none(&hints); + xcb_wm_hints_set_input(&hints, accepts_focus); + + if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) + xcb_wm_hints_set_withdrawn(&hints); + else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL) + xcb_wm_hints_set_normal(&hints); + else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC) + xcb_wm_hints_set_iconic(&hints); + + if (icon_pixmap != 0) xcb_wm_hints_set_icon_pixmap(&hints, icon_pixmap); + if (icon_mask != 0) xcb_wm_hints_set_icon_mask(&hints, icon_mask); + if (icon_window != 0) xcb_wm_hints_set_icon_window(&hints, icon_window); + if (window_group != 0) xcb_wm_hints_set_window_group(&hints, window_group); + if (is_urgent) xcb_wm_hints_set_urgency(&hints); + + xcb_set_wm_hints(_ecore_xcb_conn, win, &hints); +#else + xcb_icccm_wm_hints_set_none(&hints); + xcb_icccm_wm_hints_set_input(&hints, accepts_focus); + + if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) + xcb_icccm_wm_hints_set_withdrawn(&hints); + else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL) + xcb_icccm_wm_hints_set_normal(&hints); + else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC) + xcb_icccm_wm_hints_set_iconic(&hints); + + if (icon_pixmap != 0) + xcb_icccm_wm_hints_set_icon_pixmap(&hints, icon_pixmap); + if (icon_mask != 0) + xcb_icccm_wm_hints_set_icon_mask(&hints, icon_mask); + if (icon_window != 0) + xcb_icccm_wm_hints_set_icon_window(&hints, icon_window); + if (window_group != 0) + xcb_icccm_wm_hints_set_window_group(&hints, window_group); + if (is_urgent) + xcb_icccm_wm_hints_set_urgency(&hints); + + xcb_icccm_set_wm_hints(_ecore_xcb_conn, win, &hints); +#endif +} + +EAPI Eina_Bool +ecore_x_icccm_hints_get(Ecore_X_Window win, + Eina_Bool *accepts_focus, + Ecore_X_Window_State_Hint *initial_state, + Ecore_X_Pixmap *icon_pixmap, + Ecore_X_Pixmap *icon_mask, + Ecore_X_Window *icon_window, + Ecore_X_Window *window_group, + Eina_Bool *is_urgent) +{ + xcb_get_property_cookie_t cookie; +#ifdef OLD_XCB_VERSION + xcb_wm_hints_t hints; +#else + xcb_icccm_wm_hints_t hints; +#endif + uint8_t ret = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (accepts_focus) *accepts_focus = EINA_TRUE; + if (initial_state) *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL; + if (icon_pixmap) *icon_pixmap = 0; + if (icon_mask) *icon_mask = 0; + if (icon_window) *icon_window = 0; + if (window_group) *window_group = 0; + if (is_urgent) *is_urgent = EINA_FALSE; + +#ifdef OLD_XCB_VERSION + xcb_wm_hints_set_none(&hints); + cookie = xcb_get_wm_hints_unchecked(_ecore_xcb_conn, win); + ret = xcb_get_wm_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL); +#else + xcb_icccm_wm_hints_set_none(&hints); + cookie = xcb_icccm_get_wm_hints_unchecked(_ecore_xcb_conn, win); + ret = xcb_icccm_get_wm_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL); +#endif + if (!ret) return EINA_FALSE; + +#ifdef OLD_XCB_VERSION + if ((hints.flags & XCB_WM_HINT_INPUT) && (accepts_focus)) +#else + if ((hints.flags & XCB_ICCCM_WM_HINT_INPUT) && (accepts_focus)) +#endif + { + if (hints.input) + *accepts_focus = EINA_TRUE; + else + *accepts_focus = EINA_FALSE; + } + +#ifdef OLD_XCB_VERSION + if ((hints.flags & XCB_WM_HINT_STATE) && (initial_state)) + { + if (hints.initial_state == XCB_WM_STATE_WITHDRAWN) + *initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; + else if (hints.initial_state == XCB_WM_STATE_NORMAL) + *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL; + else if (hints.initial_state == XCB_WM_STATE_ICONIC) + *initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC; + } + + if ((hints.flags & XCB_WM_HINT_ICON_PIXMAP) && (icon_pixmap)) + *icon_pixmap = hints.icon_pixmap; + + if ((hints.flags & XCB_WM_HINT_ICON_MASK) && (icon_mask)) + *icon_mask = hints.icon_mask; + + if ((hints.flags & XCB_WM_HINT_ICON_WINDOW) && (icon_window)) + *icon_window = hints.icon_window; + + if ((hints.flags & XCB_WM_HINT_WINDOW_GROUP) && (window_group)) + *window_group = hints.window_group; + + if ((hints.flags & XCB_WM_HINT_X_URGENCY) && (is_urgent)) + *is_urgent = EINA_TRUE; +#else + if ((hints.flags & XCB_ICCCM_WM_HINT_STATE) && (initial_state)) + { + if (hints.initial_state == XCB_ICCCM_WM_STATE_WITHDRAWN) + *initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; + else if (hints.initial_state == XCB_ICCCM_WM_STATE_NORMAL) + *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL; + else if (hints.initial_state == XCB_ICCCM_WM_STATE_ICONIC) + *initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC; + } + + if ((hints.flags & XCB_ICCCM_WM_HINT_ICON_PIXMAP) && (icon_pixmap)) + *icon_pixmap = hints.icon_pixmap; + + if ((hints.flags & XCB_ICCCM_WM_HINT_ICON_MASK) && (icon_mask)) + *icon_mask = hints.icon_mask; + + if ((hints.flags & XCB_ICCCM_WM_HINT_ICON_WINDOW) && (icon_window)) + *icon_window = hints.icon_window; + + if ((hints.flags & XCB_ICCCM_WM_HINT_WINDOW_GROUP) && (window_group)) + *window_group = hints.window_group; + + if ((hints.flags & XCB_ICCCM_WM_HINT_X_URGENCY) && (is_urgent)) + *is_urgent = EINA_TRUE; +#endif + + return EINA_TRUE; +} + +/** + * Get a window icon name. + * @param win The window + * @return The windows icon name string + * + * Return the icon name of a window. String must be free'd when done with. + */ +EAPI char * +ecore_x_icccm_icon_name_get(Ecore_X_Window win) +{ + xcb_get_property_cookie_t cookie; +#ifdef OLD_XCB_VERSION + xcb_get_text_property_reply_t prop; +#else + xcb_icccm_get_text_property_reply_t prop; +#endif + uint8_t ret = 0; + char *tmp = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) return NULL; + +#ifdef OLD_XCB_VERSION + cookie = xcb_get_wm_icon_name_unchecked(_ecore_xcb_conn, win); + ret = xcb_get_wm_icon_name_reply(_ecore_xcb_conn, cookie, &prop, NULL); +#else + cookie = xcb_icccm_get_wm_icon_name_unchecked(_ecore_xcb_conn, win); + ret = xcb_icccm_get_wm_icon_name_reply(_ecore_xcb_conn, cookie, &prop, NULL); +#endif + if (ret == 0) return NULL; + + if (prop.name_len < 1) + { +#ifdef OLD_XCB_VERSION + xcb_get_text_property_reply_wipe(&prop); +#else + xcb_icccm_get_text_property_reply_wipe(&prop); +#endif + return NULL; + } + + if (!(tmp = malloc((prop.name_len + 1) * sizeof(char *)))) + { +#ifdef OLD_XCB_VERSION + xcb_get_text_property_reply_wipe(&prop); +#else + xcb_icccm_get_text_property_reply_wipe(&prop); +#endif + return NULL; + } + memcpy(tmp, prop.name, sizeof(char *) * prop.name_len); + tmp[prop.name_len] = '\0'; + + if (prop.encoding != ECORE_X_ATOM_UTF8_STRING) + { + Ecore_Xcb_Textproperty tp; + int count = 0; + char **list = NULL; + Eina_Bool ret = EINA_FALSE; + + tp.value = strdup(tmp); + tp.nitems = prop.name_len; + tp.encoding = prop.encoding; +#ifdef HAVE_ICONV + ret = _ecore_xcb_utf8_textproperty_to_textlist(&tp, &list, &count); +#else + ret = _ecore_xcb_mb_textproperty_to_textlist(&tp, &list, &count); +#endif + if (ret) + { + if (count > 0) + tmp = strdup(list[0]); + + if (list) free(list); + } + } + +#ifdef OLD_XCB_VERSION + xcb_get_text_property_reply_wipe(&prop); +#else + xcb_icccm_get_text_property_reply_wipe(&prop); +#endif + return tmp; +} + +/** + * Set a window icon name. + * @param win The window + * @param t The icon name string + * + * Set a window icon name + */ +EAPI void +ecore_x_icccm_icon_name_set(Ecore_X_Window win, + const char *name) +{ + Ecore_Xcb_Textproperty prop; + char *list[1]; + Eina_Bool ret = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if ((!win) || (!name)) return; + + prop.value = NULL; + list[0] = strdup(name); + +#ifdef HAVE_ICONV + ret = _ecore_xcb_utf8_textlist_to_textproperty(list, 1, XcbUTF8StringStyle, + &prop); +#else + ret = _ecore_xcb_mb_textlist_to_textproperty(list, 1, XcbStdICCTextStyle, + &prop); +#endif + + if (ret) + { +#ifdef OLD_XCB_VERSION + xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, + strlen(prop.value), prop.value); +#else + xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, + 8, strlen(prop.value), prop.value); +#endif + if (prop.value) free(prop.value); + } + else +#ifdef OLD_XCB_VERSION + xcb_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, + strlen(name), name); +#else + xcb_icccm_set_wm_icon_name(_ecore_xcb_conn, win, ECORE_X_ATOM_STRING, + 8, strlen(name), name); +#endif + + free(list[0]); +} + +EAPI void +ecore_x_icccm_iconic_request_send(Ecore_X_Window win, + Ecore_X_Window root) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) return; + if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = ECORE_X_ATOM_WM_CHANGE_STATE; +#ifdef OLD_XCB_VERSION + ev.data.data32[0] = XCB_WM_STATE_ICONIC; +#else + ev.data.data32[0] = XCB_ICCCM_WM_STATE_ICONIC; +#endif + + xcb_send_event(_ecore_xcb_conn, 0, root, + (XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | + XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT), + (const char *)&ev); +// ecore_x_flush(); +} + +/** + * Set or unset a wm protocol property. + * @param win The Window + * @param protocol The protocol to enable/disable + * @param on On/Off + */ +EAPI void +ecore_x_icccm_protocol_set(Ecore_X_Window win, + Ecore_X_WM_Protocol protocol, + Eina_Bool on) +{ + Ecore_X_Atom proto; + xcb_get_property_cookie_t cookie; +#ifdef OLD_XCB_VERSION + xcb_get_wm_protocols_reply_t protos; +#else + xcb_icccm_get_wm_protocols_reply_t protos; +#endif + int i = 0, count = 0, set = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return; + proto = _ecore_xcb_atoms_wm_protocol[protocol]; +#ifdef OLD_XCB_VERSION + cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto); + if (!xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL)) +#else + cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto); + if (!xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL)) +#endif + count = 0; + else + count = protos.atoms_len; + + for (i = 0; i < count; i++) + { + if (protos.atoms[i] == proto) + { + set = 1; + break; + } + } + + if (on) + { + if (!set) + { + Ecore_X_Atom *atoms = NULL; + + atoms = malloc((count + 1) * sizeof(Ecore_X_Atom)); + if (atoms) + { + for (i = 0; i < count; i++) + atoms[i] = protos.atoms[i]; + atoms[count] = proto; +#ifdef OLD_XCB_VERSION + xcb_set_wm_protocols(_ecore_xcb_conn, + ECORE_X_ATOM_WM_PROTOCOLS, + win, count, atoms); +#else + xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win, + ECORE_X_ATOM_WM_PROTOCOLS, + count, atoms); +#endif + free(atoms); + } + } + } + else + { + if (set) + { + for (i = 0; i < count; i++) + { + if (protos.atoms[i] == proto) + { + int j = 0; + + for (j = (i + 1); j < count; j++) + protos.atoms[j - 1] = protos.atoms[j]; + if (count > 1) +#ifdef OLD_XCB_VERSION + xcb_set_wm_protocols(_ecore_xcb_conn, + ECORE_X_ATOM_WM_PROTOCOLS, + win, count - 1, protos.atoms); +#else + xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win, + ECORE_X_ATOM_WM_PROTOCOLS, + count - 1, protos.atoms); +#endif + else + ecore_x_window_prop_property_del(win, + ECORE_X_ATOM_WM_PROTOCOLS); + break; + } + } + } + } + +#ifdef OLD_XCB_VERSION + xcb_get_wm_protocols_reply_wipe(&protos); +#else + xcb_icccm_get_wm_protocols_reply_wipe(&protos); +#endif +} + +/** + * Determines whether a protocol is set for a window. + * @param win The Window + * @param protocol The protocol to query + * @return 1 if the protocol is set, else 0. + */ +EAPI Eina_Bool +ecore_x_icccm_protocol_isset(Ecore_X_Window win, + Ecore_X_WM_Protocol protocol) +{ + Ecore_X_Atom proto; + Eina_Bool ret = EINA_FALSE; + xcb_get_property_cookie_t cookie; +#ifdef OLD_XCB_VERSION + xcb_get_wm_protocols_reply_t reply; +#else + xcb_icccm_get_wm_protocols_reply_t reply; +#endif + uint8_t val = 0; + unsigned int i = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return EINA_FALSE; + + proto = _ecore_xcb_atoms_wm_protocol[protocol]; +#ifdef OLD_XCB_VERSION + cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto); + val = xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &reply, NULL); +#else + cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win, proto); + val = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &reply, NULL); +#endif + if (!val) return EINA_FALSE; + + for (i = 0; i < reply.atoms_len; i++) + if (reply.atoms[i] == proto) + { + ret = EINA_TRUE; + break; + } + +#ifdef OLD_XCB_VERSION + xcb_get_wm_protocols_reply_wipe(&reply); +#else + xcb_icccm_get_wm_protocols_reply_wipe(&reply); +#endif + + return ret; +} + +/** + * Set protocol atoms explicitly + * @param win The Window + * @param protos An array of protocol atoms + * @param num the number of members of the array + */ +EAPI void +ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win, + Ecore_X_Atom *protos, + int num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (num > 0) +#ifdef OLD_XCB_VERSION + xcb_set_wm_protocols(_ecore_xcb_conn, ECORE_X_ATOM_WM_PROTOCOLS, + win, num, protos); +#else + xcb_icccm_set_wm_protocols(_ecore_xcb_conn, win, + ECORE_X_ATOM_WM_PROTOCOLS, num, protos); +#endif + else + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_WM_PROTOCOLS); +} + +EAPI Eina_Bool +ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, + Eina_Bool *request_pos, + Ecore_X_Gravity *gravity, + int *min_w, + int *min_h, + int *max_w, + int *max_h, + int *base_w, + int *base_h, + int *step_x, + int *step_y, + double *min_aspect, + double *max_aspect) +{ + xcb_size_hints_t hints; + xcb_get_property_cookie_t cookie; + uint8_t ret = 0; + int32_t minw = 0, minh = 0; + int32_t maxw = 32767, maxh = 32767; + int32_t basew = -1, baseh = -1; + int32_t stepx = -1, stepy = -1; + double mina = 0.0, maxa = 0.0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (request_pos) *request_pos = EINA_FALSE; + if (gravity) *gravity = ECORE_X_GRAVITY_NW; + if (min_w) *min_w = minw; + if (min_h) *min_h = minh; + if (max_w) *max_w = maxw; + if (max_h) *max_h = maxh; + if (base_w) *base_w = basew; + if (base_h) *base_h = baseh; + if (step_x) *step_x = stepx; + if (step_y) *step_y = stepy; + if (min_aspect) *min_aspect = mina; + if (max_aspect) *max_aspect = maxa; + +#ifdef OLD_XCB_VERSION + cookie = xcb_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win); + ret = xcb_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL); +#else + cookie = xcb_icccm_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win); + ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, + &hints, NULL); +#endif + if (!ret) return EINA_FALSE; + +#ifdef OLD_XCB_VERSION + if ((hints.flags & XCB_SIZE_HINT_US_POSITION) || + (hints.flags & XCB_SIZE_HINT_P_POSITION)) +#else + if ((hints.flags & XCB_ICCCM_SIZE_HINT_US_POSITION) || + (hints.flags & XCB_ICCCM_SIZE_HINT_P_POSITION)) +#endif + { + if (request_pos) *request_pos = EINA_TRUE; + } + +#ifdef OLD_XCB_VERSION + if (hints.flags & XCB_SIZE_HINT_P_WIN_GRAVITY) +#else + if (hints.flags & XCB_ICCCM_SIZE_HINT_P_WIN_GRAVITY) +#endif + { + if (gravity) *gravity = hints.win_gravity; + } + +#ifdef OLD_XCB_VERSION + if (hints.flags & XCB_SIZE_HINT_P_MIN_SIZE) +#else + if (hints.flags & XCB_ICCCM_SIZE_HINT_P_MIN_SIZE) +#endif + { + minw = hints.min_width; + minh = hints.min_height; + } + +#ifdef OLD_XCB_VERSION + if (hints.flags & XCB_SIZE_HINT_P_MAX_SIZE) +#else + if (hints.flags & XCB_ICCCM_SIZE_HINT_P_MAX_SIZE) +#endif + { + maxw = hints.max_width; + maxh = hints.max_height; + if (maxw < minw) maxw = minw; + if (maxh < minh) maxh = minh; + } + +#ifdef OLD_XCB_VERSION + if (hints.flags & XCB_SIZE_HINT_BASE_SIZE) +#else + if (hints.flags & XCB_ICCCM_SIZE_HINT_BASE_SIZE) +#endif + { + basew = hints.base_width; + baseh = hints.base_height; + if (basew > minw) minw = basew; + if (baseh > minh) minh = baseh; + } + +#ifdef OLD_XCB_VERSION + if (hints.flags & XCB_SIZE_HINT_P_RESIZE_INC) +#else + if (hints.flags & XCB_ICCCM_SIZE_HINT_P_RESIZE_INC) +#endif + { + stepx = hints.width_inc; + stepy = hints.height_inc; + if (stepx < 1) stepx = 1; + if (stepy < 1) stepy = 1; + } + +#ifdef OLD_XCB_VERSION + if (hints.flags & XCB_SIZE_HINT_P_ASPECT) +#else + if (hints.flags & XCB_ICCCM_SIZE_HINT_P_ASPECT) +#endif + { + if (hints.min_aspect_den > 0) + mina = ((double)hints.min_aspect_num) / ((double)hints.min_aspect_den); + + if (hints.max_aspect_den > 0) + maxa = ((double)hints.max_aspect_num) / ((double)hints.max_aspect_den); + } + + if (min_w) *min_w = minw; + if (min_h) *min_h = minh; + if (max_w) *max_w = maxw; + if (max_h) *max_h = maxh; + if (base_w) *base_w = basew; + if (base_h) *base_h = baseh; + if (step_x) *step_x = stepx; + if (step_y) *step_y = stepy; + if (min_aspect) *min_aspect = mina; + if (max_aspect) *max_aspect = maxa; + + return EINA_TRUE; +} + +EAPI void +ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, + Eina_Bool request_pos, + Ecore_X_Gravity gravity, + int min_w, + int min_h, + int max_w, + int max_h, + int base_w, + int base_h, + int step_x, + int step_y, + double min_aspect, + double max_aspect) +{ + xcb_get_property_cookie_t cookie; + xcb_size_hints_t hints; + uint8_t ret = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef OLD_XCB_VERSION + cookie = xcb_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win); + ret = xcb_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, &hints, NULL); +#else + cookie = xcb_icccm_get_wm_normal_hints_unchecked(_ecore_xcb_conn, win); + ret = xcb_icccm_get_wm_normal_hints_reply(_ecore_xcb_conn, cookie, + &hints, NULL); +#endif + if (!ret) memset(&hints, 0, sizeof(xcb_size_hints_t)); + + hints.flags = 0; + +#ifdef OLD_XCB_VERSION + if (request_pos) + hints.flags |= XCB_SIZE_HINT_US_POSITION; + + if (gravity != ECORE_X_GRAVITY_NW) + xcb_size_hints_set_win_gravity(&hints, gravity); + if ((min_w > 0) || (min_h > 0)) + xcb_size_hints_set_min_size(&hints, min_w, min_h); + if ((max_w > 0) || (max_h > 0)) + xcb_size_hints_set_max_size(&hints, max_w, max_h); + if ((base_w > 0) || (base_h > 0)) + xcb_size_hints_set_base_size(&hints, base_w, base_h); + if ((step_x > 1) || (step_y > 1)) + xcb_size_hints_set_resize_inc(&hints, step_x, step_y); + if ((min_aspect > 0.0) || (max_aspect > 0.0)) + xcb_size_hints_set_aspect(&hints, + (int32_t)(min_aspect * 10000), 10000, + (int32_t)(max_aspect * 10000), 10000); + + xcb_set_wm_normal_hints(_ecore_xcb_conn, win, &hints); +#else + if (request_pos) + hints.flags |= XCB_ICCCM_SIZE_HINT_US_POSITION; + + if (gravity != ECORE_X_GRAVITY_NW) + xcb_icccm_size_hints_set_win_gravity(&hints, gravity); + if ((min_w > 0) || (min_h > 0)) + xcb_icccm_size_hints_set_min_size(&hints, min_w, min_h); + if ((max_w > 0) || (max_h > 0)) + xcb_icccm_size_hints_set_max_size(&hints, max_w, max_h); + if ((base_w > 0) || (base_h > 0)) + xcb_icccm_size_hints_set_base_size(&hints, base_w, base_h); + if ((step_x > 1) || (step_y > 1)) + xcb_icccm_size_hints_set_resize_inc(&hints, step_x, step_y); + if ((min_aspect > 0.0) || (max_aspect > 0.0)) + xcb_icccm_size_hints_set_aspect(&hints, + (int32_t)(min_aspect * 10000), 10000, + (int32_t)(max_aspect * 10000), 10000); + + xcb_icccm_set_wm_normal_hints(_ecore_xcb_conn, win, &hints); +#endif +} + +EAPI void +ecore_x_icccm_move_resize_send(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + xcb_configure_notify_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) return; + + memset(&ev, 0, sizeof(xcb_configure_notify_event_t)); + + ev.response_type = XCB_CONFIGURE_NOTIFY; + ev.event = win; + ev.window = win; + ev.above_sibling = XCB_NONE; + ev.x = x; + ev.y = y; + ev.width = w; + ev.height = h; + ev.border_width = 0; + ev.override_redirect = 0; + + xcb_send_event(_ecore_xcb_conn, 0, win, + XCB_EVENT_MASK_STRUCTURE_NOTIFY, (const char *)&ev); +// ecore_x_flush(); +} + +/** + * Get a window client machine string. + * @param win The window + * @return The windows client machine string + * + * Return the client machine of a window. String must be free'd when done with. + */ +EAPI char * +ecore_x_icccm_client_machine_get(Ecore_X_Window win) +{ + xcb_get_property_cookie_t cookie; +#ifdef OLD_XCB_VERSION + xcb_get_text_property_reply_t prop; +#else + xcb_icccm_get_text_property_reply_t prop; +#endif + uint8_t ret = 0; + char *tmp = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef OLD_XCB_VERSION + cookie = xcb_get_wm_client_machine_unchecked(_ecore_xcb_conn, win); + ret = xcb_get_wm_client_machine_reply(_ecore_xcb_conn, cookie, &prop, NULL); +#else + cookie = xcb_icccm_get_wm_client_machine_unchecked(_ecore_xcb_conn, win); + ret = xcb_icccm_get_wm_client_machine_reply(_ecore_xcb_conn, cookie, + &prop, NULL); +#endif + if (ret == 0) return NULL; + + tmp = malloc((prop.name_len + 1) * sizeof(char *)); + if (!tmp) + { +#ifdef OLD_XCB_VERSION + xcb_get_text_property_reply_wipe(&prop); +#else + xcb_icccm_get_text_property_reply_wipe(&prop); +#endif + return NULL; + } + memcpy(tmp, prop.name, sizeof(char *) * prop.name_len); + tmp[prop.name_len] = '\0'; + +#ifdef OLD_XCB_VERSION + xcb_get_text_property_reply_wipe(&prop); +#else + xcb_icccm_get_text_property_reply_wipe(&prop); +#endif + + return tmp; +} + +EAPI void +ecore_x_icccm_take_focus_send(Ecore_X_Window win, + Ecore_X_Time t) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, + XCB_EVENT_MASK_NO_EVENT, + ECORE_X_ATOM_WM_TAKE_FOCUS, t, 0, 0, 0); +} + +EAPI void +ecore_x_icccm_save_yourself_send(Ecore_X_Window win, + Ecore_X_Time t) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, + XCB_EVENT_MASK_NO_EVENT, + ECORE_X_ATOM_WM_SAVE_YOURSELF, t, 0, 0, 0); +} + +/** + * Add a subwindow to the list of windows that need a different colormap installed. + * @param win The toplevel window + * @param subwin The subwindow to be added to the colormap windows list + */ +EAPI void +ecore_x_icccm_colormap_window_set(Ecore_X_Window win, + Ecore_X_Window subwin) +{ + int num = 0, i = 0; + unsigned char *odata = NULL, *data = NULL; + Ecore_X_Window *newset = NULL, *oldset = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS, + ECORE_X_ATOM_WINDOW, 32, &odata, &num)) + { + if (!(newset = calloc(1, sizeof(Ecore_X_Window)))) return; + newset[0] = subwin; + num = 1; + data = (unsigned char *)newset; + } + else + { + if (!(newset = calloc(num + 1, sizeof(Ecore_X_Window)))) return; + oldset = (Ecore_X_Window *)odata; + for (i = 0; i < num; i++) + { + if (oldset[i] == subwin) + { + if (odata) free(odata); + odata = NULL; + free(newset); + return; + } + newset[i] = oldset[i]; + } + newset[num++] = subwin; + if (odata) free(odata); + data = (unsigned char *)newset; + } + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS, + ECORE_X_ATOM_WINDOW, 32, data, num); + free(newset); +} + +/** + * Remove a window from the list of colormap windows. + * @param win The toplevel window + * @param subwin The window to be removed from the colormap window list. + */ +EAPI void +ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, + Ecore_X_Window subwin) +{ + int num = 0, i = 0, j = 0, k = 0; + unsigned char *odata = NULL, *data = NULL; + Ecore_X_Window *newset = NULL, *oldset = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS, + ECORE_X_ATOM_WINDOW, 32, &odata, &num)) + return; + + oldset = (Ecore_X_Window *)odata; + for (i = 0; i < num; i++) + { + if (oldset[i] == subwin) + { + if (num == 1) + { + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS); + if (odata) free(odata); + odata = NULL; + return; + } + else + { + newset = calloc(num - 1, sizeof(Ecore_X_Window)); + data = (unsigned char *)newset; + for (j = 0; j < num; ++j) + if (oldset[j] != subwin) + newset[k++] = oldset[j]; + + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS, + ECORE_X_ATOM_WINDOW, 32, data, k); + if (odata) free(odata); + odata = NULL; + free(newset); + return; + } + } + } + if (odata) free(odata); +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_image.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_image.c new file mode 100644 index 0000000..6789b94 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_image.c @@ -0,0 +1,740 @@ +#include "ecore_xcb_private.h" +#include +#include +#include +#include + +struct _Ecore_X_Image +{ + xcb_shm_segment_info_t shminfo; + xcb_image_t *xim; + Ecore_X_Visual vis; + int depth, w, h; + int bpl, bpp, rows; + unsigned char *data; + Eina_Bool shm : 1; +}; + +/* local function prototypes */ +static void _ecore_xcb_image_shm_check(void); +static void _ecore_xcb_image_shm_create(Ecore_X_Image *im); +static xcb_format_t *_ecore_xcb_image_find_format(const xcb_setup_t *setup, + uint8_t depth); + +/* local variables */ +static int _ecore_xcb_image_shm_can = -1; + +EAPI Ecore_X_Image * +ecore_x_image_new(int w, + int h, + Ecore_X_Visual vis, + int depth) +{ + Ecore_X_Image *im; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(im = calloc(1, sizeof(Ecore_X_Image)))) return NULL; + im->w = w; + im->h = h; + im->vis = vis; + im->depth = depth; + _ecore_xcb_image_shm_check(); + im->shm = _ecore_xcb_image_shm_can; + return im; +} + +EAPI void +ecore_x_image_free(Ecore_X_Image *im) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!im) return; + if (im->shm) + { + if (im->xim) + { + xcb_shm_detach(_ecore_xcb_conn, im->shminfo.shmseg); + xcb_image_destroy(im->xim); + shmdt(im->shminfo.shmaddr); + shmctl(im->shminfo.shmid, IPC_RMID, 0); + } + } + else if (im->xim) + { + if (im->xim->data) free(im->xim->data); + im->xim->data = NULL; + xcb_image_destroy(im->xim); + } + + free(im); +// ecore_x_flush(); +} + +EAPI Eina_Bool +ecore_x_image_get(Ecore_X_Image *im, + Ecore_X_Drawable draw, + int x, + int y, + int sx, + int sy, + int w, + int h) +{ + Eina_Bool ret = EINA_TRUE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (im->shm) + { + if (!im->xim) _ecore_xcb_image_shm_create(im); + if (!im->xim) return EINA_FALSE; + + if ((sx == 0) && (w == im->w)) + { + im->xim->data = (uint8_t *)im->data + (im->xim->stride * sy) + + (sx * im->bpp); + im->xim->width = w; + im->xim->height = h; + + ecore_x_grab(); + if (!xcb_image_shm_get(_ecore_xcb_conn, draw, im->xim, + im->shminfo, x, y, 0xffffffff)) + { + DBG("\tImage Shm Get Failed"); + ret = EINA_FALSE; + } + ecore_x_ungrab(); + ecore_x_sync(); // needed + } + else + { + Ecore_X_Image *tim; + + tim = ecore_x_image_new(w, h, im->vis, im->depth); + if (tim) + { + ret = ecore_x_image_get(tim, draw, x, y, 0, 0, w, h); + if (ret) + { + unsigned char *spixels, *pixels; + int sbpp = 0, sbpl = 0, srows = 0; + int bpp = 0, bpl = 0, rows = 0; + + spixels = + ecore_x_image_data_get(tim, &sbpl, &srows, &sbpp); + pixels = ecore_x_image_data_get(im, &bpl, &rows, &bpp); + if ((spixels) && (pixels)) + { + unsigned char *p, *sp; + int r = 0; + + p = (pixels + (sy * bpl) + (sx * bpp)); + sp = spixels; + for (r = srows; r > 0; r--) + { + memcpy(p, sp, sbpl); + p += bpl; + sp += sbpl; + } + } + } + ecore_x_image_free(tim); + } + } + } + else + { + ret = EINA_FALSE; + ecore_x_grab(); + im->xim = + xcb_image_get(_ecore_xcb_conn, draw, x, y, w, h, + 0xffffffff, XCB_IMAGE_FORMAT_Z_PIXMAP); + if (!im->xim) ret = EINA_FALSE; + ecore_x_ungrab(); + ecore_x_sync(); // needed + + if (im->xim) + { + im->data = (unsigned char *)im->xim->data; + im->bpl = im->xim->stride; + im->rows = im->xim->height; + if (im->xim->bpp <= 8) + im->bpp = 1; + else if (im->xim->bpp <= 16) + im->bpp = 2; + else + im->bpp = 4; + } + } + + return ret; +} + +EAPI void * +ecore_x_image_data_get(Ecore_X_Image *im, + int *bpl, + int *rows, + int *bpp) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!im) return NULL; + if (!im->xim) _ecore_xcb_image_shm_create(im); + if (!im->xim) return NULL; + + if (bpl) *bpl = im->bpl; + if (rows) *rows = im->rows; + if (bpp) *bpp = im->bpp; + + return im->data; +} + +EAPI void +ecore_x_image_put(Ecore_X_Image *im, + Ecore_X_Drawable draw, + Ecore_X_GC gc, + int x, + int y, + int sx, + int sy, + int w, + int h) +{ + Ecore_X_GC tgc = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!gc) + { + uint32_t mask, values[1]; + + tgc = xcb_generate_id(_ecore_xcb_conn); + mask = XCB_GC_SUBWINDOW_MODE; + values[0] = XCB_SUBWINDOW_MODE_INCLUDE_INFERIORS; + xcb_create_gc(_ecore_xcb_conn, tgc, draw, mask, values); + gc = tgc; + } + if (!im->xim) _ecore_xcb_image_shm_create(im); + if (im->xim) + { + if (im->shm) + xcb_shm_put_image(_ecore_xcb_conn, draw, gc, im->xim->width, + im->xim->height, sx, sy, w, h, x, y, + im->xim->depth, im->xim->format, 0, + im->shminfo.shmseg, + im->xim->data - im->shminfo.shmaddr); +// xcb_image_shm_put(_ecore_xcb_conn, draw, gc, im->xim, +// im->shminfo, sx, sy, x, y, w, h, 0); + else + xcb_image_put(_ecore_xcb_conn, draw, gc, im->xim, sx, sy, 0); + } + if (tgc) ecore_x_gc_free(tgc); + ecore_x_sync(); +} + +EAPI Eina_Bool +ecore_x_image_is_argb32_get(Ecore_X_Image *im) +{ + xcb_visualtype_t *vis; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + vis = (xcb_visualtype_t *)im->vis; + if (!im->xim) _ecore_xcb_image_shm_create(im); + + if (((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) || + (vis->_class == XCB_VISUAL_CLASS_DIRECT_COLOR)) && + (im->depth >= 24) && (vis->red_mask == 0xff0000) && + (vis->green_mask == 0x00ff00) && (vis->blue_mask == 0x0000ff)) + { +#ifdef WORDS_BIGENDIAN + if (im->xim->byte_order == XCB_IMAGE_ORDER_LSB_FIRST) + return EINA_TRUE; +#else + if (im->xim->byte_order == XCB_IMAGE_ORDER_MSB_FIRST) + return EINA_TRUE; +#endif + } + + return EINA_FALSE; +} + +EAPI Eina_Bool +ecore_x_image_to_argb_convert(void *src, + int sbpp, + int sbpl, + Ecore_X_Colormap c, + Ecore_X_Visual v, + int x, + int y, + int w, + int h, + unsigned int *dst, + int dbpl, + int dx, + int dy) +{ + xcb_visualtype_t *vis; + uint32_t *cols; + int n = 0, nret = 0, i, row, mode = 0; + unsigned int pal[256], r, g, b; + enum + { + rgbnone = 0, + rgb565, + bgr565, + rgbx555, + argbx888, + abgrx888, + rgba888x, + bgra888x, + argbx666 + }; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + sbpp *= 8; + + vis = (xcb_visualtype_t *)v; + n = vis->colormap_entries; + if ((n <= 256) && + ((vis->_class == XCB_VISUAL_CLASS_PSEUDO_COLOR) || + (vis->_class == XCB_VISUAL_CLASS_STATIC_COLOR) || + (vis->_class == XCB_VISUAL_CLASS_GRAY_SCALE) || + (vis->_class == XCB_VISUAL_CLASS_STATIC_GRAY))) + { + xcb_query_colors_cookie_t cookie; + xcb_query_colors_reply_t *reply; + + if (!c) + { + c = (xcb_colormap_t)((xcb_screen_t *) + _ecore_xcb_screen)->default_colormap; + } + + cols = alloca(n * sizeof(uint32_t)); + for (i = 0; i < n; i++) + cols[i] = i; + + cookie = xcb_query_colors_unchecked(_ecore_xcb_conn, c, n, cols); + reply = xcb_query_colors_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + xcb_rgb_iterator_t iter; + xcb_rgb_t *ret; + + iter = xcb_query_colors_colors_iterator(reply); + ret = xcb_query_colors_colors(reply); + if (ret) + { + for (i = 0; iter.rem; xcb_rgb_next(&iter), i++) + { + pal[i] = 0xff000000 | + ((iter.data->red >> 8) << 16) | + ((iter.data->green >> 8) << 8) | + ((iter.data->blue >> 8)); + } + nret = n; + } + free(reply); + } + } + else if ((vis->_class == XCB_VISUAL_CLASS_TRUE_COLOR) || + (vis->_class == XCB_VISUAL_CLASS_DIRECT_COLOR)) + { + if ((vis->red_mask == 0x00ff0000) && + (vis->green_mask == 0x0000ff00) && + (vis->blue_mask == 0x000000ff)) + mode = argbx888; + else if ((vis->red_mask == 0x000000ff) && + (vis->green_mask == 0x0000ff00) && + (vis->blue_mask == 0x00ff0000)) + mode = abgrx888; + else if ((vis->red_mask == 0xff000000) && + (vis->green_mask == 0x00ff0000) && + (vis->blue_mask == 0x0000ff00)) + mode = rgba888x; + else if ((vis->red_mask == 0x0000ff00) && + (vis->green_mask == 0x00ff0000) && + (vis->blue_mask == 0xff000000)) + mode = bgra888x; + else if ((vis->red_mask == 0x0003f000) && + (vis->green_mask == 0x00000fc0) && + (vis->blue_mask == 0x0000003f)) + mode = argbx666; + else if ((vis->red_mask == 0x0000f800) && + (vis->green_mask == 0x000007e0) && + (vis->blue_mask == 0x0000001f)) + mode = rgb565; + else if ((vis->red_mask == 0x0000001f) && + (vis->green_mask == 0x000007e0) && + (vis->blue_mask == 0x0000f800)) + mode = bgr565; + else if ((vis->red_mask == 0x00007c00) && + (vis->green_mask == 0x000003e0) && + (vis->blue_mask == 0x0000001f)) + mode = rgbx555; + else + return EINA_FALSE; + } + for (row = 0; row < h; row++) + { + unsigned char *s8; + unsigned short *s16; + unsigned int *s32, *dp, *de; + + dp = ((unsigned int *)(((unsigned char *)dst) + + ((dy + row) * dbpl))) + dx; + de = dp + w; + switch (sbpp) + { + case 8: + s8 = ((unsigned char *)(((unsigned char *)src) + + ((y + row) * sbpl))) + x; + if (nret > 0) + { + while (dp < de) + { + *dp = pal[*s8]; + s8++; dp++; + } + } + else + return EINA_FALSE; + break; + + case 16: + s16 = ((unsigned short *)(((unsigned char *)src) + + ((y + row) * sbpl))) + x; + switch (mode) + { + case rgb565: + while (dp < de) + { + r = (*s16 & 0xf800) << 8; + g = (*s16 & 0x07e0) << 5; + b = (*s16 & 0x001f) << 3; + r |= (r >> 5) & 0xff0000; + g |= (g >> 6) & 0x00ff00; + b |= (b >> 5); + *dp = 0xff000000 | r | g | b; + s16++; dp++; + } + break; + + case bgr565: + while (dp < de) + { + r = (*s16 & 0x001f) << 19; + g = (*s16 & 0x07e0) << 5; + b = (*s16 & 0xf800) >> 8; + r |= (r >> 5) & 0xff0000; + g |= (g >> 6) & 0x00ff00; + b |= (b >> 5); + *dp = 0xff000000 | r | g | b; + s16++; dp++; + } + break; + + case rgbx555: + while (dp < de) + { + r = (*s16 & 0x7c00) << 9; + g = (*s16 & 0x03e0) << 6; + b = (*s16 & 0x001f) << 3; + r |= (r >> 5) & 0xff0000; + g |= (g >> 5) & 0x00ff00; + b |= (b >> 5); + *dp = 0xff000000 | r | g | b; + s16++; dp++; + } + break; + + default: + return EINA_FALSE; + break; + } + break; + + case 24: + case 32: + s32 = ((unsigned int *)(((unsigned char *)src) + + ((y + row) * sbpl))) + x; + switch (mode) + { + case argbx888: + while (dp < de) + { + *dp = 0xff000000 | *s32; + s32++; dp++; + } + break; + + case abgrx888: + while (dp < de) + { + r = *s32 & 0x000000ff; + g = *s32 & 0x0000ff00; + b = *s32 & 0x00ff0000; + *dp = 0xff000000 | (r << 16) | (g) | (b >> 16); + s32++; dp++; + } + break; + + case rgba888x: + while (dp < de) + { + *dp = 0xff000000 | (*s32 >> 8); + s32++; dp++; + } + break; + + case bgra888x: + while (dp < de) + { + r = *s32 & 0x0000ff00; + g = *s32 & 0x00ff0000; + b = *s32 & 0xff000000; + *dp = 0xff000000 | (r << 8) | (g >> 8) | (b >> 24); + s32++; dp++; + } + break; + + case argbx666: + while (dp < de) + { + r = (*s32 & 0x3f000) << 6; + g = (*s32 & 0x00fc0) << 4; + b = (*s32 & 0x0003f) << 2; + r |= (r >> 6) & 0xff0000; + g |= (g >> 6) & 0x00ff00; + b |= (b >> 6); + *dp = 0xff000000 | r | g | b; + s32++; dp++; + } + break; + + default: + return EINA_FALSE; + break; + } + break; + break; + + default: + return EINA_FALSE; + break; + } + } + return EINA_TRUE; +} + +/* local functions */ +static void +_ecore_xcb_image_shm_check(void) +{ +// xcb_shm_query_version_reply_t *reply; + xcb_shm_segment_info_t shminfo; + xcb_shm_get_image_cookie_t cookie; + xcb_shm_get_image_reply_t *ireply; + xcb_image_t *img = 0; + uint8_t depth = 0; + + if (_ecore_xcb_image_shm_can != -1) return; + CHECK_XCB_CONN; + + /* reply = */ + /* xcb_shm_query_version_reply(_ecore_xcb_conn, */ + /* xcb_shm_query_version(_ecore_xcb_conn), NULL); */ + /* if (!reply) */ + /* { */ + /* _ecore_xcb_image_shm_can = 0; */ + /* return; */ + /* } */ + + /* if ((reply->major_version < 1) || */ + /* ((reply->major_version == 1) && (reply->minor_version == 0))) */ + /* { */ + /* _ecore_xcb_image_shm_can = 0; */ + /* free(reply); */ + /* return; */ + /* } */ + + /* free(reply); */ + + depth = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth; + + ecore_x_sync(); // needed + + img = _ecore_xcb_image_create_native(1, 1, XCB_IMAGE_FORMAT_Z_PIXMAP, + depth, NULL, ~0, NULL); + if (!img) + { + _ecore_xcb_image_shm_can = 0; + return; + } + + shminfo.shmid = + shmget(IPC_PRIVATE, img->stride * img->height, (IPC_CREAT | 0666)); + if (shminfo.shmid == (uint32_t)-1) + { + xcb_image_destroy(img); + _ecore_xcb_image_shm_can = 0; + return; + } + + shminfo.shmaddr = shmat(shminfo.shmid, 0, 0); + img->data = shminfo.shmaddr; + if (img->data == (uint8_t *)-1) + { + xcb_image_destroy(img); + _ecore_xcb_image_shm_can = 0; + return; + } + + shminfo.shmseg = xcb_generate_id(_ecore_xcb_conn); + xcb_shm_attach(_ecore_xcb_conn, shminfo.shmseg, shminfo.shmid, 0); + + cookie = + xcb_shm_get_image(_ecore_xcb_conn, + ((xcb_screen_t *)_ecore_xcb_screen)->root, + 0, 0, img->width, img->height, + 0xffffffff, img->format, + shminfo.shmseg, img->data - shminfo.shmaddr); + + ecore_x_sync(); // needed + + ireply = xcb_shm_get_image_reply(_ecore_xcb_conn, cookie, NULL); + if (ireply) + { + _ecore_xcb_image_shm_can = 1; + free(ireply); + } + else + _ecore_xcb_image_shm_can = 0; + + xcb_shm_detach(_ecore_xcb_conn, shminfo.shmseg); + xcb_image_destroy(img); + shmdt(shminfo.shmaddr); + shmctl(shminfo.shmid, IPC_RMID, 0); +} + +static void +_ecore_xcb_image_shm_create(Ecore_X_Image *im) +{ + CHECK_XCB_CONN; + + im->xim = + _ecore_xcb_image_create_native(im->w, im->h, XCB_IMAGE_FORMAT_Z_PIXMAP, + im->depth, NULL, ~0, NULL); + if (!im->xim) return; + + im->shminfo.shmid = shmget(IPC_PRIVATE, im->xim->size, (IPC_CREAT | 0666)); + if (im->shminfo.shmid == (uint32_t)-1) + { + xcb_image_destroy(im->xim); + return; + } + + im->shminfo.shmaddr = shmat(im->shminfo.shmid, 0, 0); + im->xim->data = im->shminfo.shmaddr; + if ((!im->xim->data) || (im->xim->data == (uint8_t *)-1)) + { + DBG("Shm Create No Image Data"); + xcb_image_destroy(im->xim); + shmdt(im->shminfo.shmaddr); + shmctl(im->shminfo.shmid, IPC_RMID, 0); + return; + } + + im->shminfo.shmseg = xcb_generate_id(_ecore_xcb_conn); + xcb_shm_attach(_ecore_xcb_conn, im->shminfo.shmseg, im->shminfo.shmid, 0); + + im->data = (unsigned char *)im->xim->data; + im->bpl = im->xim->stride; + im->rows = im->xim->height; + if (im->xim->bpp <= 8) + im->bpp = 1; + else if (im->xim->bpp <= 16) + im->bpp = 2; + else + im->bpp = 4; +} + +xcb_image_t * +_ecore_xcb_image_create_native(int w, + int h, + xcb_image_format_t format, + uint8_t depth, + void *base, + uint32_t bytes, + uint8_t *data) +{ + static uint8_t dpth = 0; + static xcb_format_t *fmt = NULL; + const xcb_setup_t *setup; + xcb_image_format_t xif; + + CHECK_XCB_CONN; + + /* NB: We cannot use xcb_image_create_native as it only creates images + * using MSB_FIRST, so this routine recreates that function and uses + * the endian-ness of the server setup */ + setup = xcb_get_setup(_ecore_xcb_conn); + xif = format; + + if ((xif == XCB_IMAGE_FORMAT_Z_PIXMAP) && (depth == 1)) + xif = XCB_IMAGE_FORMAT_XY_PIXMAP; + + if (dpth != depth) + { + dpth = depth; + fmt = _ecore_xcb_image_find_format(setup, depth); + if (!fmt) return 0; + } + + switch (xif) + { + case XCB_IMAGE_FORMAT_XY_BITMAP: + if (depth != 1) return 0; + + case XCB_IMAGE_FORMAT_XY_PIXMAP: + case XCB_IMAGE_FORMAT_Z_PIXMAP: + return xcb_image_create(w, h, xif, + fmt->scanline_pad, + fmt->depth, fmt->bits_per_pixel, + setup->bitmap_format_scanline_unit, + setup->image_byte_order, + setup->bitmap_format_bit_order, + base, bytes, data); + + default: + break; + } + + return 0; +} + +static xcb_format_t * +_ecore_xcb_image_find_format(const xcb_setup_t *setup, + uint8_t depth) +{ + xcb_format_t *fmt, *fmtend; + + CHECK_XCB_CONN; + + fmt = xcb_setup_pixmap_formats(setup); + fmtend = fmt + xcb_setup_pixmap_formats_length(setup); + for (; fmt != fmtend; ++fmt) + if (fmt->depth == depth) + return fmt; + + return 0; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_input.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_input.c new file mode 100644 index 0000000..c0338c2 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_input.c @@ -0,0 +1,274 @@ +#include "ecore_xcb_private.h" +#ifdef ECORE_XCB_XINPUT +# include +# include +#endif + +/* FIXME: this is a guess. can't find defines for touch events in xcb libs + * online */ +/* these are not yet defined in xcb support for xi2 - so manually create */ +#ifndef XCB_INPUT_DEVICE_TOUCH_BEGIN +#define XCB_INPUT_DEVICE_TOUCH_BEGIN 18 +#endif +#ifndef XCB_INPUT_DEVICE_TOUCH_END +#define XCB_INPUT_DEVICE_TOUCH_END 19 +#endif +#ifndef XCB_INPUT_DEVICE_TOUCH_UPDATE +#define XCB_INPUT_DEVICE_TOUCH_UPDATE 21 +#endif + +#ifndef XCB_INPUT_POINTER_EMULATED_MASK +#define XCB_INPUT_POINTER_EMULATED_MASK (1 << 16) +#endif + +/* local variables */ +static Eina_Bool _input_avail = EINA_FALSE; + +/* external variables */ +int _ecore_xcb_event_input = 0; + +void +_ecore_xcb_input_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_XINPUT + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_input_id); +#endif +} + +void +_ecore_xcb_input_finalize(void) +{ +#ifdef ECORE_XCB_XINPUT + xcb_input_get_extension_version_cookie_t cookie; + xcb_input_get_extension_version_reply_t *reply; + char buff[128]; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_XINPUT + cookie = + xcb_input_get_extension_version_unchecked(_ecore_xcb_conn, 127, buff); + reply = + xcb_input_get_extension_version_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + _input_avail = EINA_TRUE; + free(reply); + } + + if (_input_avail) + { + const xcb_query_extension_reply_t *ext_reply; + + ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_input_id); + if (ext_reply) + _ecore_xcb_event_input = ext_reply->first_event; + } +#endif +} + +void +_ecore_xcb_input_shutdown(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); +} + +void +#ifdef ECORE_XCB_XINPUT +_ecore_xcb_input_handle_event(xcb_generic_event_t *event) +#else +_ecore_xcb_input_handle_event(xcb_generic_event_t * event __UNUSED__) +#endif +{ +#ifdef ECORE_XCB_XINPUT + xcb_ge_event_t *ev; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + /* FIXME: look at xlib ecore_x_xi2.c to copy logic in when i can find an + * xcb-input lib to test with */ +#ifdef ECORE_XCB_XINPUT + ev = (xcb_ge_event_t *)event; + switch (ev->event_type) + { + case XCB_INPUT_DEVICE_MOTION_NOTIFY: + { + xcb_input_device_motion_notify_event_t *de; + unsigned int child_win = 0; + + de = (xcb_input_device_motion_notify_event_t *)ev->pad1; + child_win = (de->child ? de->child : de->event); + _ecore_xcb_event_mouse_move(de->time, de->state, de->event_x, + de->event_y, de->root_x, de->root_y, + de->event, child_win, de->root, + de->same_screen, de->device_id, + 1, 1, 1.0, 0.0, + de->event_x, de->event_y, + de->root_x, de->root_y); + } + break; + + case XCB_INPUT_DEVICE_BUTTON_PRESS: + { + xcb_input_device_button_press_event_t *de; + unsigned int child_win = 0; + + de = (xcb_input_device_button_press_event_t *)ev->pad1; + child_win = (de->child ? de->child : de->event); + _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN, + de->time, de->state, de->detail, + de->event_x, de->event_y, + de->root_x, de->root_y, de->event, + child_win, de->root, + de->same_screen, de->device_id, + 1, 1, 1.0, 0.0, + de->event_x, de->event_y, + de->root_x, de->root_y); + } + break; + + case XCB_INPUT_DEVICE_BUTTON_RELEASE: + { + xcb_input_device_button_release_event_t *de; + unsigned int child_win = 0; + + de = (xcb_input_device_button_release_event_t *)ev->pad1; + child_win = (de->child ? de->child : de->event); + _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP, + de->time, de->state, de->detail, + de->event_x, de->event_y, + de->root_x, de->root_y, de->event, + child_win, de->root, + de->same_screen, de->device_id, + 1, 1, 1.0, 0.0, + de->event_x, de->event_y, + de->root_x, de->root_y); + } + break; + + case XCB_INPUT_DEVICE_TOUCH_UPDATE: + { + xcb_input_device_motion_notify_event_t *de; + unsigned int child_win = 0; + + de = (xcb_input_device_motion_notify_event_t *)ev->pad1; + child_win = (de->child ? de->child : de->event); + _ecore_xcb_event_mouse_move(de->time, de->state, de->event_x, + de->event_y, de->root_x, de->root_y, + de->event, child_win, de->root, + de->same_screen, de->device_id, + 1, 1, 1.0, 0.0, + de->event_x, de->event_y, + de->root_x, de->root_y); + } + break; + + case XCB_INPUT_DEVICE_TOUCH_BEGIN: + { + xcb_input_device_button_press_event_t *de; + unsigned int child_win = 0; + + de = (xcb_input_device_button_press_event_t *)ev->pad1; + child_win = (de->child ? de->child : de->event); + _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN, + de->time, de->state, de->detail, + de->event_x, de->event_y, + de->root_x, de->root_y, de->event, + child_win, de->root, + de->same_screen, de->device_id, + 1, 1, 1.0, 0.0, + de->event_x, de->event_y, + de->root_x, de->root_y); + } + break; + + case XCB_INPUT_DEVICE_TOUCH_END: + { + xcb_input_device_button_release_event_t *de; + unsigned int child_win = 0; + + de = (xcb_input_device_button_release_event_t *)ev->pad1; + child_win = (de->child ? de->child : de->event); + _ecore_xcb_event_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP, + de->time, de->state, de->detail, + de->event_x, de->event_y, + de->root_x, de->root_y, de->event, + child_win, de->root, + de->same_screen, de->device_id, + 1, 1, 1.0, 0.0, + de->event_x, de->event_y, + de->root_x, de->root_y); + } + break; + + default: + break; + } +#endif +} + +EAPI Eina_Bool +ecore_x_input_multi_select(Ecore_X_Window win) +{ + Eina_Bool find = EINA_FALSE; +#ifdef ECORE_XCB_XINPUT + xcb_input_list_input_devices_cookie_t dcookie; + xcb_input_list_input_devices_reply_t *dreply; + xcb_input_device_info_iterator_t diter; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_input_avail) return EINA_FALSE; + + /* FIXME: i can't seemingly test this! no xcb input lib so can't look and + * test and look at types etc. - look at xlib code and copy logic over + * when we can */ +#ifdef ECORE_XCB_XINPUT + dcookie = xcb_input_list_input_devices_unchecked(_ecore_xcb_conn); + dreply = + xcb_input_list_input_devices_reply(_ecore_xcb_conn, dcookie, NULL); + if (!dreply) return EINA_FALSE; + + diter = xcb_input_list_input_devices_devices_iterator(dreply); + while (diter.rem) + { + xcb_input_device_info_t *dev; + const xcb_input_event_class_t iclass[] = + { + XCB_INPUT_DEVICE_BUTTON_PRESS, + XCB_INPUT_DEVICE_BUTTON_RELEASE, + XCB_INPUT_DEVICE_MOTION_NOTIFY, + XCB_INPUT_DEVICE_TOUCH_BEGIN, + XCB_INPUT_DEVICE_TOUCH_END, + XCB_INPUT_DEVICE_TOUCH_UPDATE + }; + + dev = diter.data; + if (dev->device_use == XCB_INPUT_DEVICE_USE_IS_X_EXTENSION_DEVICE) + { + DBG("Device %d", dev->device_id); + DBG("\tType: %d", dev->device_type); + DBG("\tNum Classes: %d", dev->num_class_info); + DBG("\tUse: %d", dev->device_use); + + xcb_input_select_extension_event(_ecore_xcb_conn, win, + sizeof(iclass) / sizeof(xcb_input_event_class_t), + iclass); + find = EINA_TRUE; + } + xcb_input_device_info_next(&diter); + } + free(dreply); +#endif + + return find; + win = 0; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_keymap.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_keymap.c new file mode 100644 index 0000000..40304df --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_keymap.c @@ -0,0 +1,482 @@ +#include "ecore_xcb_private.h" +#define NEED_KEYSYM_TABLE +#define NEED_VTABLE +#include "ecore_xcb_keysym_table.h" +#include +#include + +/* local function prototypes */ +static int _ecore_xcb_keymap_mask_get(void *reply, + xcb_keysym_t sym); +static xcb_keysym_t _ecore_xcb_keymap_string_to_keysym(const char *str); +static int _ecore_xcb_keymap_translate_key(xcb_keycode_t keycode, + unsigned int modifiers, + unsigned int *modifiers_return, + xcb_keysym_t *keysym_return); +static int _ecore_xcb_keymap_translate_keysym(xcb_keysym_t keysym, + unsigned int modifiers, + char *buffer, + int bytes); + +/* local variables */ +static xcb_key_symbols_t *_ecore_xcb_keysyms; +static int _ecore_xcb_mode_switch = 0; + +/* public variables */ +EAPI int ECORE_X_MODIFIER_SHIFT = 0; +EAPI int ECORE_X_MODIFIER_CTRL = 0; +EAPI int ECORE_X_MODIFIER_ALT = 0; +EAPI int ECORE_X_MODIFIER_WIN = 0; +EAPI int ECORE_X_LOCK_SCROLL = 0; +EAPI int ECORE_X_LOCK_NUM = 0; +EAPI int ECORE_X_LOCK_CAPS = 0; +EAPI int ECORE_X_LOCK_SHIFT = 0; + +void +_ecore_xcb_keymap_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_xcb_keysyms = xcb_key_symbols_alloc(_ecore_xcb_conn); +} + +void +_ecore_xcb_keymap_finalize(void) +{ + xcb_get_modifier_mapping_cookie_t cookie; + xcb_get_modifier_mapping_reply_t *reply; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = xcb_get_modifier_mapping_unchecked(_ecore_xcb_conn); + reply = xcb_get_modifier_mapping_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) + { + xcb_key_symbols_free(_ecore_xcb_keysyms); + return; + } + + _ecore_xcb_mode_switch = _ecore_xcb_keymap_mask_get(reply, XK_Mode_switch); + + ECORE_X_MODIFIER_SHIFT = _ecore_xcb_keymap_mask_get(reply, XK_Shift_L); + ECORE_X_MODIFIER_CTRL = _ecore_xcb_keymap_mask_get(reply, XK_Control_L); + + ECORE_X_MODIFIER_ALT = _ecore_xcb_keymap_mask_get(reply, XK_Alt_L); + if (!ECORE_X_MODIFIER_ALT) + ECORE_X_MODIFIER_ALT = _ecore_xcb_keymap_mask_get(reply, XK_Meta_L); + if (!ECORE_X_MODIFIER_ALT) + ECORE_X_MODIFIER_ALT = _ecore_xcb_keymap_mask_get(reply, XK_Super_L); + + ECORE_X_MODIFIER_WIN = _ecore_xcb_keymap_mask_get(reply, XK_Super_L); + if (!ECORE_X_MODIFIER_WIN) + ECORE_X_MODIFIER_WIN = _ecore_xcb_keymap_mask_get(reply, XK_Mode_switch); + if (!ECORE_X_MODIFIER_WIN) + ECORE_X_MODIFIER_WIN = _ecore_xcb_keymap_mask_get(reply, XK_Meta_L); + + if (ECORE_X_MODIFIER_WIN == ECORE_X_MODIFIER_ALT) + ECORE_X_MODIFIER_WIN = 0; + if (ECORE_X_MODIFIER_ALT == ECORE_X_MODIFIER_CTRL) + ECORE_X_MODIFIER_ALT = 0; + + ECORE_X_LOCK_SCROLL = _ecore_xcb_keymap_mask_get(reply, XK_Scroll_Lock); + ECORE_X_LOCK_NUM = _ecore_xcb_keymap_mask_get(reply, XK_Num_Lock); + ECORE_X_LOCK_CAPS = _ecore_xcb_keymap_mask_get(reply, XK_Caps_Lock); + ECORE_X_LOCK_SHIFT = _ecore_xcb_keymap_mask_get(reply, XK_Shift_Lock); +} + +void +_ecore_xcb_modifiers_get(void) +{ + _ecore_xcb_keymap_finalize(); +} + +void +_ecore_xcb_keymap_shutdown(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (_ecore_xcb_keysyms) xcb_key_symbols_free(_ecore_xcb_keysyms); +} + +void +_ecore_xcb_keymap_refresh(xcb_mapping_notify_event_t *event) +{ + CHECK_XCB_CONN; + xcb_refresh_keyboard_mapping(_ecore_xcb_keysyms, event); +} + +xcb_keysym_t +_ecore_xcb_keymap_keycode_to_keysym(xcb_keycode_t keycode, + int col) +{ + xcb_keysym_t key0, key1; + + CHECK_XCB_CONN; + if (col & _ecore_xcb_mode_switch) + { + key0 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 4); + key1 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 5); + } + else + { + key0 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 0); + key1 = xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, keycode, 1); + } + + if (key1 == XCB_NO_SYMBOL) + key1 = key0; + + if ((col & ECORE_X_LOCK_NUM) && + ((xcb_is_keypad_key(key1)) || (xcb_is_private_keypad_key(key1)))) + { + if ((col & XCB_MOD_MASK_SHIFT) || + ((col & XCB_MOD_MASK_LOCK) && (col & ECORE_X_LOCK_SHIFT))) + return key0; + else + return key1; + } + else if (!(col & XCB_MOD_MASK_SHIFT) && !(col & XCB_MOD_MASK_LOCK)) + return key0; + else if (!(col & XCB_MOD_MASK_SHIFT) && + (col & XCB_MOD_MASK_LOCK && (col & ECORE_X_LOCK_CAPS))) + return key1; + else if ((col & XCB_MOD_MASK_SHIFT) && + (col & XCB_MOD_MASK_LOCK) && (col & ECORE_X_LOCK_CAPS)) + return key0; + else if ((col & XCB_MOD_MASK_SHIFT) || + (col & XCB_MOD_MASK_LOCK && (col & ECORE_X_LOCK_SHIFT))) + return key1; + + return XCB_NO_SYMBOL; +} + +xcb_keycode_t * +_ecore_xcb_keymap_keysym_to_keycode(xcb_keysym_t keysym) +{ + CHECK_XCB_CONN; + return xcb_key_symbols_get_keycode(_ecore_xcb_keysyms, keysym); +} + +char * +_ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym) +{ + int i = 0, n = 0, h = 0, idx = 0; + const unsigned char *entry; + unsigned char val1, val2, val3, val4; + + CHECK_XCB_CONN; + if (!keysym) return NULL; + if (keysym == XK_VoidSymbol) keysym = 0; + if (keysym <= 0x1fffffff) + { + val1 = (keysym >> 24); + val2 = ((keysym >> 16) & 0xff); + val3 = ((keysym >> 8) & 0xff); + val4 = (keysym & 0xff); + i = keysym % VTABLESIZE; + h = i + 1; + n = VMAXHASH; + while ((idx = hashKeysym[i])) + { + entry = &_ecore_xcb_keytable[idx]; + if ((entry[0] == val1) && (entry[1] == val2) && + (entry[2] == val3) && (entry[3] == val4)) + return (char *)entry + 4; + if (!--n) break; + i += h; + if (i >= VTABLESIZE) i -= VTABLESIZE; + } + } + + if ((keysym >= 0x01000100) && (keysym <= 0x0110ffff)) + { + xcb_keysym_t val; + char *s = NULL; + int i = 0; + + val = (keysym & 0xffffff); + if (val & 0xff0000) + i = 10; + else + i = 6; + + if (!(s = malloc(i))) return NULL; + i--; + s[i--] = '\0'; + for (; i; i--) + { + val1 = (val & 0xf); + val >>= 4; + if (val1 < 10) + s[i] = '0' + val1; + else + s[i] = 'A' + val1 - 10; + } + s[i] = 'U'; + return s; + } + + return NULL; +} + +xcb_keycode_t +_ecore_xcb_keymap_string_to_keycode(const char *key) +{ + if (!strncmp(key, "Keycode-", 8)) + return atoi(key + 8); + else + { + xcb_keysym_t keysym = XCB_NO_SYMBOL; + xcb_keycode_t *keycodes, keycode = 0; + int i = 0; + + CHECK_XCB_CONN; + + keysym = _ecore_xcb_keymap_string_to_keysym(key); + if (keysym == XCB_NO_SYMBOL) return XCB_NO_SYMBOL; + + keycodes = _ecore_xcb_keymap_keysym_to_keycode(keysym); + if (!keycodes) return XCB_NO_SYMBOL; + + while (keycodes[i] != XCB_NO_SYMBOL) + { + if (keycodes[i] != 0) + { + keycode = keycodes[i]; + break; + } + i++; + } + return keycode; + } +} + +int +_ecore_xcb_keymap_lookup_string(xcb_keycode_t keycode, + int state, + char *buffer, + int bytes, + xcb_keysym_t *sym) +{ + unsigned int modifiers = 0; + xcb_keysym_t keysym; + + CHECK_XCB_CONN; + if (!_ecore_xcb_keymap_translate_key(keycode, state, &modifiers, &keysym)) + return 0; + + if (sym) *sym = keysym; + + return _ecore_xcb_keymap_translate_keysym(keysym, state, buffer, bytes); +} + +EAPI const char * +ecore_x_keysym_string_get(int keysym) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_keymap_keysym_to_string(keysym); +} + +/* local functions */ +static int +_ecore_xcb_keymap_mask_get(void *reply, + xcb_keysym_t sym) +{ + xcb_get_modifier_mapping_reply_t *rep; + xcb_keysym_t sym2; + int mask = 0; + const int masks[8] = + { + XCB_MOD_MASK_SHIFT, XCB_MOD_MASK_LOCK, XCB_MOD_MASK_CONTROL, + XCB_MOD_MASK_1, XCB_MOD_MASK_2, XCB_MOD_MASK_3, XCB_MOD_MASK_4, + XCB_MOD_MASK_5 + }; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + rep = (xcb_get_modifier_mapping_reply_t *)reply; + if ((rep) && (rep->keycodes_per_modifier > 0)) + { + int i = 0; + xcb_keycode_t *modmap; + + modmap = xcb_get_modifier_mapping_keycodes(rep); + for (i = 0; i < (8 * rep->keycodes_per_modifier); i++) + { + int j = 0; + + for (j = 0; j < 8; j++) + { + sym2 = + xcb_key_symbols_get_keysym(_ecore_xcb_keysyms, + modmap[i], j); + if (sym2 != 0) break; + } + if (sym2 == sym) + { + mask = masks[i / rep->keycodes_per_modifier]; + break; + } + } + } + + return mask; +} + +static xcb_keysym_t +_ecore_xcb_keymap_string_to_keysym(const char *str) +{ + int i = 0, n = 0, h = 0; + unsigned long sig = 0; + const char *p = NULL; + int c = 0, idx = 0; + const unsigned char *entry; + unsigned char sig1, sig2; + long unsigned int val; + + p = str; + while ((c = *p++)) + sig = (sig << 1) + c; + + i = (sig % KTABLESIZE); + h = i + 1; + sig1 = (sig >> 8) & 0xff; + sig2 = sig & 0xff; + n = KMAXHASH; + + while ((idx = hashString[i])) + { + entry = &_ecore_xcb_keytable[idx]; + if ((entry[0] == sig1) && (entry[1] == sig2) && + !strcmp(str, (char *)entry + 6)) + { + val = ((entry[2] << 24) | (entry[3] << 16) | + (entry[4] << 8) | (entry[5])); + if (!val) val = 0xffffff; + return val; + } + if (!--n) break; + i += h; + if (i >= KTABLESIZE) i -= KTABLESIZE; + } + + if (*str == 'U') + { + val = 0; + for (p = &str[1]; *p; p++) + { + c = *p; + if (('0' <= c) && (c <= '9')) + val = (val << 4) + c - '0'; + else if (('a' <= c) && (c <= 'f')) + val = (val << 4) + c - 'a' + 10; + else if (('A' <= c) && (c <= 'F')) + val = (val << 4) + c - 'A' + 10; + else + return XCB_NO_SYMBOL; + if (val > 0x10ffff) return XCB_NO_SYMBOL; + } + if ((val < 0x20) || ((val > 0x7e) && (val < 0xa0))) + return XCB_NO_SYMBOL; + if (val < 0x100) return val; + return val | 0x01000000; + } + + if ((strlen(str) > 2) && (str[0] == '0') && (str[1] == 'x')) + { + char *tmp = NULL; + + val = strtoul(str, &tmp, 16); + if ((val == ULONG_MAX) || ((tmp) && (*tmp != '\0'))) + return XCB_NO_SYMBOL; + else + return val; + } + + if (!strncmp(str, "XF86_", 5)) + { + long unsigned int ret; + char *tmp; + + tmp = strdup(str); + if (!tmp) return XCB_NO_SYMBOL; + memmove(&tmp[4], &tmp[5], strlen(str) - 5 + 1); + ret = _ecore_xcb_keymap_string_to_keysym(tmp); + free(tmp); + return ret; + } + + return XCB_NO_SYMBOL; +} + +static int +_ecore_xcb_keymap_translate_key(xcb_keycode_t keycode, + unsigned int modifiers, + unsigned int *modifiers_return, + xcb_keysym_t *keysym_return) +{ + xcb_keysym_t sym; + + if (!_ecore_xcb_keysyms) return 0; + + sym = _ecore_xcb_keymap_keycode_to_keysym(keycode, modifiers); + + if (modifiers_return) + *modifiers_return = ((XCB_MOD_MASK_SHIFT | XCB_MOD_MASK_LOCK) | + _ecore_xcb_mode_switch | ECORE_X_LOCK_NUM); + if (keysym_return) + *keysym_return = sym; + + return 1; +} + +static int +_ecore_xcb_keymap_translate_keysym(xcb_keysym_t keysym, + unsigned int modifiers, + char *buffer, + int bytes) +{ + unsigned long hbytes = 0; + unsigned char c; + + if (!keysym) return 0; + hbytes = (keysym >> 8); + + if (!(bytes && + ((hbytes == 0) || + ((hbytes == 0xFF) && + (((keysym >= XK_BackSpace) && (keysym <= XK_Clear)) || + (keysym == XK_Return) || (keysym == XK_Escape) || + (keysym == XK_KP_Space) || (keysym == XK_KP_Tab) || + (keysym == XK_KP_Enter) || + ((keysym >= XK_KP_Multiply) && (keysym <= XK_KP_9)) || + (keysym == XK_KP_Equal) || (keysym == XK_Delete)))))) + return 0; + + if (keysym == XK_KP_Space) + c = (XK_space & 0x7F); + else if (hbytes == 0xFF) + c = (keysym & 0x7F); + else + c = (keysym & 0xFF); + + if (modifiers & ECORE_X_MODIFIER_CTRL) + { + if (((c >= '@') && (c < '\177')) || c == ' ') + c &= 0x1F; + else if (c == '2') + c = '\000'; + else if ((c >= '3') && (c <= '7')) + c -= ('3' - '\033'); + else if (c == '8') + c = '\177'; + else if (c == '/') + c = '_' & 0x1F; + } + buffer[0] = c; + return 1; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_mwm.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_mwm.c new file mode 100644 index 0000000..6c95331 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_mwm.c @@ -0,0 +1,104 @@ +#include "ecore_xcb_private.h" +//#include "Ecore_X_Atoms.h" + +#define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0) +#define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1) +#define ECORE_X_MWM_HINTS_INPUT_MODE (1 << 2) +#define ECORE_X_MWM_HINTS_STATUS (1 << 3) + +typedef struct _mwmhints +{ + uint32_t flags; + uint32_t functions; + uint32_t decorations; + int32_t inputmode; + uint32_t status; +} MWMHints; + +/** + * @defgroup Ecore_X_MWM_Group MWM related functions. + * + * Functions related to MWM. + */ + +/** + * Sets the borderless flag of a window using MWM. + * + * @param win The window. + * @param borderless The borderless flag. + * + * @ingroup Ecore_X_MWM_Group + */ +EAPI void +ecore_x_mwm_borderless_set(Ecore_X_Window win, + Eina_Bool borderless) +{ + uint32_t data[5] = { 0, 0, 0, 0, 0 }; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + data[0] = 2; + data[2] = !borderless; + + ecore_x_window_prop_property_set(win, + ECORE_X_ATOM_MOTIF_WM_HINTS, + ECORE_X_ATOM_MOTIF_WM_HINTS, 32, + (void *)data, 5); +} + +EAPI Eina_Bool +ecore_x_mwm_hints_get(Ecore_X_Window win, + Ecore_X_MWM_Hint_Func *fhint, + Ecore_X_MWM_Hint_Decor *dhint, + Ecore_X_MWM_Hint_Input *ihint) +{ + xcb_get_property_cookie_t cookie; + xcb_get_property_reply_t *reply; + MWMHints *mwmhints = NULL; + int ret = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = + xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, + ECORE_X_ATOM_MOTIF_WM_HINTS, + ECORE_X_ATOM_MOTIF_WM_HINTS, 0, UINT_MAX); + reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + if ((reply->format != 32) || (reply->value_len == 0)) + { + free(reply); + return EINA_FALSE; + } + + mwmhints = xcb_get_property_value(reply); + if (reply->value_len >= 4) + { + if (dhint) + { + if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS) + *dhint = mwmhints->decorations; + else + *dhint = ECORE_X_MWM_HINT_DECOR_ALL; + } + if (fhint) + { + if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS) + *fhint = mwmhints->functions; + else + *fhint = ECORE_X_MWM_HINT_FUNC_ALL; + } + if (ihint) + { + if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE) + *ihint = mwmhints->inputmode; + else + *ihint = ECORE_X_MWM_HINT_INPUT_MODELESS; + } + ret = EINA_TRUE; + } + free(reply); + return ret; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c new file mode 100644 index 0000000..0a523b9 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c @@ -0,0 +1,1525 @@ +#include "ecore_xcb_private.h" + +/* local function prototypes */ +/* static void _ecore_xcb_netwm_startup_info_free(void *data); */ +static Ecore_X_Atom _ecore_xcb_netwm_window_type_atom_get(Ecore_X_Window_Type type); +static Ecore_X_Window_Type _ecore_xcb_netwm_window_type_type_get(Ecore_X_Atom atom); +static Ecore_X_Atom _ecore_xcb_netwm_window_state_atom_get(Ecore_X_Window_State state); +static Ecore_X_Atom _ecore_xcb_netwm_action_atom_get(Ecore_X_Action action); + +/* local variables */ +//static Eina_Hash *_startup_info = NULL; + +/* local structures */ +typedef struct _Ecore_Xcb_Startup_Info Ecore_Xcb_Startup_Info; +struct _Ecore_Xcb_Startup_Info +{ + Ecore_X_Window win; + int init, size; + char *buffer; + int length; + + /* sequence info fields */ + char *id, *name; + int screen; + char *bin, *icon; + int desktop, timestamp; + char *description, *wmclass; + int silent; +}; + +EAPI void +ecore_x_netwm_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +// _startup_info = +// eina_hash_string_superfast_new(_ecore_xcb_netwm_startup_info_free); +} + +EAPI void +ecore_x_netwm_shutdown(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +// if (_startup_info) eina_hash_free(_startup_info); +// _startup_info = NULL; +} + +EAPI Eina_Bool +ecore_x_netwm_pid_get(Ecore_X_Window win, + int *pid) +{ + uint32_t tmp; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_PID, &tmp, 1)) + return EINA_FALSE; + + if (pid) *pid = tmp; + + return EINA_TRUE; +} + +EAPI void +ecore_x_netwm_pid_set(Ecore_X_Window win, + int pid) +{ + unsigned int tmp; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + tmp = pid; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_PID, &tmp, 1); +} + +EAPI Eina_Bool +ecore_x_netwm_window_type_get(Ecore_X_Window win, + Ecore_X_Window_Type *type) +{ + Ecore_X_Atom *atoms; + int num = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (type) *type = ECORE_X_WINDOW_TYPE_NORMAL; + + num = + ecore_x_window_prop_atom_list_get(win, + ECORE_X_ATOM_NET_WM_WINDOW_TYPE, &atoms); + if ((type) && (num >= 1) && (atoms)) + *type = _ecore_xcb_netwm_window_type_type_get(atoms[0]); + + if (atoms) free(atoms); + + if (num >= 1) return EINA_TRUE; + return EINA_FALSE; +} + +EAPI void +ecore_x_netwm_window_type_set(Ecore_X_Window win, + Ecore_X_Window_Type type) +{ + Ecore_X_Atom atom; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + atom = _ecore_xcb_netwm_window_type_atom_get(type); + ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, &atom, 1); +} + +EAPI int +ecore_x_netwm_window_types_get(Ecore_X_Window win, + Ecore_X_Window_Type **types) +{ + int num = 0, i = 0; + Ecore_X_Atom *atoms = NULL; + Ecore_X_Window_Type *atoms2 = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (types) *types = NULL; + num = + ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, + &atoms); + if ((num <= 0) || (!atoms)) + { + if (atoms) free(atoms); + return 0; + } + + atoms2 = malloc(num * sizeof(Ecore_X_Window_Type)); + if (!atoms2) + { + if (atoms) free(atoms); + return 0; + } + + for (i = 0; i < num; i++) + atoms2[i] = _ecore_xcb_netwm_window_type_type_get(atoms[i]); + if (atoms) free(atoms); + + if (types) + *types = atoms2; + else + free(atoms2); + + return num; +} + +EAPI int +ecore_x_netwm_name_get(Ecore_X_Window win, + char **name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (name) + *name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_WM_NAME); + return 1; +} + +EAPI void +ecore_x_netwm_name_set(Ecore_X_Window win, + const char *name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_NAME, name); +} + +EAPI void +ecore_x_netwm_opacity_set(Ecore_X_Window win, + unsigned int opacity) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, + &opacity, 1); +} + +EAPI Eina_Bool +ecore_x_netwm_opacity_get(Ecore_X_Window win, + unsigned int *opacity) +{ + unsigned int tmp = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, + &tmp, 1)) + return EINA_FALSE; + + if (opacity) *opacity = tmp; + + return EINA_TRUE; +} + +EAPI void +ecore_x_netwm_wm_identify(Ecore_X_Window root, + Ecore_X_Window check, + const char *wm_name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, + &check, 1); + ecore_x_window_prop_window_set(check, ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, + &check, 1); + ecore_x_window_prop_string_set(check, ECORE_X_ATOM_NET_WM_NAME, wm_name); + ecore_x_window_prop_string_set(root, ECORE_X_ATOM_NET_WM_NAME, wm_name); +} + +EAPI void +ecore_x_netwm_supported_set(Ecore_X_Window root, + Ecore_X_Atom *supported, + int num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_atom_set(root, ECORE_X_ATOM_NET_SUPPORTED, + supported, num); +} + +EAPI Eina_Bool +ecore_x_netwm_supported_get(Ecore_X_Window root, + Ecore_X_Atom **supported, + int *num) +{ + int num_ret = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (num) *num = 0; + if (supported) *supported = NULL; + + num_ret = + ecore_x_window_prop_atom_list_get(root, ECORE_X_ATOM_NET_SUPPORTED, + supported); + if (num_ret <= 0) return EINA_FALSE; + if (num) *num = num_ret; + + return EINA_TRUE; +} + +EAPI void +ecore_x_netwm_desk_count_set(Ecore_X_Window root, + unsigned int n_desks) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS, + &n_desks, 1); +} + +EAPI void +ecore_x_netwm_desk_roots_set(Ecore_X_Window root, + Ecore_X_Window *vroots, + unsigned int n_desks) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_VIRTUAL_ROOTS, + vroots, n_desks); +} + +EAPI void +ecore_x_netwm_desk_names_set(Ecore_X_Window root, + const char **names, + unsigned int n_desks) +{ + char ss[32], *buf = NULL, *t = NULL; + const char *s; + uint32_t len = 0, i, l; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + for (i = 0; i < n_desks; i++) + { + s = ((names) ? names[i] : NULL); + if (!s) + { + /* Default to "Desk-" */ + sprintf(ss, "Desk-%d", i); + s = ss; + } + + l = strlen(s) + 1; + t = realloc(buf, len + 1); + if (t) + { + buf = t; + memcpy(buf + len, s, l); + } + len += l; + } + + xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, root, + ECORE_X_ATOM_NET_DESKTOP_NAMES, + ECORE_X_ATOM_UTF8_STRING, 8, len, (const void *)buf); +// ecore_x_flush(); + free(buf); +} + +EAPI void +ecore_x_netwm_desk_size_set(Ecore_X_Window root, + unsigned int width, + unsigned int height) +{ + uint32_t size[2]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + size[0] = width; + size[1] = height; + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_GEOMETRY, + size, 2); +} + +EAPI void +ecore_x_netwm_desk_viewports_set(Ecore_X_Window root, + unsigned int *origins, + unsigned int n_desks) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_VIEWPORT, + origins, (2 * n_desks)); +} + +EAPI void +ecore_x_netwm_desk_layout_set(Ecore_X_Window root, + int orientation, + int columns, + int rows, + int starting_corner) +{ + unsigned int layout[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + layout[0] = orientation; + layout[1] = columns; + layout[2] = rows; + layout[3] = starting_corner; + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_LAYOUT, + layout, 4); +} + +EAPI void +ecore_x_netwm_desk_workareas_set(Ecore_X_Window root, + unsigned int *areas, + unsigned int n_desks) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_WORKAREA, areas, + 4 * n_desks); +} + +EAPI unsigned int * +ecore_x_netwm_desk_workareas_get(Ecore_X_Window root, unsigned int *n_desks) +{ + int ret; + unsigned int *areas = NULL; + + if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + ret = ecore_x_window_prop_card32_list_get(root, ECORE_X_ATOM_NET_WORKAREA, + &areas); + if (!areas) + { + if (n_desks) *n_desks = 0; + return 0; + } + if (n_desks) *n_desks = ret / 4; + return areas; +} + +EAPI void +ecore_x_netwm_desk_current_set(Ecore_X_Window root, + unsigned int desk) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_CURRENT_DESKTOP, + &desk, 1); +} + +EAPI void +ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, + Eina_Bool on) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + val = ((on) ? 1 : 0); + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_SHOWING_DESKTOP, + &val, 1); +} + +EAPI int +ecore_x_netwm_startup_id_get(Ecore_X_Window win, + char **id) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (id) + { + *id = + ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_STARTUP_ID); + } + + return 1; +} + +EAPI void +ecore_x_netwm_startup_id_set(Ecore_X_Window win, + const char *id) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_STARTUP_ID, id); +} + +EAPI void +ecore_x_netwm_state_request_send(Ecore_X_Window win, + Ecore_X_Window root, + Ecore_X_Window_State s1, + Ecore_X_Window_State s2, + Eina_Bool set) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) return; + if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = ECORE_X_ATOM_NET_WM_STATE; + ev.data.data32[0] = !!set; + ev.data.data32[1] = _ecore_xcb_netwm_window_state_atom_get(s1); + ev.data.data32[2] = _ecore_xcb_netwm_window_state_atom_get(s2); + /* 1 == normal client, if used in a pager this should be 2 */ + ev.data.data32[3] = 1; + ev.data.data32[4] = 0; + + xcb_send_event(_ecore_xcb_conn, 0, root, + (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev); +// ecore_x_flush(); +} + +EAPI void +ecore_x_netwm_window_state_set(Ecore_X_Window win, + Ecore_X_Window_State *state, + unsigned int num) +{ + Ecore_X_Atom *set; + unsigned int i = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!num) + { + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_NET_WM_STATE); + return; + } + + set = malloc(num * sizeof(Ecore_X_Atom)); + if (!set) return; + + for (i = 0; i < num; i++) + set[i] = _ecore_xcb_netwm_window_state_atom_get(state[i]); + + ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_STATE, set, num); + free(set); +} + +EAPI Eina_Bool +ecore_x_netwm_window_state_get(Ecore_X_Window win, + Ecore_X_Window_State **state, + unsigned int *num) +{ + Ecore_X_Atom *atoms; + int ret = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (num) *num = 0; + if (state) *state = NULL; + + ret = + ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_STATE, &atoms); + + if (ret <= 0) return EINA_FALSE; + + if (state) + { + *state = malloc(ret * sizeof(Ecore_X_Window_State)); + if (*state) + { + int i = 0; + + for (i = 0; i < ret; i++) + (*state)[i] = _ecore_xcb_netwm_window_state_get(atoms[i]); + if (num) *num = ret; + } + } + + free(atoms); + + return EINA_TRUE; +} + +EAPI void +ecore_x_netwm_client_active_set(Ecore_X_Window root, + Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_window_set(root, + ECORE_X_ATOM_NET_ACTIVE_WINDOW, &win, 1); +} + +EAPI void +ecore_x_netwm_client_active_request(Ecore_X_Window root, + Ecore_X_Window win, + int type, + Ecore_X_Window current_win) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = ECORE_X_ATOM_NET_ACTIVE_WINDOW; + ev.data.data32[0] = type; + ev.data.data32[1] = XCB_CURRENT_TIME; + ev.data.data32[2] = current_win; + ev.data.data32[3] = 0; + ev.data.data32[4] = 0; + + xcb_send_event(_ecore_xcb_conn, 0, root, + (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev); +// ecore_x_flush(); +} + +EAPI void +ecore_x_netwm_client_list_set(Ecore_X_Window root, + Ecore_X_Window *p_clients, + unsigned int n_clients) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST, + p_clients, n_clients); +} + +EAPI void +ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root, + Ecore_X_Window *p_clients, + unsigned int n_clients) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST_STACKING, + p_clients, n_clients); +} + +EAPI Eina_Bool +ecore_x_screen_is_composited(int screen) +{ + char buff[32]; + xcb_get_selection_owner_cookie_t ocookie; + xcb_get_selection_owner_reply_t *oreply; + Ecore_X_Window win; + static Ecore_X_Atom atom = XCB_NONE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + snprintf(buff, sizeof(buff), "_NET_WM_CM_S%i", screen); + + if (atom == XCB_NONE) + { + xcb_intern_atom_cookie_t acookie; + xcb_intern_atom_reply_t *areply; + + acookie = + xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(buff), buff); + areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL); + if (!areply) return EINA_FALSE; + atom = areply->atom; + free(areply); + } + if (atom == XCB_NONE) return EINA_FALSE; + + ocookie = xcb_get_selection_owner_unchecked(_ecore_xcb_conn, atom); + oreply = xcb_get_selection_owner_reply(_ecore_xcb_conn, ocookie, NULL); + if (!oreply) return EINA_FALSE; + win = oreply->owner; + free(oreply); + + return (win != XCB_NONE) ? EINA_TRUE : EINA_FALSE; +} + +EAPI void +ecore_x_screen_is_composited_set(int screen, + Ecore_X_Window win) +{ + static Ecore_X_Atom atom = XCB_NONE; + char buff[32]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + snprintf(buff, sizeof(buff), "_NET_WM_CM_S%i", screen); + if (atom == XCB_NONE) + { + xcb_intern_atom_cookie_t acookie; + xcb_intern_atom_reply_t *areply; + + acookie = + xcb_intern_atom_unchecked(_ecore_xcb_conn, 0, strlen(buff), buff); + areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL); + if (!areply) return; + atom = areply->atom; + free(areply); + } + if (atom == XCB_NONE) return; + xcb_set_selection_owner(_ecore_xcb_conn, win, atom, + _ecore_xcb_events_last_time_get()); +} + +EAPI void +ecore_x_netwm_ping_send(Ecore_X_Window win) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) return; + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = ECORE_X_ATOM_WM_PROTOCOLS; + ev.data.data32[0] = ECORE_X_ATOM_NET_WM_PING; + ev.data.data32[1] = ecore_x_current_time_get(); + ev.data.data32[2] = win; + ev.data.data32[3] = 0; + ev.data.data32[4] = 0; + + xcb_send_event(_ecore_xcb_conn, 0, win, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); +} + +EAPI void +ecore_x_netwm_frame_size_set(Ecore_X_Window win, + int fl, + int fr, + int ft, + int fb) +{ + uint32_t frames[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + frames[0] = fl; + frames[1] = fr; + frames[2] = ft; + frames[3] = fb; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_FRAME_EXTENTS, + frames, 4); +} + +EAPI Eina_Bool +ecore_x_netwm_frame_size_get(Ecore_X_Window win, + int *fl, + int *fr, + int *ft, + int *fb) +{ + int ret = 0; + unsigned int frames[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_FRAME_EXTENTS, + frames, 4); + if (ret != 4) return EINA_FALSE; + + if (fl) *fl = frames[0]; + if (fr) *fr = frames[1]; + if (ft) *ft = frames[2]; + if (fb) *fb = frames[3]; + + return EINA_TRUE; +} + +EAPI void +ecore_x_netwm_sync_request_send(Ecore_X_Window win, + unsigned int serial) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) return; + + /* FIXME: Maybe need XSyncIntToValue ?? */ + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = ECORE_X_ATOM_WM_PROTOCOLS; + ev.data.data32[0] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST; + ev.data.data32[1] = _ecore_xcb_events_last_time_get(); + ev.data.data32[2] = serial; + ev.data.data32[3] = 0; + ev.data.data32[4] = 0; + + xcb_send_event(_ecore_xcb_conn, 0, win, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); +} + +EAPI void +ecore_x_netwm_desktop_set(Ecore_X_Window win, + unsigned int desk) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_DESKTOP, &desk, 1); +} + +EAPI Eina_Bool +ecore_x_netwm_desktop_get(Ecore_X_Window win, + unsigned int *desk) +{ + unsigned int tmp = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_DESKTOP, + &tmp, 1)) + return EINA_FALSE; + + if (desk) *desk = tmp; + + return EINA_TRUE; +} + +EAPI void +ecore_x_netwm_desktop_request_send(Ecore_X_Window win, + Ecore_X_Window root, + unsigned int desktop) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!root) root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = ECORE_X_ATOM_NET_WM_DESKTOP; + ev.data.data32[0] = desktop; + + xcb_send_event(_ecore_xcb_conn, 0, root, + (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY), (const char *)&ev); +// ecore_x_flush(); +} + +EAPI void +ecore_x_netwm_handled_icons_set(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS, + NULL, 0); +} + +EAPI Eina_Bool +ecore_x_netwm_handled_icons_get(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS, + NULL, 0)) + return EINA_FALSE; + + return EINA_TRUE; +} + +EAPI int +ecore_x_netwm_icon_name_get(Ecore_X_Window win, + char **name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (name) + { + *name = + ecore_x_window_prop_string_get(win, ECORE_X_ATOM_NET_WM_ICON_NAME); + } + + return 1; +} + +EAPI void +ecore_x_netwm_icon_name_set(Ecore_X_Window win, + const char *name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, name); +} + +EAPI Eina_Bool +ecore_x_netwm_icons_get(Ecore_X_Window win, + Ecore_X_Icon **icon, + int *num) +{ + int num_ret = 0; + unsigned int i = 0, len = 0, icons = 0; + unsigned int *data, *p, *src; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (num) *num = 0; + if (icon) *icon = NULL; + + num_ret = + ecore_x_window_prop_card32_list_get(win, ECORE_X_ATOM_NET_WM_ICON, &data); + + if ((num_ret <= 0) || (!data)) + { + if (data) free(data); + return EINA_FALSE; + } + if (num_ret < 2) + { + if (data) free(data); + return EINA_FALSE; + } + + icons = 0; + p = data; + while (p) + { + len = (p[0] * p[1]); + p += (len + 2); + if ((p - data) > num_ret) + { + if (data) free(data); + return EINA_FALSE; + } + icons++; + if ((p - data) == num_ret) p = NULL; + } + if (num) *num = icons; + if (!icon) + { + if (data) free(data); + return EINA_TRUE; + } + + *icon = malloc(icons * sizeof(Ecore_X_Icon)); + if (!(*icon)) + { + if (data) free(data); + return EINA_FALSE; + } + + /* Fetch the icons */ + p = data; + for (i = 0; i < icons; i++) + { + unsigned int *ps, *pd, *pe; + + len = p[0] * p[1]; + ((*icon)[i]).width = p[0]; + ((*icon)[i]).height = p[1]; + src = &(p[2]); + ((*icon)[i]).data = malloc(len * sizeof(unsigned int)); + if (!((*icon)[i]).data) + { + while (i) + free(((*icon)[--i]).data); + free(*icon); + free(data); + return EINA_FALSE; + } + + pd = ((*icon)[i]).data; + ps = src; + pe = ps + len; + for (; ps < pe; ps++) + { + unsigned int r, g, b, a; + + a = (*ps >> 24) & 0xff; + r = (((*ps >> 16) & 0xff) * a) / 255; + g = (((*ps >> 8) & 0xff) * a) / 255; + b = (((*ps) & 0xff) * a) / 255; + *pd = (a << 24) | (r << 16) | (g << 8) | (b); + pd++; + } + p += (len + 2); + } + + if (data) free(data); + return EINA_TRUE; +} + +EAPI void +ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + geom[0] = x; + geom[1] = y; + geom[2] = w; + geom[3] = h; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, + geom, 4); +} + +EAPI Eina_Bool +ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *w, + int *h) +{ + int ret = 0; + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ret = + ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, + geom, 4); + if (ret != 4) return EINA_FALSE; + if (x) *x = geom[0]; + if (y) *y = geom[1]; + if (w) *w = geom[2]; + if (h) *h = geom[3]; + + return EINA_TRUE; +} + +EAPI void +ecore_x_netwm_strut_set(Ecore_X_Window win, + int l, + int r, + int t, + int b) +{ + unsigned int strut[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + strut[0] = l; + strut[1] = r; + strut[2] = t; + strut[3] = b; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4); +} + +EAPI Eina_Bool +ecore_x_netwm_strut_get(Ecore_X_Window win, + int *l, + int *r, + int *t, + int *b) +{ + unsigned int strut[4]; + int ret = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ret = + ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4); + if (ret != 4) return EINA_FALSE; + + if (l) *l = strut[0]; + if (r) *r = strut[1]; + if (t) *t = strut[2]; + if (b) *b = strut[3]; + + return EINA_TRUE; +} + +EAPI void +ecore_x_netwm_strut_partial_set(Ecore_X_Window win, + int left, + int right, + int top, + int bottom, + int left_start_y, + int left_end_y, + int right_start_y, + int right_end_y, + int top_start_x, + int top_end_x, + int bottom_start_x, + int bottom_end_x) +{ + unsigned int strut[12]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + strut[0] = left; + strut[1] = right; + strut[2] = top; + strut[3] = bottom; + strut[4] = left_start_y; + strut[5] = left_end_y; + strut[6] = right_start_y; + strut[7] = right_end_y; + strut[8] = top_start_x; + strut[9] = top_end_x; + strut[10] = bottom_start_x; + strut[11] = bottom_end_x; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, + strut, 12); +} + +EAPI Eina_Bool +ecore_x_netwm_strut_partial_get(Ecore_X_Window win, + int *left, + int *right, + int *top, + int *bottom, + int *left_start_y, + int *left_end_y, + int *right_start_y, + int *right_end_y, + int *top_start_x, + int *top_end_x, + int *bottom_start_x, + int *bottom_end_x) +{ + unsigned int strut[12]; + int ret = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ret = + ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, + strut, 12); + if (ret != 12) return EINA_FALSE; + + if (left) *left = strut[0]; + if (right) *right = strut[1]; + if (top) *top = strut[2]; + if (bottom) *bottom = strut[3]; + if (left_start_y) *left_start_y = strut[4]; + if (left_end_y) *left_end_y = strut[5]; + if (right_start_y) *right_start_y = strut[6]; + if (right_end_y) *right_end_y = strut[7]; + if (top_start_x) *top_start_x = strut[8]; + if (top_end_x) *top_end_x = strut[9]; + if (bottom_start_x) *bottom_start_x = strut[10]; + if (bottom_end_x) *bottom_end_x = strut[11]; + + return EINA_TRUE; +} + +EAPI void +ecore_x_netwm_user_time_set(Ecore_X_Window win, + unsigned int t) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_USER_TIME, &t, 1); +} + +EAPI Eina_Bool +ecore_x_netwm_user_time_get(Ecore_X_Window win, + unsigned int *t) +{ + unsigned int tmp; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_USER_TIME, + &tmp, 1)) + return EINA_FALSE; + + if (t) *t = tmp; + + return EINA_TRUE; +} + +EAPI void +ecore_x_netwm_visible_name_set(Ecore_X_Window win, + const char *name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME, + name); +} + +EAPI int +ecore_x_netwm_visible_name_get(Ecore_X_Window win, + char **name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (name) + *name = ecore_x_window_prop_string_get(win, + ECORE_X_ATOM_NET_WM_VISIBLE_NAME); + return 1; +} + +EAPI void +ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, + const char *name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME, + name); +} + +EAPI int +ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win, + char **name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (name) + { + *name = + ecore_x_window_prop_string_get(win, + ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME); + } + + return 1; +} + +EAPI Eina_Bool +ecore_x_netwm_sync_counter_get(Ecore_X_Window win, + Ecore_X_Sync_Counter *counter) +{ + unsigned int tmp; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER, + &tmp, 1)) + return EINA_FALSE; + + if (counter) *counter = tmp; + + return EINA_TRUE; +} + +EAPI Eina_Bool +ecore_x_netwm_allowed_action_isset(Ecore_X_Window win, + Ecore_X_Action action) +{ + int num = 0, i = 0; + Ecore_X_Atom *atoms, atom; + Eina_Bool ret = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + num = + ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, + &atoms); + if (num <= 0) return EINA_FALSE; + + atom = _ecore_xcb_netwm_action_atom_get(action); + for (i = 0; i < num; i++) + { + if (atoms[i] == atom) + { + ret = EINA_TRUE; + break; + } + } + + if (atoms) free(atoms); + return ret; +} + +EAPI Eina_Bool +ecore_x_netwm_allowed_action_get(Ecore_X_Window win, + Ecore_X_Action **action, + unsigned int *num) +{ + Ecore_X_Atom *atoms; + int num_ret = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (num) *num = 0; + if (action) *action = NULL; + + num_ret = + ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, + &atoms); + if (num_ret <= 0) return EINA_FALSE; + if (action) + { + *action = malloc(num_ret * sizeof(Ecore_X_Action)); + if (*action) + { + int i = 0; + + for (i = 0; i < num_ret; i++) + (*action)[i] = _ecore_xcb_netwm_action_atom_get(atoms[i]); + } + if (num) *num = num_ret; + } + free(atoms); + return EINA_TRUE; +} + +EAPI void +ecore_x_netwm_allowed_action_set(Ecore_X_Window win, + Ecore_X_Action *action, + unsigned int num) +{ + Ecore_X_Atom *set; + unsigned int i = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!num) + { + ecore_x_window_prop_property_del(win, + ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS); + return; + } + + set = malloc(num * sizeof(Ecore_X_Atom)); + if (!set) return; + + for (i = 0; i < num; i++) + set[i] = _ecore_xcb_netwm_action_atom_get(action[i]); + + ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, + set, num); + free(set); +} + +/* local functions */ +int +_ecore_xcb_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__, + uint8_t data __UNUSED__) +{ + // TODO: TBD + return 1; +} + +int +_ecore_xcb_netwm_startup_info(Ecore_X_Window win __UNUSED__, + uint8_t data __UNUSED__) +{ + // TODO: TBD + return 1; +} + +/* static void */ +/* _ecore_xcb_netwm_startup_info_free(void *data) */ +/* { */ +/* Ecore_Xcb_Startup_Info *info; */ + +/* LOGFN(__FILE__, __LINE__, __FUNCTION__); */ + +/* if (!(info = data)) return; */ +/* if (info->buffer) free(info->buffer); */ +/* if (info->id) free(info->id); */ +/* if (info->name) free(info->name); */ +/* if (info->bin) free(info->bin); */ +/* if (info->icon) free(info->icon); */ +/* if (info->description) free(info->description); */ +/* if (info->wmclass) free(info->wmclass); */ +/* free(info); */ +/* } */ + +static Ecore_X_Atom +_ecore_xcb_netwm_window_type_atom_get(Ecore_X_Window_Type type) +{ + switch (type) + { + case ECORE_X_WINDOW_TYPE_DESKTOP: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP; + + case ECORE_X_WINDOW_TYPE_DOCK: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK; + + case ECORE_X_WINDOW_TYPE_TOOLBAR: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR; + + case ECORE_X_WINDOW_TYPE_MENU: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU; + + case ECORE_X_WINDOW_TYPE_UTILITY: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY; + + case ECORE_X_WINDOW_TYPE_SPLASH: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH; + + case ECORE_X_WINDOW_TYPE_DIALOG: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG; + + case ECORE_X_WINDOW_TYPE_NORMAL: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL; + + case ECORE_X_WINDOW_TYPE_DROPDOWN_MENU: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU; + + case ECORE_X_WINDOW_TYPE_POPUP_MENU: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU; + + case ECORE_X_WINDOW_TYPE_TOOLTIP: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP; + + case ECORE_X_WINDOW_TYPE_NOTIFICATION: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION; + + case ECORE_X_WINDOW_TYPE_COMBO: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO; + + case ECORE_X_WINDOW_TYPE_DND: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND; + + default: + return 0; + } +} + +static Ecore_X_Window_Type +_ecore_xcb_netwm_window_type_type_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP) + return ECORE_X_WINDOW_TYPE_DESKTOP; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK) + return ECORE_X_WINDOW_TYPE_DOCK; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR) + return ECORE_X_WINDOW_TYPE_TOOLBAR; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU) + return ECORE_X_WINDOW_TYPE_MENU; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY) + return ECORE_X_WINDOW_TYPE_UTILITY; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH) + return ECORE_X_WINDOW_TYPE_SPLASH; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG) + return ECORE_X_WINDOW_TYPE_DIALOG; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL) + return ECORE_X_WINDOW_TYPE_NORMAL; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU) + return ECORE_X_WINDOW_TYPE_DROPDOWN_MENU; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU) + return ECORE_X_WINDOW_TYPE_POPUP_MENU; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP) + return ECORE_X_WINDOW_TYPE_TOOLTIP; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION) + return ECORE_X_WINDOW_TYPE_NOTIFICATION; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO) + return ECORE_X_WINDOW_TYPE_COMBO; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND) + return ECORE_X_WINDOW_TYPE_DND; + else + return ECORE_X_WINDOW_TYPE_UNKNOWN; +} + +static Ecore_X_Atom +_ecore_xcb_netwm_window_state_atom_get(Ecore_X_Window_State state) +{ + switch (state) + { + case ECORE_X_WINDOW_STATE_MODAL: + return ECORE_X_ATOM_NET_WM_STATE_MODAL; + + case ECORE_X_WINDOW_STATE_STICKY: + return ECORE_X_ATOM_NET_WM_STATE_STICKY; + + case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT: + return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT; + + case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ: + return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ; + + case ECORE_X_WINDOW_STATE_SHADED: + return ECORE_X_ATOM_NET_WM_STATE_SHADED; + + case ECORE_X_WINDOW_STATE_SKIP_TASKBAR: + return ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR; + + case ECORE_X_WINDOW_STATE_SKIP_PAGER: + return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER; + + case ECORE_X_WINDOW_STATE_HIDDEN: + return ECORE_X_ATOM_NET_WM_STATE_HIDDEN; + + case ECORE_X_WINDOW_STATE_FULLSCREEN: + return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN; + + case ECORE_X_WINDOW_STATE_ABOVE: + return ECORE_X_ATOM_NET_WM_STATE_ABOVE; + + case ECORE_X_WINDOW_STATE_BELOW: + return ECORE_X_ATOM_NET_WM_STATE_BELOW; + + case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION: + return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION; + + default: + return 0; + } +} + +Ecore_X_Window_State +_ecore_xcb_netwm_window_state_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_NET_WM_STATE_MODAL) + return ECORE_X_WINDOW_STATE_MODAL; + else if (atom == ECORE_X_ATOM_NET_WM_STATE_STICKY) + return ECORE_X_WINDOW_STATE_STICKY; + else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT) + return ECORE_X_WINDOW_STATE_MAXIMIZED_VERT; + else if (atom == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ) + return ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ; + else if (atom == ECORE_X_ATOM_NET_WM_STATE_SHADED) + return ECORE_X_WINDOW_STATE_SHADED; + else if (atom == ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR) + return ECORE_X_WINDOW_STATE_SKIP_TASKBAR; + else if (atom == ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER) + return ECORE_X_WINDOW_STATE_SKIP_PAGER; + else if (atom == ECORE_X_ATOM_NET_WM_STATE_HIDDEN) + return ECORE_X_WINDOW_STATE_HIDDEN; + else if (atom == ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN) + return ECORE_X_WINDOW_STATE_FULLSCREEN; + else if (atom == ECORE_X_ATOM_NET_WM_STATE_ABOVE) + return ECORE_X_WINDOW_STATE_ABOVE; + else if (atom == ECORE_X_ATOM_NET_WM_STATE_BELOW) + return ECORE_X_WINDOW_STATE_BELOW; + else if (atom == ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION) + return ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION; + else + return ECORE_X_WINDOW_STATE_UNKNOWN; +} + +static Ecore_X_Atom +_ecore_xcb_netwm_action_atom_get(Ecore_X_Action action) +{ + switch (action) + { + case ECORE_X_ACTION_MOVE: + return ECORE_X_ATOM_NET_WM_ACTION_MOVE; + + case ECORE_X_ACTION_RESIZE: + return ECORE_X_ATOM_NET_WM_ACTION_RESIZE; + + case ECORE_X_ACTION_MINIMIZE: + return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE; + + case ECORE_X_ACTION_SHADE: + return ECORE_X_ATOM_NET_WM_ACTION_SHADE; + + case ECORE_X_ACTION_STICK: + return ECORE_X_ATOM_NET_WM_ACTION_STICK; + + case ECORE_X_ACTION_MAXIMIZE_HORZ: + return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ; + + case ECORE_X_ACTION_MAXIMIZE_VERT: + return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT; + + case ECORE_X_ACTION_FULLSCREEN: + return ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN; + + case ECORE_X_ACTION_CHANGE_DESKTOP: + return ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP; + + case ECORE_X_ACTION_CLOSE: + return ECORE_X_ATOM_NET_WM_ACTION_CLOSE; + + case ECORE_X_ACTION_ABOVE: + return ECORE_X_ATOM_NET_WM_ACTION_ABOVE; + + case ECORE_X_ACTION_BELOW: + return ECORE_X_ATOM_NET_WM_ACTION_BELOW; + + default: + return 0; + } +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_pixmap.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_pixmap.c new file mode 100644 index 0000000..f9bf525 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_pixmap.c @@ -0,0 +1,128 @@ +#include "ecore_xcb_private.h" + +/** + * @defgroup Ecore_X_Pixmap_Group X Pixmap Functions + * + * Functions that operate on pixmaps. + */ + +/** + * Creates a new pixmap. + * @param win Window used to determine which screen of the display the + * pixmap should be created on. If 0, the default root window + * is used. + * @param w Width of the new pixmap. + * @param h Height of the new pixmap. + * @param dep Depth of the pixmap. If 0, the default depth of the default + * screen is used. + * @return New pixmap. + * @ingroup Ecore_X_Pixmap_Group + */ +EAPI Ecore_X_Pixmap +ecore_x_pixmap_new(Ecore_X_Window win, + int w, + int h, + int dep) +{ + Ecore_X_Pixmap pmap; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (win == 0) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; + if (dep == 0) dep = ((xcb_screen_t *)_ecore_xcb_screen)->root_depth; + + pmap = xcb_generate_id(_ecore_xcb_conn); + xcb_create_pixmap(_ecore_xcb_conn, dep, pmap, win, w, h); + +// ecore_x_flush(); + return pmap; +} + +/** + * Deletes the reference to the given pixmap. + * + * If no other clients have a reference to the given pixmap, the server + * will destroy it. + * + * @param pmap The given pixmap. + * @ingroup Ecore_X_Pixmap_Group + */ +EAPI void +ecore_x_pixmap_free(Ecore_X_Pixmap pmap) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_free_pixmap(_ecore_xcb_conn, pmap); +// ecore_x_flush(); +} + +/** + * Pastes a rectangular area of the given pixmap onto the given drawable. + * @param pmap The given pixmap. + * @param dest The given drawable. + * @param gc The graphics context which governs which operation will + * be used to paste the area onto the drawable. + * @param sx The X position of the area on the pixmap. + * @param sy The Y position of the area on the pixmap. + * @param w The width of the area. + * @param h The height of the area. + * @param dx The X position at which to paste the area on @p dest. + * @param dy The Y position at which to paste the area on @p dest. + * @ingroup Ecore_X_Pixmap_Group + */ +EAPI void +ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, + Ecore_X_Drawable dest, + Ecore_X_GC gc, + int sx, + int sy, + int w, + int h, + int dx, + int dy) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_copy_area(_ecore_xcb_conn, pmap, dest, gc, sx, sy, dx, dy, w, h); +// ecore_x_flush(); +} + +/** + * Retrieves the size of the given pixmap. + * @param pmap The given pixmap. + * @param x Pointer to an integer in which to store the X position. + * @param y Pointer to an integer in which to store the Y position. + * @param w Pointer to an integer in which to store the width. + * @param h Pointer to an integer in which to store the height. + * @ingroup Ecore_X_Pixmap_Group + */ +EAPI void +ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, + int *x, + int *y, + int *w, + int *h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (pmap) + ecore_x_drawable_geometry_get(pmap, x, y, w, h); +} + +/** + * Retrieves the depth of the given pixmap. + * @param pmap The given pixmap. + * @return The depth of the pixmap. + * @ingroup Ecore_X_Pixmap_Group + */ +EAPI int +ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return ecore_x_drawable_depth_get(pmap); +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_private.h b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_private.h new file mode 100644 index 0000000..cf8f3e5 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_private.h @@ -0,0 +1,451 @@ +#ifndef __ECORE_XCB_PRIVATE_H__ +# define __ECORE_XCB_PRIVATE_H__ + +//# define LOGFNS 1 + +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif + +# include // included for close & gethostname functions + +/* generic xcb includes */ +# include +# include +# include +# include + +/* EFL includes */ +# include "Ecore.h" +# include "Ecore_Input.h" +# include "Ecore_X.h" + +/* logging */ +extern int _ecore_xcb_log_dom; + +# ifdef ECORE_XCB_DEFAULT_LOG_COLOR +# undef ECORE_XCB_DEFAULT_LOG_COLOR +# endif +# define ECORE_XCB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + +# ifdef ERR +# undef ERR +# endif +# define ERR(...) EINA_LOG_DOM_ERR(_ecore_xcb_log_dom, __VA_ARGS__) + +# ifdef DBG +# undef DBG +# endif +# define DBG(...) EINA_LOG_DOM_DBG(_ecore_xcb_log_dom, __VA_ARGS__) + +# ifdef INF +# undef INF +# endif +# define INF(...) EINA_LOG_DOM_INFO(_ecore_xcb_log_dom, __VA_ARGS__) + +# ifdef WRN +# undef WRN +# endif +# define WRN(...) EINA_LOG_DOM_WARN(_ecore_xcb_log_dom, __VA_ARGS__) + +# ifdef CRIT +# undef CRIT +# endif +# define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_xcb_log_dom, __VA_ARGS__) + +# ifdef LOGFNS +# include +# define LOGFN(fl, ln, fn) printf("-ECORE-XCB: %25s: %5i - %s\n", fl, ln, fn); +# else +# define LOGFN(fl, ln, fn) +# endif + +# ifndef MAXHOSTNAMELEN +# define MAXHOSTNAMELEN 256 +# endif + +# ifndef MIN +# define MIN(x, y) (((x) > (y)) ? (y) : (x)) +# endif + +# ifndef MAX +# define MAX(a, b) ((a < b) ? b : a) +# endif + +#define CHECK_XCB_CONN \ + { \ + if (xcb_connection_has_error(_ecore_xcb_conn)) \ + { \ + DBG("XCB Connection Has Error !!"); \ + _ecore_xcb_io_error_handle(NULL); \ + } \ + } + +/* enums */ +typedef enum _Ecore_Xcb_Encoding_Style Ecore_Xcb_Encoding_Style; + +enum _Ecore_Xcb_Encoding_Style +{ + XcbStringStyle, + XcbCompoundTextStyle, + XcbTextStyle, + XcbStdICCTextStyle, + XcbUTF8StringStyle +}; + +/* structures */ +typedef struct _Ecore_X_DND_Source Ecore_X_DND_Source; +typedef struct _Ecore_X_DND_Target Ecore_X_DND_Target; +typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern; +typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter; +typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser; +typedef struct _Ecore_Xcb_Textproperty Ecore_Xcb_Textproperty; + +struct _Ecore_X_DND_Source +{ + int version; + Ecore_X_Window win, dest; + + enum + { + ECORE_X_DND_SOURCE_IDLE, + ECORE_X_DND_SOURCE_DRAGGING, + ECORE_X_DND_SOURCE_DROPPED, + ECORE_X_DND_SOURCE_CONVERTING + } state; + + struct + { + short x, y; + unsigned short width, height; + } rectangle; + + struct + { + Ecore_X_Window window; + int x, y; + } prev; + + Ecore_X_Time time; + + Ecore_X_Atom action, accepted_action; + + int will_accept, suppress; + int await_status; +}; + +struct _Ecore_X_DND_Target +{ + int version; + Ecore_X_Window win, source; + + enum + { + ECORE_X_DND_TARGET_IDLE, + ECORE_X_DND_TARGET_ENTERED + } state; + + struct + { + int x, y; + } pos; + + Ecore_X_Time time; + + Ecore_X_Atom action, accepted_action; + int will_accept; +}; + +struct _Ecore_X_Selection_Intern +{ + Ecore_X_Window win; + Ecore_X_Atom selection; + unsigned char *data; + int length; + Ecore_X_Time time; +}; + +struct _Ecore_X_Selection_Converter +{ + Ecore_X_Atom target; + Eina_Bool (*convert)(char *target, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *type, + int *size_type); + Ecore_X_Selection_Converter *next; +}; + +struct _Ecore_X_Selection_Parser +{ + char *target; + void *(*parse)(const char *target, void *data, int size, int format); + Ecore_X_Selection_Parser *next; +}; + +struct _Ecore_Xcb_Textproperty +{ + char *value; + Ecore_X_Atom encoding; + unsigned int format, nitems; +}; + +/* external variables */ +extern Ecore_X_Connection *_ecore_xcb_conn; +extern Ecore_X_Screen *_ecore_xcb_screen; +extern double _ecore_xcb_double_click_time; +extern int16_t _ecore_xcb_event_last_root_x; +extern int16_t _ecore_xcb_event_last_root_y; + +/* external variables for extension events */ +extern int _ecore_xcb_event_damage; +extern int _ecore_xcb_event_randr; +extern int _ecore_xcb_event_screensaver; +extern int _ecore_xcb_event_shape; +extern int _ecore_xcb_event_sync; +extern int _ecore_xcb_event_xfixes; +extern int _ecore_xcb_event_input; +extern int _ecore_xcb_event_gesture; + +extern int ECORE_X_MODIFIER_SHIFT; +extern int ECORE_X_MODIFIER_CTRL; +extern int ECORE_X_MODIFIER_ALT; +extern int ECORE_X_MODIFIER_WIN; +extern int ECORE_X_LOCK_SCROLL; +extern int ECORE_X_LOCK_NUM; +extern int ECORE_X_LOCK_CAPS; +extern int ECORE_X_LOCK_SHIFT; + +extern Ecore_X_Atom _ecore_xcb_atoms_wm_protocol[ECORE_X_WM_PROTOCOL_NUM]; + +extern int _ecore_xcb_button_grabs_num; +extern int _ecore_xcb_key_grabs_num; +extern Ecore_X_Window *_ecore_xcb_button_grabs; +extern Ecore_X_Window *_ecore_xcb_key_grabs; +extern Eina_Bool (*_ecore_xcb_window_grab_replay_func)(void *data, + int type, + void *event); +extern void *_ecore_xcb_window_grab_replay_data; + +/* private function prototypes */ +void _ecore_xcb_error_handler_init(void); +void _ecore_xcb_error_handler_shutdown(void); + +void _ecore_xcb_atoms_init(void); +void _ecore_xcb_atoms_finalize(void); + +void _ecore_xcb_extensions_init(void); +void _ecore_xcb_extensions_finalize(void); + +void _ecore_xcb_shape_init(void); +void _ecore_xcb_shape_finalize(void); + +void _ecore_xcb_screensaver_init(void); +void _ecore_xcb_screensaver_finalize(void); + +void _ecore_xcb_sync_init(void); +void _ecore_xcb_sync_finalize(void); +void _ecore_xcb_sync_magic_send(int val, + Ecore_X_Window win); + +void _ecore_xcb_render_init(void); +void _ecore_xcb_render_finalize(void); +Eina_Bool _ecore_xcb_render_argb_get(void); +Eina_Bool _ecore_xcb_render_anim_get(void); +Eina_Bool _ecore_xcb_render_avail_get(void); + +Eina_Bool _ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual); +uint32_t _ecore_xcb_render_find_visual_id(int type, + Eina_Bool check_alpha); +Ecore_X_Visual *_ecore_xcb_render_visual_get(int visual_id); + +void _ecore_xcb_randr_init(void); +void _ecore_xcb_randr_finalize(void); + +void _ecore_xcb_gesture_init(void); +void _ecore_xcb_gesture_finalize(void); +void _ecore_xcb_gesture_shutdown(void); + +void _ecore_xcb_xfixes_init(void); +void _ecore_xcb_xfixes_finalize(void); +Eina_Bool _ecore_xcb_xfixes_avail_get(void); + +void _ecore_xcb_damage_init(void); +void _ecore_xcb_damage_finalize(void); + +void _ecore_xcb_composite_init(void); +void _ecore_xcb_composite_finalize(void); + +void _ecore_xcb_dpms_init(void); +void _ecore_xcb_dpms_finalize(void); + +void _ecore_xcb_cursor_init(void); +void _ecore_xcb_cursor_finalize(void); + +void _ecore_xcb_xinerama_init(void); +void _ecore_xcb_xinerama_finalize(void); + +void _ecore_xcb_dnd_init(void); +void _ecore_xcb_dnd_shutdown(void); +Ecore_X_DND_Source *_ecore_xcb_dnd_source_get(void); +Ecore_X_DND_Target *_ecore_xcb_dnd_target_get(void); +void _ecore_xcb_dnd_drag(Ecore_X_Window root, + int x, + int y); + +void _ecore_xcb_selection_init(void); +void _ecore_xcb_selection_shutdown(void); +void *_ecore_xcb_selection_parse(const char *target, + void *data, + int size, + int format); +char *_ecore_xcb_selection_target_get(Ecore_X_Atom target); +Ecore_X_Selection_Intern *_ecore_xcb_selection_get(Ecore_X_Atom selection); + +# ifdef HAVE_ICONV +Eina_Bool _ecore_xcb_utf8_textlist_to_textproperty(char **list, + int count, + Ecore_Xcb_Encoding_Style style, + Ecore_Xcb_Textproperty *ret); +# endif +Eina_Bool _ecore_xcb_mb_textlist_to_textproperty(char **list, + int count, + Ecore_Xcb_Encoding_Style style, + Ecore_Xcb_Textproperty *ret); +Eina_Bool _ecore_xcb_textlist_to_textproperty(const char *type, + char **list, + int count, + Ecore_Xcb_Encoding_Style style, + Ecore_Xcb_Textproperty *ret); + +# ifdef HAVE_ICONV +Eina_Bool _ecore_xcb_utf8_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, + char ***list_ret, + int *count_ret); +# endif +Eina_Bool _ecore_xcb_mb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, + char ***list_ret, + int *count_ret); +Eina_Bool _ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, + const char *type, + char ***list_ret, + int *count_ret); + +void _ecore_xcb_events_init(void); +void _ecore_xcb_events_shutdown(void); +void _ecore_xcb_events_handle(xcb_generic_event_t *ev); +Ecore_X_Time _ecore_xcb_events_last_time_get(void); +unsigned int _ecore_xcb_events_modifiers_get(unsigned int state); +void _ecore_xcb_event_mouse_move(uint16_t timestamp, + uint16_t modifiers, + int16_t x, + int16_t y, + int16_t root_x, + int16_t root_y, + xcb_window_t event_win, + xcb_window_t win, + xcb_window_t root_win, + uint8_t same_screen, + int dev, + double radx, + double rady, + double pressure, + double angle, + int16_t mx, + int16_t my, + int16_t mrx, + int16_t mry); +Ecore_Event_Mouse_Button *_ecore_xcb_event_mouse_button(int event, + uint16_t timestamp, + uint16_t modifiers, + xcb_button_t buttons, + int16_t x, + int16_t y, + int16_t root_x, + int16_t root_y, + xcb_window_t event_win, + xcb_window_t win, + xcb_window_t root_win, + uint8_t same_screen, + int dev, + double radx, + double rady, + double pressure, + double angle, + int16_t mx, + int16_t my, + int16_t mrx, + int16_t mry); + +void _ecore_xcb_keymap_init(void); +void _ecore_xcb_keymap_finalize(void); +void _ecore_xcb_keymap_shutdown(void); +void _ecore_xcb_keymap_refresh(xcb_mapping_notify_event_t *event); +xcb_keysym_t _ecore_xcb_keymap_keycode_to_keysym(xcb_keycode_t keycode, + int col); +xcb_keycode_t *_ecore_xcb_keymap_keysym_to_keycode(xcb_keysym_t keysym); +char *_ecore_xcb_keymap_keysym_to_string(xcb_keysym_t keysym); +xcb_keycode_t _ecore_xcb_keymap_string_to_keycode(const char *key); +int _ecore_xcb_keymap_lookup_string(xcb_keycode_t keycode, + int state, + char *buffer, + int bytes, + xcb_keysym_t *sym); + +void _ecore_xcb_input_init(void); +void _ecore_xcb_input_finalize(void); +void _ecore_xcb_input_shutdown(void); +# ifdef ECORE_XCB_XINPUT +void _ecore_xcb_input_handle_event(xcb_generic_event_t *event); +# else +void _ecore_xcb_input_handle_event(xcb_generic_event_t *event __UNUSED__); +# endif + +void _ecore_xcb_dri_init(void); +void _ecore_xcb_dri_finalize(void); + +void _ecore_xcb_xtest_init(void); +void _ecore_xcb_xtest_finalize(void); + +Ecore_X_Window _ecore_xcb_window_root_of_screen_get(int screen); +void _ecore_xcb_window_prop_string_utf8_set(Ecore_X_Window win, + Ecore_X_Atom atom, + const char *str); +Ecore_X_Visual _ecore_xcb_window_visual_get(Ecore_X_Window win); +void _ecore_xcb_window_button_grab_remove(Ecore_X_Window win); +void _ecore_xcb_window_key_grab_remove(Ecore_X_Window win); +void _ecore_xcb_window_grab_allow_events(Ecore_X_Window event_win, + Ecore_X_Window child_win, + int type, + void *event, + Ecore_X_Time timestamp); + +int _ecore_xcb_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__, + uint8_t data __UNUSED__); +int _ecore_xcb_netwm_startup_info(Ecore_X_Window win __UNUSED__, + uint8_t data __UNUSED__); +Ecore_X_Window_State _ecore_xcb_netwm_window_state_get(Ecore_X_Atom atom); + +int _ecore_xcb_error_handle(xcb_generic_error_t *err); +int _ecore_xcb_io_error_handle(xcb_generic_error_t *err); + +xcb_image_t *_ecore_xcb_image_create_native(int w, + int h, + xcb_image_format_t format, + uint8_t depth, + void *base, + uint32_t bytes, + uint8_t *data); + +void _ecore_xcb_xdefaults_init(void); +void _ecore_xcb_xdefaults_shutdown(void); +char *_ecore_xcb_xdefaults_string_get(const char *prog, + const char *param); +int _ecore_xcb_xdefaults_int_get(const char *prog, + const char *param); + +void _ecore_xcb_modifiers_get(void); + +#endif diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_randr.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_randr.c new file mode 100644 index 0000000..510da49 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_randr.c @@ -0,0 +1,3474 @@ +/* TODO: List of missing functions + * + * ecore_x_randr_crtc_clone_set + * ecore_x_randr_output_size_mm_get + * ecore_x_randr_output_crtc_set + * ecore_x_randr_edid_version_get + * ecore_x_randr_edid_info_has_valid_checksum + * ecore_x_randr_edid_manufacturer_name_get + * ecore_x_randr_edid_display_ascii_get + * ecore_x_randr_edid_display_serial_get + * ecore_x_randr_edid_model_get + * ecore_x_randr_edid_manufacturer_serial_number_get + * ecore_x_randr_edid_manufacturer_model_get + * ecore_x_randr_edid_dpms_available_get + * ecore_x_randr_edid_dpms_standby_available_get + * ecore_x_randr_edid_dpms_suspend_available_get + * ecore_x_randr_edid_dpms_off_available_get + * ecore_x_randr_edid_display_aspect_ratio_preferred_get + * ecore_x_randr_edid_display_aspect_ratios_get + * ecore_x_randr_edid_display_colorscheme_get + * ecore_x_randr_edid_display_type_digital_get + * ecore_x_randr_edid_display_interface_type_get + * ecore_x_randr_screen_backlight_level_set + * ecore_x_randr_output_subpixel_order_get + * ecore_x_randr_output_wired_clones_get + * ecore_x_randr_output_compatibility_list_get + * ecore_x_randr_output_signal_formats_get + * ecore_x_randr_output_signal_format_set + * ecore_x_randr_output_signal_properties_get + * ecore_x_randr_output_connector_number_get + * ecore_x_randr_output_connector_type_get + * ecore_x_randr_crtc_panning_area_get + * ecore_x_randr_crtc_panning_area_set + * ecore_x_randr_crtc_tracking_area_get + * ecore_x_randr_crtc_tracking_area_set + * ecore_x_randr_crtc_border_area_get + * ecore_x_randr_crtc_border_area_set + */ + +#include "ecore_xcb_private.h" +# ifdef ECORE_XCB_RANDR +# include +# endif + +#define Ecore_X_Randr_None 0 +#define Ecore_X_Randr_Unset -1 + +#define RANDR_1_1 ((1 << 16) | 1) +#define RANDR_1_2 ((1 << 16) | 2) +#define RANDR_1_3 ((1 << 16) | 3) + +#define RANDR_CHECK_1_1_RET(ret) if (_randr_version < RANDR_1_1) return ret +#define RANDR_CHECK_1_2_RET(ret) if (_randr_version < RANDR_1_2) return ret +#define RANDR_CHECK_1_3_RET(ret) if (_randr_version < RANDR_1_3) return ret + +#define ECORE_X_RANDR_EDID_VERSION_13 ((1 << 8) | 3) +#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR 0x12 +#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR 0x13 +#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK 0x36 +#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE 3 +#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT 5 +#define _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX 13 + +#define _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \ + for (block = edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK; block <= (edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK + (3 * 18)); block += 18) + +#define _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) \ + _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \ + if ((block[0] == 0) && (block[1] == 0)) + +/* local function prototypes */ +static Eina_Bool _ecore_xcb_randr_output_validate(Ecore_X_Window root, + Ecore_X_Randr_Output output); +static Eina_Bool _ecore_xcb_randr_crtc_validate(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc); +static Eina_Bool _ecore_xcb_randr_root_validate(Ecore_X_Window root); +static int _ecore_xcb_randr_root_to_screen(Ecore_X_Window root); +static xcb_randr_get_screen_resources_reply_t *_ecore_xcb_randr_12_get_resources(Ecore_X_Window win); +static xcb_randr_get_screen_resources_current_reply_t *_ecore_xcb_randr_13_get_resources(Ecore_X_Window win); +static xcb_timestamp_t _ecore_xcb_randr_12_get_resource_timestamp(Ecore_X_Window win); +static xcb_timestamp_t _ecore_xcb_randr_13_get_resource_timestamp(Ecore_X_Window win); + +static Ecore_X_Randr_Mode *_ecore_xcb_randr_12_output_modes_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num, + int *npreferred); +static Ecore_X_Randr_Mode *_ecore_xcb_randr_13_output_modes_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num, + int *npreferred); +static Ecore_X_Randr_Mode_Info *_ecore_xcb_randr_12_mode_info_get(Ecore_X_Window root, + Ecore_X_Randr_Mode mode); +static Ecore_X_Randr_Mode_Info *_ecore_xcb_randr_13_mode_info_get(Ecore_X_Window root, + Ecore_X_Randr_Mode mode); +static Ecore_X_Randr_Mode_Info **_ecore_xcb_randr_12_modes_info_get(Ecore_X_Window root, + int *num); +static Ecore_X_Randr_Mode_Info **_ecore_xcb_randr_13_modes_info_get(Ecore_X_Window root, + int *num); +static void _ecore_xcb_randr_12_mode_size_get(Ecore_X_Window root, + Ecore_X_Randr_Mode mode, + int *w, + int *h); +static void _ecore_xcb_randr_13_mode_size_get(Ecore_X_Window root, + Ecore_X_Randr_Mode mode, + int *w, + int *h); +static Ecore_X_Randr_Output *_ecore_xcb_randr_12_output_clones_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num); +static Ecore_X_Randr_Output *_ecore_xcb_randr_13_output_clones_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num); +static Ecore_X_Randr_Crtc *_ecore_xcb_randr_12_output_possible_crtcs_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num); +static Ecore_X_Randr_Crtc *_ecore_xcb_randr_13_output_possible_crtcs_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num); +static char *_ecore_xcb_randr_12_output_name_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *len); +static char *_ecore_xcb_randr_13_output_name_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *len); +static Ecore_X_Randr_Connection_Status _ecore_xcb_randr_12_output_connection_status_get(Ecore_X_Window root, + Ecore_X_Randr_Output output); +static Ecore_X_Randr_Connection_Status _ecore_xcb_randr_13_output_connection_status_get(Ecore_X_Window root, + Ecore_X_Randr_Output output); +static Ecore_X_Randr_Output *_ecore_xcb_randr_12_outputs_get(Ecore_X_Window root, + int *num); +static Ecore_X_Randr_Output *_ecore_xcb_randr_13_outputs_get(Ecore_X_Window root, + int *num); +static Ecore_X_Randr_Crtc _ecore_xcb_randr_12_output_crtc_get(Ecore_X_Window root, + Ecore_X_Randr_Output output); +static Ecore_X_Randr_Crtc _ecore_xcb_randr_13_output_crtc_get(Ecore_X_Window root, + Ecore_X_Randr_Output output); + +/* local variables */ +static Eina_Bool _randr_avail = EINA_FALSE; +static int _randr_version = -1; + +/* external variables */ +int _ecore_xcb_event_randr = -1; + +void +_ecore_xcb_randr_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_RANDR + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_randr_id); +#endif +} + +void +_ecore_xcb_randr_finalize(void) +{ +#ifdef ECORE_XCB_RANDR + const xcb_query_extension_reply_t *ext_reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_RANDR + ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_randr_id); + if ((ext_reply) && (ext_reply->present)) + { + xcb_randr_query_version_cookie_t cookie; + xcb_randr_query_version_reply_t *reply; + + cookie = + xcb_randr_query_version_unchecked(_ecore_xcb_conn, + XCB_RANDR_MAJOR_VERSION, + XCB_RANDR_MINOR_VERSION); + reply = xcb_randr_query_version_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + if ((reply->major_version >= XCB_RANDR_MAJOR_VERSION) && + (reply->minor_version >= XCB_RANDR_MINOR_VERSION)) + _randr_avail = EINA_TRUE; + + _randr_version = + ((reply->major_version << 16) | reply->minor_version); + + free(reply); + } + + if (_randr_avail) + _ecore_xcb_event_randr = ext_reply->first_event; + } +#endif +} + +static Eina_Bool +_ecore_xcb_randr_root_validate(Ecore_X_Window root) +{ +#ifdef ECORE_XCB_RANDR + Ecore_X_Randr_Screen scr = -1; +# define RANDR_VALIDATE_ROOT(screen, root) \ + ((screen == _ecore_xcb_randr_root_to_screen(root)) != -1) +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_RANDR + if ((root) && RANDR_VALIDATE_ROOT(scr, root)) + return EINA_TRUE; +#endif + + return EINA_FALSE; +} + +static int +_ecore_xcb_randr_root_to_screen(Ecore_X_Window root) +{ + int count = 0, num = 0; + + CHECK_XCB_CONN; + + count = xcb_setup_roots_length(xcb_get_setup(_ecore_xcb_conn)); + for (num = 0; num < count; num++) + if (_ecore_xcb_window_root_of_screen_get(num) == root) + return num; + + return -1; +} + +/* public functions */ + +/* + * @brief query whether randr is available or not + * @return EINA_TRUE, if extension is available, else EINA_FALSE + */ +EAPI Eina_Bool +ecore_x_randr_query(void) +{ + return _randr_avail; +} + +/* + * @return version of the RandRR extension supported by the server or, + * in case RandRR extension is not available, Ecore_X_Randr_Unset (=-1). + * bit version information: 31 MAJOR 16 | 15 MINOR 0 + */ +EAPI int +ecore_x_randr_version_get(void) +{ + return _randr_version; +} + +/* + * @param root window which's primary output will be queried + */ +EAPI Ecore_X_Randr_Orientation +ecore_x_randr_screen_primary_output_orientations_get(Ecore_X_Window root) +{ + int ret = Ecore_X_Randr_None; +#ifdef ECORE_XCB_RANDR + xcb_randr_get_screen_info_cookie_t cookie; + xcb_randr_get_screen_info_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); + reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + ret = reply->rotations; + free(reply); + } +#endif + + return ret; +} + +/* + * @param root window which's primary output will be queried + * @return the current orientation of the root window's screen primary output + */ +EAPI Ecore_X_Randr_Orientation +ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root) +{ + int ret = Ecore_X_Randr_None; +#ifdef ECORE_XCB_RANDR + xcb_randr_get_screen_info_cookie_t cookie; + xcb_randr_get_screen_info_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); + reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + ret = reply->rotation; + free(reply); + } +#endif + + return ret; +} + +/* + * @brief sets a given screen's primary output's orientation + * @param root window which's screen's primary output will be queried + * @param orientation orientation which should be set for the root window's screen primary output + * @return EINA_TRUE if the primary output's orientation could be successfully altered + */ +EAPI Eina_Bool +ecore_x_randr_screen_primary_output_orientation_set(Ecore_X_Window root, + Ecore_X_Randr_Orientation orientation) +{ + int ret = EINA_FALSE; +#ifdef ECORE_XCB_RANDR + xcb_randr_get_screen_info_cookie_t cookie; + xcb_randr_get_screen_info_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); + reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + xcb_randr_set_screen_config_cookie_t scookie; + xcb_randr_set_screen_config_reply_t *sreply; + + scookie = + xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root, + XCB_CURRENT_TIME, + reply->config_timestamp, + reply->sizeID, orientation, + reply->rate); + sreply = + xcb_randr_set_screen_config_reply(_ecore_xcb_conn, scookie, NULL); + if (!sreply) + ret = EINA_FALSE; + else + { + ret = (sreply->status == XCB_RANDR_SET_CONFIG_SUCCESS) ? + EINA_TRUE : EINA_FALSE; + free(sreply); + } + free(reply); + } +#endif + + return ret; +} + +/* + * @brief gets a screen's primary output's possible sizes + * @param root window which's primary output will be queried + * @param num number of sizes reported as supported by the screen's primary output + * @return an array of sizes reported as supported by the screen's primary output or - if query failed - NULL + */ +EAPI Ecore_X_Randr_Screen_Size_MM * +ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root, + int *num) +{ +#ifdef ECORE_XCB_RANDR + xcb_randr_get_screen_info_cookie_t cookie; + xcb_randr_get_screen_info_reply_t *reply; + Ecore_X_Randr_Screen_Size_MM *ret = NULL; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); + reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + int len = 0, i = 0; + xcb_randr_screen_size_t *sizes; + + len = xcb_randr_get_screen_info_sizes_length(reply); + sizes = xcb_randr_get_screen_info_sizes(reply); + if ((!sizes) || (len <= 0)) + { + free(reply); + return NULL; + } + if (num) *num = len; + ret = calloc(len, sizeof(Ecore_X_Randr_Screen_Size_MM)); + if (!ret) + { + free(reply); + return NULL; + } + for (i = 0; i < len; i++) + { + ret[i].width = sizes[i].width; + ret[i].height = sizes[i].height; + ret[i].width_mm = sizes[i].mwidth; + ret[i].height_mm = sizes[i].mheight; + } + + free(reply); + } + + return ret; +#else + return NULL; +#endif +} + +/* + * @brief get the current set size of a given screen's primary output + * @param root window which's primary output will be queried + * @param w the current size's width + * @param h the current size's height + * @param w_mm the current size's width in mm + * @param h_mm the current size's height in mm + * @param size_index of current set size to be used with ecore_x_randr_primary_output_size_set() + */ +EAPI void +ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root, + int *w, + int *h, + int *w_mm, + int *h_mm, + int *size_index) +{ +#ifdef ECORE_XCB_RANDR + xcb_randr_get_screen_info_cookie_t cookie; + xcb_randr_get_screen_info_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); + reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + int len = 0, idx = 0; + xcb_randr_screen_size_t *sizes; + + len = xcb_randr_get_screen_info_sizes_length(reply); + sizes = xcb_randr_get_screen_info_sizes(reply); + if ((!sizes) || (len <= 0)) + { + free(reply); + return; + } + idx = reply->sizeID; + if ((idx < len) && (idx >= 0)) + { + if (w) *w = sizes[idx].width; + if (h) *h = sizes[idx].height; + if (w_mm) *w_mm = sizes[idx].mwidth; + if (h_mm) *h_mm = sizes[idx].mheight; + if (size_index) *size_index = idx; + } + + free(reply); + } +#endif +} + +/* + * @brief sets a given screen's primary output size, but disables all other outputs at the same time + * @param root window which's primary output will be queried + * @param size_index within the list of sizes reported as supported by the root window's screen primary output + * @return EINA_TRUE on success, EINA_FALSE on failure due to e.g. invalid times + */ +EAPI Eina_Bool +ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root, + int size_index) +{ + Eina_Bool ret = EINA_FALSE; +#ifdef ECORE_XCB_RANDR + xcb_randr_get_screen_info_cookie_t cookie; + xcb_randr_get_screen_info_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + if (!((size_index >= 0) && (_ecore_xcb_randr_root_validate(root)))) + return EINA_FALSE; + + cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); + reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + int len = 0; + + len = xcb_randr_get_screen_info_sizes_length(reply); + if (len <= 0) + { + free(reply); + return EINA_FALSE; + } + if ((size_index < len) && (size_index >= 0)) + { + xcb_randr_set_screen_config_cookie_t scookie; + xcb_randr_set_screen_config_reply_t *sreply; + + scookie = + xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root, + XCB_CURRENT_TIME, + reply->config_timestamp, + size_index, + reply->rotation, + reply->rate); + sreply = + xcb_randr_set_screen_config_reply(_ecore_xcb_conn, + scookie, NULL); + if (!sreply) + ret = EINA_FALSE; + else + { + ret = (sreply->status == XCB_RANDR_SET_CONFIG_SUCCESS) ? + EINA_TRUE : EINA_FALSE; + free(sreply); + } + } + + free(reply); + } +#endif + return ret; +} + +/* + * @param root window which's primary output will be queried + * @return currently used refresh rate or - if request failed or RandRR is not available - 0.0 + */ +EAPI Ecore_X_Randr_Refresh_Rate +ecore_x_randr_screen_primary_output_current_refresh_rate_get(Ecore_X_Window root) +{ +#ifdef ECORE_XCB_RANDR + xcb_randr_get_screen_info_cookie_t cookie; + xcb_randr_get_screen_info_reply_t *reply; + Ecore_X_Randr_Refresh_Rate ret = 0.0; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + if (!_ecore_xcb_randr_root_validate(root)) return ret; + + cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); + reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + ret = reply->rate; + free(reply); + } + + return ret; +#else + return 0.0; +#endif +} + +/* + * @param root window which's primary output will be queried + * @param size_index referencing the size to query valid refresh rates for + * @return currently used refresh rate or - if request failed or RandRR is not available - NULL + */ +EAPI Ecore_X_Randr_Refresh_Rate * +ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root, + int size_index, + int *num) +{ +#ifdef ECORE_XCB_RANDR + xcb_randr_get_screen_info_cookie_t cookie; + xcb_randr_get_screen_info_reply_t *reply; + Ecore_X_Randr_Refresh_Rate *ret = NULL; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + if (!_ecore_xcb_randr_root_validate(root)) return ret; + + cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); + reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + int len = 0; + + len = xcb_randr_get_screen_info_rates_length(reply); + if (num) *num = len; + + ret = malloc(sizeof(Ecore_X_Randr_Refresh_Rate) * len); + if (ret) + { + xcb_randr_refresh_rates_iterator_t iter; + int i = 0; + + iter = xcb_randr_get_screen_info_rates_iterator(reply); + while (i++ < size_index) + xcb_randr_refresh_rates_next(&iter); + + memcpy(ret, xcb_randr_refresh_rates_rates(iter.data), + sizeof(Ecore_X_Randr_Refresh_Rate) * len); + } + free(reply); + } + + return ret; +#else + return NULL; +#endif +} + +/* + * @brief sets the current primary output's refresh rate + * @param root window which's primary output will be queried + * @param size_index referencing the size to be set + * @param rate the refresh rate to be set + * @return EINA_TRUE on success else EINA_FALSE + */ +EAPI Eina_Bool +ecore_x_randr_screen_primary_output_refresh_rate_set(Ecore_X_Window root, + int size_index, + Ecore_X_Randr_Refresh_Rate rate) +{ + Eina_Bool ret = EINA_FALSE; +#ifdef ECORE_XCB_RANDR + xcb_randr_get_screen_info_cookie_t cookie; + xcb_randr_get_screen_info_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + if (_randr_version < RANDR_1_1) return EINA_FALSE; + + cookie = xcb_randr_get_screen_info_unchecked(_ecore_xcb_conn, root); + reply = xcb_randr_get_screen_info_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + xcb_randr_set_screen_config_cookie_t scookie; + xcb_randr_set_screen_config_reply_t *sreply; + + scookie = + xcb_randr_set_screen_config_unchecked(_ecore_xcb_conn, root, + XCB_CURRENT_TIME, + reply->config_timestamp, + size_index, + reply->rotation, rate); + sreply = + xcb_randr_set_screen_config_reply(_ecore_xcb_conn, + scookie, NULL); + if (!sreply) + ret = EINA_FALSE; + else + { + ret = (sreply->status == XCB_RANDR_SET_CONFIG_SUCCESS) ? + EINA_TRUE : EINA_FALSE; + free(sreply); + } + free(reply); + } +#endif + + return ret; +} + +/* + * @brief free detailed mode information. The pointer handed in will be set to + * NULL after freeing the memory. + * @param mode_info the mode information that should be freed + */ +EAPI void +ecore_x_randr_mode_info_free(Ecore_X_Randr_Mode_Info *mode_info) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + RANDR_CHECK_1_2_RET(); + + if (!mode_info) return; + + if (mode_info->name) free(mode_info->name); + free(mode_info); + mode_info = NULL; +} + +/* + * @param root window which's screen should be queried + * @return Ecore_X_Randr_Ouptut_Id or - if query failed or none is set - Ecore_X_Randr_None + */ +EAPI Ecore_X_Randr_Output +ecore_x_randr_primary_output_get(Ecore_X_Window root) +{ + Ecore_X_Randr_Output ret = Ecore_X_Randr_None; +#ifdef ECORE_XCB_RANDR + xcb_randr_get_output_primary_cookie_t cookie; + xcb_randr_get_output_primary_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_3_RET(Ecore_X_Randr_None); + + if (!_ecore_xcb_randr_root_validate(root)) + return Ecore_X_Randr_None; + + cookie = xcb_randr_get_output_primary_unchecked(_ecore_xcb_conn, root); + reply = xcb_randr_get_output_primary_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + ret = reply->output; + free(reply); + } +#endif + return ret; +} + +/* + * @param root window which's screen should be queried + * @param output that should be set as given root window's screen primary output + */ +EAPI void +ecore_x_randr_primary_output_set(Ecore_X_Window root, + Ecore_X_Randr_Output output) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_3_RET(); + + if ((output) && (_ecore_xcb_randr_root_validate(root))) + xcb_randr_set_output_primary(_ecore_xcb_conn, root, output); +#endif +} + +EAPI Ecore_X_Randr_Mode * +ecore_x_randr_output_modes_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num, + int *npreferred) +{ + Ecore_X_Randr_Mode *modes = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(NULL); + + if (_randr_version >= RANDR_1_3) + { + modes = + _ecore_xcb_randr_13_output_modes_get(root, output, num, npreferred); + } + else if (_randr_version == RANDR_1_2) + { + modes = + _ecore_xcb_randr_12_output_modes_get(root, output, num, npreferred); + } +#endif + + return modes; +} + +/* + * @brief get detailed information for a given mode id + * @param root window which's screen's ressources are queried + * @param mode the XID which identifies the mode of interest + * @return mode's detailed information + */ +EAPI Ecore_X_Randr_Mode_Info * +ecore_x_randr_mode_info_get(Ecore_X_Window root, + Ecore_X_Randr_Mode mode) +{ + Ecore_X_Randr_Mode_Info *ret = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(NULL); + + if (!_ecore_xcb_randr_root_validate(root)) return NULL; + + if (_randr_version >= RANDR_1_3) + ret = _ecore_xcb_randr_13_mode_info_get(root, mode); + else if (_randr_version == RANDR_1_2) + ret = _ecore_xcb_randr_12_mode_info_get(root, mode); +#endif + return ret; +} + +/* + * @brief get detailed information for all modes related to a root window's screen + * @param root window which's screen's ressources are queried + * @param num number of modes returned + * @return modes' information + */ +EAPI Ecore_X_Randr_Mode_Info ** +ecore_x_randr_modes_info_get(Ecore_X_Window root, + int *num) +{ + Ecore_X_Randr_Mode_Info **ret = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (num) *num = 0; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(NULL); + + if (!_ecore_xcb_randr_root_validate(root)) return NULL; + + if (_randr_version >= RANDR_1_3) + ret = _ecore_xcb_randr_13_modes_info_get(root, num); + else if (_randr_version == RANDR_1_2) + ret = _ecore_xcb_randr_12_modes_info_get(root, num); +#endif + return ret; +} + +/** + * @brief gets the width and hight of a given mode + * @param mode the mode which's size is to be looked up + * @param w width of given mode in px + * @param h height of given mode in px + */ +EAPI void +ecore_x_randr_mode_size_get(Ecore_X_Window root, + Ecore_X_Randr_Mode mode, + int *w, + int *h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(); + + if (mode == Ecore_X_Randr_None) return; + + if (_randr_version >= RANDR_1_3) + _ecore_xcb_randr_13_mode_size_get(root, mode, w, h); + else if (_randr_version == RANDR_1_2) + _ecore_xcb_randr_12_mode_size_get(root, mode, w, h); +#endif +} + +/** + * @brief gets the EDID information of an attached output if available. + * Note that this information is not to be compared using ordinary string + * comparison functions, since it includes 0-bytes. + * @param root window this information should be queried from + * @param output the XID of the output + * @param length length of the byte-array. If NULL, request will fail. + */ +EAPI unsigned char * +ecore_x_randr_output_edid_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + unsigned long *length) +{ + unsigned char *ret = NULL; +#ifdef ECORE_XCB_RANDR + xcb_randr_get_output_property_cookie_t cookie; + xcb_randr_get_output_property_reply_t *reply; + Ecore_X_Atom atom; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(NULL); + + if ((!length) || (!_ecore_xcb_randr_output_validate(root, output))) + return NULL; + + atom = ecore_x_atom_get("EDID"); + cookie = + xcb_randr_get_output_property_unchecked(_ecore_xcb_conn, output, atom, + XCB_GET_PROPERTY_TYPE_ANY, + 0, 100, 0, 0); + reply = + xcb_randr_get_output_property_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + if ((reply->type == XCB_ATOM_INTEGER) && (reply->format == 8)) + { + if (length) *length = reply->num_items; + if ((ret = malloc(reply->num_items * sizeof(unsigned char)))) + { + memcpy(ret, xcb_randr_get_output_property_data(reply), + (reply->num_items * sizeof(unsigned char))); + } + } + free(reply); + } +#endif + return ret; +} + +/** + * @brief gets the the outputs which might be used simultenously on the same + * CRTC. + * @param root window that this information should be queried for. + * @param output the output which's clones we concern + * @param num number of possible clones + */ +EAPI Ecore_X_Randr_Output * +ecore_x_randr_output_clones_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num) +{ + Ecore_X_Randr_Output *outputs = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(NULL); + + if (output == Ecore_X_Randr_None) return NULL; + + if (_randr_version >= RANDR_1_3) + outputs = _ecore_xcb_randr_13_output_clones_get(root, output, num); + else if (_randr_version == RANDR_1_2) + outputs = _ecore_xcb_randr_12_output_clones_get(root, output, num); +#endif + return outputs; +} + +EAPI Ecore_X_Randr_Crtc * +ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num) +{ + Ecore_X_Randr_Crtc *crtcs = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(NULL); + + if (output == Ecore_X_Randr_None) return NULL; + + if (_randr_version >= RANDR_1_3) + crtcs = _ecore_xcb_randr_13_output_possible_crtcs_get(root, output, num); + else if (_randr_version == RANDR_1_2) + crtcs = _ecore_xcb_randr_12_output_possible_crtcs_get(root, output, num); +#endif + return crtcs; +} + +/** + * @brief gets the given output's name as reported by X + * @param root the window which's screen will be queried + * @param len length of returned c-string. + * @return name of the output as reported by X + */ +EAPI char * +ecore_x_randr_output_name_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *len) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(NULL); + + if (output == Ecore_X_Randr_None) return NULL; + + if (_randr_version >= RANDR_1_3) + return _ecore_xcb_randr_13_output_name_get(root, output, len); + else if (_randr_version == RANDR_1_2) + return _ecore_xcb_randr_12_output_name_get(root, output, len); +#endif + + return NULL; +} + +EAPI Ecore_X_Randr_Connection_Status +ecore_x_randr_output_connection_status_get(Ecore_X_Window root, + Ecore_X_Randr_Output output) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN); + + if (output == Ecore_X_Randr_None) + return ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN; + + if (_randr_version >= RANDR_1_3) + return _ecore_xcb_randr_13_output_connection_status_get(root, output); + else if (_randr_version == RANDR_1_2) + return _ecore_xcb_randr_12_output_connection_status_get(root, output); +#endif + + return ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN; +} + +EAPI Ecore_X_Randr_Output * +ecore_x_randr_outputs_get(Ecore_X_Window root, + int *num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(NULL); + + if (_randr_version >= RANDR_1_3) + return _ecore_xcb_randr_13_outputs_get(root, num); + else if (_randr_version == RANDR_1_2) + return _ecore_xcb_randr_12_outputs_get(root, num); +#endif + + return NULL; +} + +EAPI Ecore_X_Randr_Crtc +ecore_x_randr_output_crtc_get(Ecore_X_Window root, + Ecore_X_Randr_Output output) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(Ecore_X_Randr_None); + + if (output == Ecore_X_Randr_None) return Ecore_X_Randr_None; + + if (_randr_version >= RANDR_1_3) + return _ecore_xcb_randr_13_output_crtc_get(root, output); + else if (_randr_version == RANDR_1_2) + return _ecore_xcb_randr_12_output_crtc_get(root, output); +#endif + + return Ecore_X_Randr_None; +} + +/** + * @brief sets the demanded parameters for a given CRTC. Note that the CRTC is + * auto enabled in it's preferred mode, when it was disabled before. + * @param root the root window which's default display will be queried + * @param crtc the CRTC which's configuration should be altered + * @param outputs an array of outputs, that should display this CRTC's content. + * @param noutputs number of outputs in the array of outputs. + * If set to Ecore_X_Randr_Unset, current outputs and number of outputs will be used. + * If set to Ecore_X_Randr_None, CRTC will be disabled + * @param x new x coordinate. If <0 (e.g. Ecore_X_Randr_Unset) the current x + * corrdinate will be assumed. + * @param y new y coordinate. If <0 (e.g. Ecore_X_Randr_Unset) the current y + * corrdinate will be assumed. + * @param mode the new mode to be set. If Ecore_X_Randr_None is passed, the + * CRTC will be disabled. If Ecore_X_Randr_Unset is passed, the current mode is assumed. + * @param orientation the new orientation to be set. If Ecore_X_Randr_Unset is used, + * the current mode is assumed. + * @return EINA_TRUE if the configuration alteration was successful, else + * EINA_FALSE + */ +EAPI Eina_Bool +ecore_x_randr_crtc_settings_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + Ecore_X_Randr_Output *outputs, + int num, + int x, + int y, + Ecore_X_Randr_Mode mode, + Ecore_X_Randr_Orientation orientation) +{ + Eina_Bool ret = EINA_FALSE; +#ifdef ECORE_XCB_RANDR + xcb_timestamp_t stamp = 0; + xcb_randr_get_crtc_info_cookie_t ccookie; + xcb_randr_get_crtc_info_reply_t *creply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; + + if (_randr_version >= RANDR_1_3) + stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); + else if (_randr_version == RANDR_1_2) + stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); + + ccookie = + xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp); + creply = + xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ccookie, NULL); + if (creply) + { + xcb_randr_set_crtc_config_cookie_t scookie; + xcb_randr_set_crtc_config_reply_t *sreply; + + if ((mode == Ecore_X_Randr_None) || + (num == Ecore_X_Randr_None)) + { + outputs = NULL; + num = 0; + } + else if (num == (int)Ecore_X_Randr_Unset) + { + outputs = xcb_randr_get_crtc_info_outputs(creply); + num = creply->num_outputs; + } + if ((int)mode == Ecore_X_Randr_Unset) mode = creply->mode; + if (x < 0) x = creply->x; + if (y < 0) y = creply->y; + if ((int)orientation == Ecore_X_Randr_Unset) + orientation = creply->rotation; + + scookie = + xcb_randr_set_crtc_config_unchecked(_ecore_xcb_conn, + crtc, XCB_CURRENT_TIME, stamp, + x, y, mode, orientation, + num, outputs); + sreply = + xcb_randr_set_crtc_config_reply(_ecore_xcb_conn, scookie, NULL); + if (sreply) + { + ret = (sreply->status == XCB_RANDR_SET_CONFIG_SUCCESS) ? + EINA_TRUE : EINA_FALSE; + free(sreply); + } + free(creply); + } +#endif + + return ret; +} + +/** + * @brief sets a mode for a CRTC and the outputs attached to it + * @param root the window's screen to be queried + * @param crtc the CRTC which shall be set + * @param outputs array of outputs which have to be compatible with the mode. If + * NULL CRTC will be disabled. + * @param noutputs number of outputs in array to be used. Use + * Ecore_X_Randr_Unset (or -1) to use currently used outputs. + * @param mode XID of the mode to be set. If set to 0 the CRTC will be disabled. + * If set to -1 the call will fail. + * @return EINA_TRUE if mode setting was successful. Else EINA_FALSE + */ +EAPI Eina_Bool +ecore_x_randr_crtc_mode_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + Ecore_X_Randr_Output *outputs, + int num, + Ecore_X_Randr_Mode mode) +{ + Eina_Bool ret = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + if ((int)mode == Ecore_X_Randr_Unset) return ret; + ret = + ecore_x_randr_crtc_settings_set(root, crtc, outputs, num, + Ecore_X_Randr_Unset, Ecore_X_Randr_Unset, + mode, Ecore_X_Randr_Unset); +#endif + + return ret; +} + +/** + * @brief Get the current set mode of a given CRTC + * @param root the window's screen to be queried + * @param crtc the CRTC which's should be queried + * @return currently set mode or - in case parameters are invalid - + * Ecore_X_Randr_Unset + */ +EAPI Ecore_X_Randr_Mode +ecore_x_randr_crtc_mode_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc) +{ + Ecore_X_Randr_Mode ret = Ecore_X_Randr_Unset; +#ifdef ECORE_XCB_RANDR + xcb_timestamp_t stamp = 0; + xcb_randr_get_crtc_info_cookie_t ocookie; + xcb_randr_get_crtc_info_reply_t *oreply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(Ecore_X_Randr_Unset); + + if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; + + if (_randr_version >= RANDR_1_3) + stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); + else if (_randr_version == RANDR_1_2) + stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); + + ocookie = + xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp); + oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL); + if (oreply) + { + ret = oreply->mode; + free(oreply); + } +#endif + + return ret; +} + +EAPI Ecore_X_Randr_Orientation +ecore_x_randr_crtc_orientation_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc) +{ + Ecore_X_Randr_Orientation ret = Ecore_X_Randr_None; +#ifdef ECORE_XCB_RANDR + xcb_timestamp_t stamp = 0; + xcb_randr_get_crtc_info_cookie_t ocookie; + xcb_randr_get_crtc_info_reply_t *oreply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(Ecore_X_Randr_None); + + if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; + + if (_randr_version >= RANDR_1_3) + stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); + else if (_randr_version == RANDR_1_2) + stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); + + ocookie = + xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp); + oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL); + if (oreply) + { + ret = oreply->rotation; + free(oreply); + } +#endif + + return ret; +} + +EAPI Eina_Bool +ecore_x_randr_crtc_orientation_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + Ecore_X_Randr_Orientation orientation) +{ + Eina_Bool ret = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + if (orientation != Ecore_X_Randr_None) + { + ret = + ecore_x_randr_crtc_settings_set(root, crtc, NULL, + Ecore_X_Randr_Unset, Ecore_X_Randr_Unset, + Ecore_X_Randr_Unset, Ecore_X_Randr_Unset, + orientation); + } +#endif + return ret; +} + +EAPI Ecore_X_Randr_Orientation +ecore_x_randr_crtc_orientations_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc) +{ + Ecore_X_Randr_Orientation ret = Ecore_X_Randr_None; +#ifdef ECORE_XCB_RANDR + xcb_timestamp_t stamp = 0; + xcb_randr_get_crtc_info_cookie_t ocookie; + xcb_randr_get_crtc_info_reply_t *oreply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(Ecore_X_Randr_None); + + if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; + + if (_randr_version >= RANDR_1_3) + stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); + else if (_randr_version == RANDR_1_2) + stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); + + ocookie = + xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp); + oreply = + xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL); + if (oreply) + { + ret = oreply->rotations; + free(oreply); + } +#endif + + return ret; +} + +/* + * @brief get a CRTC's possible outputs. + * @param root the root window which's screen will be queried + * @param num number of possible outputs referenced by given CRTC + */ +EAPI Ecore_X_Randr_Output * +ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *num) +{ + Ecore_X_Randr_Output *ret = NULL; +#ifdef ECORE_XCB_RANDR + xcb_timestamp_t stamp = 0; + xcb_randr_get_crtc_info_cookie_t ocookie; + xcb_randr_get_crtc_info_reply_t *oreply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(NULL); + + if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; + + if (_randr_version >= RANDR_1_3) + stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); + else if (_randr_version == RANDR_1_2) + stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); + + ocookie = + xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp); + oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL); + if (oreply) + { + if (num) *num = oreply->num_possible_outputs; + ret = malloc(sizeof(Ecore_X_Randr_Output) * + oreply->num_possible_outputs); + if (ret) + { + memcpy(ret, xcb_randr_get_crtc_info_possible(oreply), + sizeof(Ecore_X_Randr_Output) * + oreply->num_possible_outputs); + } + free(oreply); + } +#endif + + return ret; +} + +/* + * @brief get all known CRTCs related to a root window's screen + * @param root window which's screen's ressources are queried + * @param num number of CRTCs returned + * @return CRTC IDs + */ +EAPI Ecore_X_Randr_Crtc * +ecore_x_randr_crtcs_get(Ecore_X_Window root, + int *num) +{ + Ecore_X_Randr_Crtc *ret = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(NULL); + + if (_randr_version >= RANDR_1_3) + { + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(root); + if (reply) + { + if (num) *num = reply->num_crtcs; + ret = malloc(sizeof(Ecore_X_Randr_Crtc) * reply->num_crtcs); + if (ret) + memcpy(ret, xcb_randr_get_screen_resources_current_crtcs(reply), + sizeof(Ecore_X_Randr_Crtc) * reply->num_crtcs); + free(reply); + } + } + else if (_randr_version == RANDR_1_2) + { + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + if (reply) + { + if (num) *num = reply->num_crtcs; + ret = malloc(sizeof(Ecore_X_Randr_Crtc) * reply->num_crtcs); + if (ret) + memcpy(ret, xcb_randr_get_screen_resources_crtcs(reply), + sizeof(Ecore_X_Randr_Crtc) * reply->num_crtcs); + free(reply); + } + } +#endif + + return ret; +} + +/* + * @brief get a CRTC's outputs. + * @param root the root window which's screen will be queried + * @param num number of outputs referenced by given CRTC + */ +EAPI Ecore_X_Randr_Output * +ecore_x_randr_crtc_outputs_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *num) +{ + Ecore_X_Randr_Output *ret = NULL; +#ifdef ECORE_XCB_RANDR + xcb_timestamp_t stamp = 0; + xcb_randr_get_crtc_info_cookie_t ocookie; + xcb_randr_get_crtc_info_reply_t *oreply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(NULL); + + if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return ret; + + if (_randr_version >= RANDR_1_3) + stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); + else if (_randr_version == RANDR_1_2) + stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); + + ocookie = + xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp); + oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL); + if (oreply) + { + if (num) *num = oreply->num_outputs; + ret = malloc(sizeof(Ecore_X_Randr_Output) * oreply->num_outputs); + if (ret) + memcpy(ret, xcb_randr_get_crtc_info_outputs(oreply), + sizeof(Ecore_X_Randr_Output) * oreply->num_outputs); + free(oreply); + } +#endif + + return ret; +} + +EAPI void +ecore_x_randr_crtc_geometry_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *x, + int *y, + int *w, + int *h) +{ +#ifdef ECORE_XCB_RANDR + xcb_timestamp_t stamp = 0; + xcb_randr_get_crtc_info_cookie_t ocookie; + xcb_randr_get_crtc_info_reply_t *oreply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(); + + if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return; + + if (_randr_version >= RANDR_1_3) + stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); + else if (_randr_version == RANDR_1_2) + stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); + + ocookie = + xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtc, stamp); + oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, ocookie, NULL); + if (oreply) + { + if (x) *x = oreply->x; + if (y) *y = oreply->y; + if (w) *w = oreply->width; + if (h) *h = oreply->height; + free(oreply); + } +#endif +} + +/** + * @brief sets a CRTC relative to another one. + * @param crtc_r1 the CRTC to be positioned. + * @param crtc_r2 the CRTC the position should be relative to + * @param position the relation between the crtcs + * @param alignment in case CRTCs size differ, aligns CRTC1 accordingly at CRTC2's + * borders + * @return EINA_TRUE if crtc could be successfully positioned. EINA_FALSE if + * repositioning failed or if position of new crtc would be out of given screen's min/max bounds. + */ +EAPI Eina_Bool +ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc1, + Ecore_X_Randr_Crtc crtc2, + Ecore_X_Randr_Output_Policy policy, + Ecore_X_Randr_Relative_Alignment alignment) +{ +#ifdef ECORE_XCB_RANDR + Eina_Rectangle r1, r2; + int w_max = 0, h_max = 0, cw = 0, ch = 0, xn = -1, yn = -1; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + if ((ecore_x_randr_crtc_mode_get(root, crtc1) == 0) || + (ecore_x_randr_crtc_mode_get(root, crtc2) == 0)) + return EINA_FALSE; + + if ((!_ecore_xcb_randr_crtc_validate(root, crtc1) || + (!(crtc1 != crtc2) && (!_ecore_xcb_randr_crtc_validate(root, crtc2))))) + return EINA_FALSE; + + ecore_x_randr_crtc_geometry_get(root, crtc1, &r1.x, &r1.y, &r1.w, &r1.h); + ecore_x_randr_crtc_geometry_get(root, crtc2, &r2.x, &r2.y, &r2.w, &r2.h); + ecore_x_randr_screen_size_range_get(root, NULL, NULL, &w_max, &h_max); + ecore_x_randr_screen_current_size_get(root, &cw, &ch, NULL, NULL); + + switch (policy) + { + case ECORE_X_RANDR_OUTPUT_POLICY_RIGHT: + xn = (r2.x + r2.w); + if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE) + yn = -1; + else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL) + yn = ((int)(((double)r2.h / 2.0) + (double)r2.y - ((double)r1.h / 2.0))); + else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR) + yn = ((int)((double)ch / 2.0) - ((double)r1.h / 2.0)); + break; + + case ECORE_X_RANDR_OUTPUT_POLICY_LEFT: + xn = (r2.x - r1.w); + if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE) + yn = -1; + else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL) + yn = ((int)(((double)r2.h / 2.0) + (double)r2.y - ((double)r1.h / 2.0))); + else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR) + yn = ((int)((double)ch / 2.0) - ((double)r1.h / 2.0)); + break; + + case ECORE_X_RANDR_OUTPUT_POLICY_BELOW: + yn = (r2.y + r2.h); + if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE) + xn = -1; + else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL) + xn = ((int)((((double)r2.x + (double)r2.w) / 2.0) - ((double)r1.w / 2.0))); + else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR) + xn = ((int)((double)cw / 2.0)); + break; + + case ECORE_X_RANDR_OUTPUT_POLICY_ABOVE: + yn = (r2.y - r1.h); + if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE) + xn = -1; + else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL) + xn = ((int)((((double)r2.x + (double)r2.w) / 2.0) - ((double)r1.w / 2.0))); + else if (alignment == ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR) + xn = ((int)((double)cw / 2.0)); + break; + + case ECORE_X_RANDR_OUTPUT_POLICY_CLONE: + return ecore_x_randr_crtc_pos_set(root, crtc1, r2.x, r2.y); + break; + + case ECORE_X_RANDR_OUTPUT_POLICY_NONE: + break; + } + + if ((xn == r1.x) && (yn == r1.x)) return EINA_TRUE; + if (((yn + r1.h) > h_max) || ((xn + r1.w) > w_max)) + return EINA_FALSE; + + return ecore_x_randr_crtc_pos_set(root, crtc1, xn, yn); +#endif + + return EINA_FALSE; +} + +EAPI Eina_Bool +ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root, + const Ecore_X_Randr_Crtc *not_moved, + int num, + int dx, + int dy) +{ + Eina_Bool ret = EINA_FALSE; +#ifdef ECORE_XCB_RANDR + Ecore_X_Randr_Crtc *crtcs = NULL, *move = NULL; + int i = 0, j = 0, k = 0, n = 0, total = 0; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + if ((num <= 0) || (!not_moved) || (!_ecore_xcb_randr_root_validate(root))) + return EINA_FALSE; + + crtcs = ecore_x_randr_crtcs_get(root, &total); + n = (total - num); + move = malloc(sizeof(Ecore_X_Randr_Crtc) * n); + if (move) + { + for (i = 0, k = 0; (i < total) && (k < n); i++) + { + for (j = 0; j < num; j++) + if (crtcs[i] == not_moved[j]) break; + if (j == num) + move[k++] = crtcs[i]; + } + ret = ecore_x_randr_move_crtcs(root, move, n, dx, dy); + free(move); + free(crtcs); + } +#endif + + return ret; +} + +EAPI void +ecore_x_randr_crtc_pos_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *x, + int *y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(); + + ecore_x_randr_crtc_geometry_get(root, crtc, x, y, NULL, NULL); +#endif +} + +/* + * @brief sets the position of given CRTC within root window's screen + * @param root the window's screen to be queried + * @param crtc the CRTC which's position within the mentioned screen is to be altered + * @param x position on the x-axis (0 == left) of the screen. if x < 0 current value will be kept. + * @param y position on the y-ayis (0 == top) of the screen. if y < 0, current value will be kept. + * @return EINA_TRUE if position could be successfully be altered. + */ +EAPI Eina_Bool +ecore_x_randr_crtc_pos_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int x, + int y) +{ + Eina_Bool ret = EINA_FALSE; +#ifdef ECORE_XCB_RANDR + int w = 0, h = 0, nw = 0, nh = 0; + Eina_Rectangle rect; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + ecore_x_randr_crtc_geometry_get(root, crtc, + &rect.x, &rect.y, &rect.w, &rect.h); + ecore_x_randr_screen_current_size_get(root, &w, &h, NULL, NULL); + if (x < 0) x = rect.x; + if (y < 0) y = rect.y; + if ((x + rect.w) > w) + nw = (x + rect.w); + if ((y + rect.h) > h) + nh = (y + rect.h); + + if ((nw != 0) || (nh != 0)) + { + if (!ecore_x_randr_screen_current_size_set(root, nw, nh, 0, 0)) + return EINA_FALSE; + } + + ret = ecore_x_randr_crtc_settings_set(root, crtc, NULL, -1, x, y, -1, -1); +#endif + + return ret; +} + +EAPI void +ecore_x_randr_crtc_size_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *w, + int *h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(); + ecore_x_randr_crtc_geometry_get(root, crtc, NULL, NULL, w, h); +#endif +} + +EAPI Ecore_X_Randr_Refresh_Rate +ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + Ecore_X_Randr_Mode mode) +{ + Ecore_X_Randr_Refresh_Rate ret = 0.0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(0.0); + + if (!_ecore_xcb_randr_crtc_validate(root, crtc)) return 0.0; + + if (_randr_version >= RANDR_1_3) + { + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(root); + if (reply) + { + xcb_randr_mode_info_iterator_t miter; + + miter = + xcb_randr_get_screen_resources_current_modes_iterator(reply); + while (miter.rem) + { + xcb_randr_mode_info_t *minfo; + + minfo = miter.data; + if (minfo->id == mode) + { + if ((minfo->htotal) && (minfo->vtotal)) + { + ret = ((double)minfo->dot_clock / + ((double)minfo->htotal * + (double)minfo->vtotal)); + } + break; + } + xcb_randr_mode_info_next(&miter); + } + free(reply); + } + } + else if (_randr_version == RANDR_1_2) + { + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + if (reply) + { + xcb_randr_mode_info_iterator_t miter; + + miter = xcb_randr_get_screen_resources_modes_iterator(reply); + while (miter.rem) + { + xcb_randr_mode_info_t *minfo; + + minfo = miter.data; + if (minfo->id == mode) + { + if ((minfo->htotal) && (minfo->vtotal)) + { + ret = ((double)minfo->dot_clock / + ((double)minfo->htotal * + (double)minfo->vtotal)); + } + break; + } + xcb_randr_mode_info_next(&miter); + } + free(reply); + } + } +#endif + return ret; +} + +/* + * @brief move given CRTCs belonging to the given root window's screen dx/dy pixels relative to their current position. The screen size will be automatically adjusted if necessary and possible. + * @param root window which's screen's resources are used + * @param crtcs list of CRTCs to be moved + * @param ncrtc number of CRTCs in array + * @param dx amount of pixels the CRTCs should be moved in x direction + * @param dy amount of pixels the CRTCs should be moved in y direction + * @return EINA_TRUE if all crtcs could be moved successfully. + */ +EAPI Eina_Bool +ecore_x_randr_move_crtcs(Ecore_X_Window root, + const Ecore_X_Randr_Crtc *crtcs, + int num, + int dx, + int dy) +{ + Eina_Bool ret = EINA_TRUE; +#ifdef ECORE_XCB_RANDR + xcb_timestamp_t stamp = 0; + xcb_randr_get_crtc_info_reply_t *oreply[num]; + int i = 0, cw = 0, ch = 0; + int mw = 0, mh = 0, nw = 0, nh = 0; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + if (!_ecore_xcb_randr_root_validate(root)) return EINA_FALSE; + + if (_randr_version >= RANDR_1_3) + stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); + else if (_randr_version == RANDR_1_2) + stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); + + ecore_x_randr_screen_size_range_get(root, NULL, NULL, &mw, &mh); + ecore_x_randr_screen_current_size_get(root, &cw, &ch, NULL, NULL); + nw = cw; + nh = ch; + + for (i = 0; i < num; i++) + { + xcb_randr_get_crtc_info_cookie_t ocookie; + + ocookie = + xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtcs[i], + stamp); + oreply[i] = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, + ocookie, NULL); + if (oreply[i]) + { + if (((oreply[i]->x + dx) < 0) || + ((oreply[i]->y + dy) < 0) || + ((oreply[i]->x + oreply[i]->width + dx) > mw) || + ((oreply[i]->y + oreply[i]->height + dy) > mh)) + { + continue; + } + nw = MAX((int)(oreply[i]->x + oreply[i]->width + dx), nw); + nh = MAX((int)(oreply[i]->y + oreply[i]->height + dy), nh); + } + } + + if ((nw > cw) || (nh > ch)) + { + if (!ecore_x_randr_screen_current_size_set(root, nw, nh, -1, -1)) + { + for (i = 0; i < num; i++) + if (oreply[i]) free(oreply[i]); + + return EINA_FALSE; + } + } + + for (i = 0; ((i < num) && (oreply[i])); i++) + { + if (!oreply[i]) continue; + if (!ecore_x_randr_crtc_settings_set(root, crtcs[i], NULL, -1, + (oreply[i]->x + dx), + (oreply[i]->y + dy), + oreply[i]->mode, + oreply[i]->rotation)) + { + ret = EINA_FALSE; + break; + } + } + + if (i < num) + { + while (i-- >= 0) + { + if (oreply[i]) + ecore_x_randr_crtc_settings_set(root, crtcs[i], NULL, -1, + (oreply[i]->x - dx), + (oreply[i]->y - dy), + oreply[i]->mode, + oreply[i]->rotation); + } + } + + for (i = 0; i < num; i++) + if (oreply[i]) free(oreply[i]); +#endif + + return ret; +} + +/** + * @brief enable event selection. This enables basic interaction with + * output/crtc events and requires RRandR >= 1.2. + * @param win select this window's properties for RandRR events + * @param on enable/disable selecting + */ +EAPI void +ecore_x_randr_events_select(Ecore_X_Window win, + Eina_Bool on) +{ +#ifdef ECORE_XCB_RANDR + uint16_t mask = 0; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + if (on) + { + mask = XCB_RANDR_NOTIFY_MASK_SCREEN_CHANGE; + if (_randr_version >= ((1 << 16) | 2)) + { + mask |= (XCB_RANDR_NOTIFY_MASK_CRTC_CHANGE | + XCB_RANDR_NOTIFY_MASK_OUTPUT_CHANGE | + XCB_RANDR_NOTIFY_MASK_OUTPUT_PROPERTY); + } + } + + xcb_randr_select_input(_ecore_xcb_conn, win, mask); +#endif +} + +/** + * @brief removes unused screen space. The most upper left CRTC is set to 0x0 + * and all other CRTCs dx,dy respectively. + * @param root the window's screen which will be reset. + */ +EAPI void +ecore_x_randr_screen_reset(Ecore_X_Window root) +{ +#ifdef ECORE_XCB_RANDR + xcb_timestamp_t stamp = 0; + Ecore_X_Randr_Crtc *crtcs = NULL; + int total = 0, i = 0, w = 0, h = 0; + int dx = 100000, dy = 100000, num = 0; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + if (!_ecore_xcb_randr_root_validate(root)) return; + crtcs = ecore_x_randr_crtcs_get(root, &total); + + if (_randr_version >= RANDR_1_3) + stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); + else if (_randr_version == RANDR_1_2) + stamp = _ecore_xcb_randr_12_get_resource_timestamp(root); + + /* I hate declaring variables inside code like this, but we need the + * value of 'total' before we can */ + Ecore_X_Randr_Crtc enabled[total]; + + for (i = 0; i < total; i++) + { + xcb_randr_get_crtc_info_cookie_t ocookie; + xcb_randr_get_crtc_info_reply_t *oreply; + + ocookie = + xcb_randr_get_crtc_info_unchecked(_ecore_xcb_conn, crtcs[i], stamp); + oreply = xcb_randr_get_crtc_info_reply(_ecore_xcb_conn, + ocookie, NULL); + if (!oreply) continue; + if ((oreply->mode <= 0) || (oreply->num_outputs == 0)) + { + free(oreply); + continue; + } + + enabled[num++] = crtcs[i]; + if ((int)(oreply->x + oreply->width) > w) + w = (oreply->x + oreply->width); + if ((int)(oreply->y + oreply->height) > h) + h = (oreply->y + oreply->height); + + if (oreply->x < dx) dx = oreply->x; + if (oreply->y < dy) dy = oreply->y; + + free(oreply); + } + free(crtcs); + + if ((dx > 0) || (dy > 0)) + { + if (ecore_x_randr_move_crtcs(root, enabled, num, -dx, -dy)) + { + w -= dx; + h -= dy; + } + } + + ecore_x_randr_screen_current_size_set(root, w, h, -1, -1); +#endif +} + +/* + * @param root window which's screen will be queried + * @param wmin minimum width the screen can be set to + * @param hmin minimum height the screen can be set to + * @param wmax maximum width the screen can be set to + * @param hmax maximum height the screen can be set to + */ +EAPI void +ecore_x_randr_screen_size_range_get(Ecore_X_Window root, + int *minw, + int *minh, + int *maxw, + int *maxh) +{ +#ifdef ECORE_XCB_RANDR + xcb_randr_get_screen_size_range_cookie_t cookie; + xcb_randr_get_screen_size_range_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(); + + cookie = xcb_randr_get_screen_size_range_unchecked(_ecore_xcb_conn, root); + reply = xcb_randr_get_screen_size_range_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + if (minw) *minw = reply->min_width; + if (minh) *minh = reply->min_height; + if (maxw) *maxw = reply->max_width; + if (maxh) *maxh = reply->max_height; + free(reply); + } +#endif +} + +/* + * @param w width of screen in px + * @param h height of screen in px + */ +EAPI void +ecore_x_randr_screen_current_size_get(Ecore_X_Window root, + int *w, + int *h, + int *w_mm, + int *h_mm) +{ +#ifdef ECORE_XCB_RANDR + Ecore_X_Randr_Screen scr = 0; + xcb_screen_t *s; +# define RANDR_VALIDATE_ROOT(screen, root) \ + ((screen == _ecore_xcb_randr_root_to_screen(root)) != -1) +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(); + + if (!RANDR_VALIDATE_ROOT(scr, root)) return; + + s = ecore_x_screen_get(scr); + if (w) *w = s->width_in_pixels; + if (h) *h = s->height_in_pixels; + if (w_mm) *w_mm = s->width_in_millimeters; + if (h_mm) *h_mm = s->height_in_millimeters; +#endif +} + +/* + * @param root window which's screen's size should be set. If invalid (e.g. NULL) no action is taken. + * @param w width in px the screen should be set to. If out of valid boundaries, current value is assumed. + * @param h height in px the screen should be set to. If out of valid boundaries, current value is assumed. + * @param w_mm width in mm the screen should be set to. If 0, current aspect is assumed. + * @param h_mm height in mm the screen should be set to. If 0, current aspect is assumed. + * @return EINA_TRUE if request was successfully sent or screen is already in + * requested size, EINA_FALSE if parameters are invalid + */ +EAPI Eina_Bool +ecore_x_randr_screen_current_size_set(Ecore_X_Window root, + int w, + int h, + int w_mm, + int h_mm) +{ + Eina_Bool ret = EINA_TRUE; +#ifdef ECORE_XCB_RANDR + Ecore_X_Randr_Screen scr; + int wc = 0, hc = 0, w_mm_c = 0, h_mm_c = 0; + int mw = 0, mh = 0, xw = 0, xh = 0; +# define RANDR_VALIDATE_ROOT(screen, root) \ + ((screen == _ecore_xcb_randr_root_to_screen(root)) != -1) +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + if (!RANDR_VALIDATE_ROOT(scr, root)) return EINA_FALSE; + ecore_x_randr_screen_current_size_get(root, &wc, &hc, &w_mm_c, &h_mm_c); + if ((w == wc) && (h == hc) && (w_mm == w_mm_c) && (h_mm == h_mm_c)) + return EINA_TRUE; + ecore_x_randr_screen_size_range_get(root, &mw, &mh, &xw, &xh); + if (((w != 1) && ((w < mw) || (w > xw))) || + ((h != -1) && ((h < mh) || (h > xh)))) return EINA_FALSE; + + if (w <= 0) + w = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels; + if (h <= 0) + h = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels; + + /* NB: Hmmmm, xlib version divides w_mm by width ... that seems wrong */ + if (w_mm <= 0) + w_mm = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_millimeters; + if (h_mm <= 0) + h_mm = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_millimeters; + + xcb_randr_set_screen_size(_ecore_xcb_conn, root, w, h, w_mm, h_mm); +#endif + + return ret; +} + +/* + * @brief get the outputs, which display a certain window + * @param window window the displaying outputs shall be found for + * @param num the number of outputs displaying the window + * @return array of outputs that display a certain window. NULL if no outputs + * was found that displays the specified window. + */ +EAPI Ecore_X_Randr_Output * +ecore_x_randr_window_outputs_get(Ecore_X_Window window, + int *num) +{ +#ifdef ECORE_XCB_RANDR + Ecore_X_Window root; + Eina_Rectangle w_geo, c_geo; + Ecore_X_Randr_Crtc *crtcs; + Ecore_X_Randr_Mode mode; + Ecore_X_Randr_Output *outputs, *ret = NULL, *tret; + int ncrtcs, noutputs, i, nret = 0; + xcb_translate_coordinates_cookie_t cookie; + xcb_translate_coordinates_reply_t *trans; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (num) *num = 0; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(NULL); + + ecore_x_window_geometry_get(window, &w_geo.x, &w_geo.y, &w_geo.w, &w_geo.h); + + root = ecore_x_window_root_get(window); + crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs); + if (!crtcs) return NULL; + + /* now get window RELATIVE to root window - thats what matters. */ + cookie = xcb_translate_coordinates(_ecore_xcb_conn, window, root, 0, 0); + trans = xcb_translate_coordinates_reply(_ecore_xcb_conn, cookie, NULL); + w_geo.x = trans->dst_x; + w_geo.y = trans->dst_y; + free(trans); + + for (i = 0; i < ncrtcs; i++) + { + /* if crtc is not enabled, don't bother about it any further */ + mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]); + if (mode == Ecore_X_Randr_None) continue; + + ecore_x_randr_crtc_geometry_get(root, crtcs[i], &c_geo.x, &c_geo.y, + &c_geo.w, &c_geo.h); + if (eina_rectangles_intersect(&w_geo, &c_geo)) + { + outputs = + ecore_x_randr_crtc_outputs_get(root, crtcs[i], &noutputs); + /* The case below should be impossible, but for safety reasons + * remains */ + if (!outputs) + { + if (num) *num = 0; + free(ret); + free(crtcs); + return NULL; + } + tret = realloc(ret, ((nret + noutputs) * + sizeof(Ecore_X_Randr_Output))); + if (!tret) + { + if (num) *num = 0; + free(outputs); + free(ret); + free(crtcs); + return NULL; + } + ret = tret; + memcpy(&ret[nret], outputs, + (noutputs * sizeof(Ecore_X_Randr_Output))); + nret += noutputs; + free(outputs); + } + } + free(crtcs); + + if (num) *num = nret; + return ret; + +#endif + if (num) *num = 0; + return NULL; +} + +/* + * @brief get the backlight level of the given output + * @param root window which's screen should be queried + * @param output from which the backlight level should be retrieved + * @return the backlight level + */ +EAPI double +ecore_x_randr_output_backlight_level_get(Ecore_X_Window root, + Ecore_X_Randr_Output output) +{ +#ifdef ECORE_XCB_RANDR + Ecore_X_Atom _backlight; + xcb_intern_atom_cookie_t acookie; + xcb_intern_atom_reply_t *areply; + xcb_randr_get_output_property_cookie_t cookie; + xcb_randr_get_output_property_reply_t *reply; + xcb_randr_query_output_property_cookie_t qcookie; + xcb_randr_query_output_property_reply_t *qreply; + double dvalue; + long value, max, min; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(-1); + + acookie = + xcb_intern_atom_unchecked(_ecore_xcb_conn, 1, + strlen("Backlight"), "Backlight"); + areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL); + + if (!areply) + { + ERR("Backlight property is not suppported on this server or driver"); + return -1; + } + else + { + _backlight = areply->atom; + free(areply); + } + + if (!_ecore_xcb_randr_output_validate(root, output)) + { + ERR("Invalid output"); + return -1; + } + + cookie = + xcb_randr_get_output_property_unchecked(_ecore_xcb_conn, + output, _backlight, + XCB_ATOM_NONE, 0, 4, 0, 0); + reply = + xcb_randr_get_output_property_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) + { + WRN("Backlight not supported on this output"); + return -1; + } + + if ((reply->format != 32) || (reply->num_items != 1) || + (reply->type != XCB_ATOM_INTEGER)) + { + free(reply); + return -1; + } + + value = *((long *)xcb_randr_get_output_property_data(reply)); + free (reply); + + /* I have the current value of the backlight */ + /* Now retrieve the min and max intensities of the output */ + qcookie = + xcb_randr_query_output_property_unchecked(_ecore_xcb_conn, + output, _backlight); + qreply = + xcb_randr_query_output_property_reply(_ecore_xcb_conn, qcookie, NULL); + if (qreply) + { + dvalue = -1; + if ((qreply->range) && + (xcb_randr_query_output_property_valid_values_length(qreply) == 2)) + { + int32_t *vals; + + vals = xcb_randr_query_output_property_valid_values(qreply); + /* finally convert the current value in the interval [0..1] */ + min = vals[0]; + max = vals[1]; + dvalue = ((double)(value - min)) / ((double)(max - min)); + } + free(qreply); + return dvalue; + } +#endif + return -1; +} + +/* + * @brief set the backlight level of a given output + * @param root window which's screen should be queried + * @param output that should be set + * @param level for which the backlight should be set + * @return EINA_TRUE in case of success + */ +EAPI Eina_Bool +ecore_x_randr_output_backlight_level_set(Ecore_X_Window root, + Ecore_X_Randr_Output output, + double level) +{ +#ifdef ECORE_XCB_RANDR + Ecore_X_Atom _backlight; + xcb_intern_atom_cookie_t acookie; + xcb_intern_atom_reply_t *areply; + xcb_randr_query_output_property_cookie_t qcookie; + xcb_randr_query_output_property_reply_t *qreply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + if ((level < 0) || (level > 1)) + { + ERR("Backlight level should be between 0 and 1"); + return EINA_FALSE; + } + + if (!_ecore_xcb_randr_output_validate(root, output)) + { + ERR("Wrong output value"); + return EINA_FALSE; + } + + acookie = + xcb_intern_atom_unchecked(_ecore_xcb_conn, 1, + strlen("Backlight"), "Backlight"); + areply = xcb_intern_atom_reply(_ecore_xcb_conn, acookie, NULL); + if (!areply) + { + WRN("Backlight property is not suppported on this server or driver"); + return EINA_FALSE; + } + else + { + _backlight = areply->atom; + free(areply); + } + + qcookie = + xcb_randr_query_output_property_unchecked(_ecore_xcb_conn, + output, _backlight); + qreply = + xcb_randr_query_output_property_reply(_ecore_xcb_conn, qcookie, NULL); + if (qreply) + { + if ((qreply->range) && (qreply->length == 2)) + { + int32_t *vals; + double min, max, tmp; + long n; + + vals = xcb_randr_query_output_property_valid_values(qreply); + min = vals[0]; + max = vals[1]; + tmp = (level * (max - min)) + min; + n = tmp; + if (n > max) n = max; + if (n < min) n = min; + xcb_randr_change_output_property(_ecore_xcb_conn, output, + _backlight, XCB_ATOM_INTEGER, + 32, XCB_PROP_MODE_REPLACE, + 1, (unsigned char *)&n); + ecore_x_flush(); // needed + } + + free(qreply); + return EINA_TRUE; + } +#endif + return EINA_FALSE; +} + +EAPI int +ecore_x_randr_edid_version_get(unsigned char *edid, unsigned long edid_length) +{ + if ((edid_length > _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR) && + (ecore_x_randr_edid_has_valid_header(edid, edid_length))) + return (edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR] << 8) | + edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR]; + return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; +} + +EAPI char * +ecore_x_randr_edid_display_name_get(unsigned char *edid, unsigned long edid_length) +{ + unsigned char *block = NULL; + int version = 0; + + version = ecore_x_randr_edid_version_get(edid, edid_length); + if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL; + + _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) + { + if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfc) + { + char *name, *p; + const char *edid_name; + + edid_name = (const char *)block + + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT; + name = + malloc(sizeof(char) * + _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); + if (!name) return NULL; + + strncpy(name, edid_name, + (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1)); + name[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; + for (p = name; *p; p++) + if ((*p < ' ') || (*p > '~')) *p = 0; + + return name; + } + } + return NULL; +} + +EAPI Eina_Bool +ecore_x_randr_edid_has_valid_header(unsigned char *edid, unsigned long edid_length) +{ + const unsigned char header[] = + { + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 + }; + + if ((!edid) || (edid_length < 8)) return EINA_FALSE; + if (!memcmp(edid, header, 8)) return EINA_TRUE; + return EINA_FALSE; +} + +/* local functions */ +static Eina_Bool +_ecore_xcb_randr_output_validate(Ecore_X_Window root, + Ecore_X_Randr_Output output) +{ + Eina_Bool ret = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + if ((output) && (_ecore_xcb_randr_root_validate(root))) + { + if (_randr_version >= RANDR_1_3) + { + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(root); + if (reply) + { + int len = 0, i = 0; + xcb_randr_output_t *outputs; + + len = + xcb_randr_get_screen_resources_current_outputs_length(reply); + outputs = + xcb_randr_get_screen_resources_current_outputs(reply); + for (i = 0; i < len; i++) + { + if (outputs[i] == output) + { + ret = EINA_TRUE; + break; + } + } + free(reply); + } + } + else if (_randr_version == RANDR_1_2) + { + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + if (reply) + { + int len = 0, i = 0; + xcb_randr_output_t *outputs; + + len = xcb_randr_get_screen_resources_outputs_length(reply); + outputs = xcb_randr_get_screen_resources_outputs(reply); + for (i = 0; i < len; i++) + { + if (outputs[i] == output) + { + ret = EINA_TRUE; + break; + } + } + free(reply); + } + } + } +#endif + return ret; +} + +/** + * @brief validates a CRTC for a given root window's screen. + * @param root the window which's default display will be queried + * @param crtc the CRTC to be validated. + * @return in case it is found EINA_TRUE will be returned. Else EINA_FALSE is returned. + */ +static Eina_Bool +_ecore_xcb_randr_crtc_validate(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc) +{ + Eina_Bool ret = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + if (((int)crtc == Ecore_X_Randr_None) || ((int)crtc == Ecore_X_Randr_Unset)) + return ret; + + if ((crtc) && (_ecore_xcb_randr_root_validate(root))) + { + if (_randr_version >= RANDR_1_3) + { + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(root); + if (reply) + { + int i = 0; + xcb_randr_crtc_t *crtcs; + + crtcs = xcb_randr_get_screen_resources_current_crtcs(reply); + for (i = 0; i < reply->num_crtcs; i++) + { + if (crtcs[i] == crtc) + { + ret = EINA_TRUE; + break; + } + } + free(reply); + } + } + else if (_randr_version == RANDR_1_2) + { + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + if (reply) + { + int i = 0; + xcb_randr_crtc_t *crtcs; + + crtcs = xcb_randr_get_screen_resources_crtcs(reply); + for (i = 0; i < reply->num_crtcs; i++) + { + if (crtcs[i] == crtc) + { + ret = EINA_TRUE; + break; + } + } + free(reply); + } + } + } +#endif + + return ret; +} + +static Ecore_X_Randr_Mode * +_ecore_xcb_randr_12_output_modes_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num, + int *npreferred) +{ + Ecore_X_Randr_Mode *modes = NULL; + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + if (reply) + { + xcb_randr_get_output_info_cookie_t ocookie; + xcb_randr_get_output_info_reply_t *oreply; + + ocookie = + xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, + reply->config_timestamp); + oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, + ocookie, NULL); + if (oreply) + { + if (num) *num = oreply->num_modes; + if (npreferred) *npreferred = oreply->num_preferred; + + modes = malloc(sizeof(Ecore_X_Randr_Mode) * + oreply->num_modes); + if (modes) + { + xcb_randr_mode_t *rmodes; + int len = 0; + + len = xcb_randr_get_output_info_modes_length(oreply); + rmodes = xcb_randr_get_output_info_modes(oreply); + memcpy(modes, rmodes, sizeof(Ecore_X_Randr_Mode) * len); + } + free(oreply); + } + free(reply); + } + + return modes; +} + +static Ecore_X_Randr_Mode * +_ecore_xcb_randr_13_output_modes_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num, + int *npreferred) +{ + Ecore_X_Randr_Mode *modes = NULL; + xcb_timestamp_t stamp = 0; + xcb_randr_get_output_info_cookie_t ocookie; + xcb_randr_get_output_info_reply_t *oreply; + + stamp = _ecore_xcb_randr_13_get_resource_timestamp(root); + + ocookie = + xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, stamp); + oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, ocookie, NULL); + if (oreply) + { + if (num) *num = oreply->num_modes; + if (npreferred) *npreferred = oreply->num_preferred; + + modes = malloc(sizeof(Ecore_X_Randr_Mode) * oreply->num_modes); + if (modes) + { + xcb_randr_mode_t *rmodes; + int len = 0; + + len = xcb_randr_get_output_info_modes_length(oreply); + rmodes = xcb_randr_get_output_info_modes(oreply); + memcpy(modes, rmodes, sizeof(Ecore_X_Randr_Mode) * len); + } + free(oreply); + } + + return modes; +} + +static Ecore_X_Randr_Mode_Info * +_ecore_xcb_randr_12_mode_info_get(Ecore_X_Window root, + Ecore_X_Randr_Mode mode) +{ + Ecore_X_Randr_Mode_Info *ret = NULL; + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + if (reply) + { + if ((ret = malloc(sizeof(Ecore_X_Randr_Mode_Info)))) + { + uint8_t *nbuf; + xcb_randr_mode_info_iterator_t miter; + + nbuf = xcb_randr_get_screen_resources_names(reply); + miter = xcb_randr_get_screen_resources_modes_iterator(reply); + while (miter.rem) + { + xcb_randr_mode_info_t *minfo; + + minfo = miter.data; + nbuf += minfo->name_len; + + if (minfo->id == mode) + { + ret->xid = minfo->id; + ret->width = minfo->width; + ret->height = minfo->height; + ret->dotClock = minfo->dot_clock; + ret->hSyncStart = minfo->hsync_start; + ret->hSyncEnd = minfo->hsync_end; + ret->hTotal = minfo->htotal; + ret->vSyncStart = minfo->vsync_start; + ret->vSyncEnd = minfo->vsync_end; + ret->vTotal = minfo->vtotal; + ret->modeFlags = minfo->mode_flags; + + ret->name = NULL; + ret->nameLength = minfo->name_len; + if (ret->nameLength > 0) + { + ret->name = malloc(ret->nameLength + 1); + if (ret->name) + memcpy(ret->name, nbuf, ret->nameLength + 1); + } + + break; + } + xcb_randr_mode_info_next(&miter); + } + } + + free(reply); + } + return ret; +} + +static Ecore_X_Randr_Mode_Info * +_ecore_xcb_randr_13_mode_info_get(Ecore_X_Window root, + Ecore_X_Randr_Mode mode) +{ + Ecore_X_Randr_Mode_Info *ret = NULL; + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(root); + if (reply) + { + if ((ret = malloc(sizeof(Ecore_X_Randr_Mode_Info)))) + { + uint8_t *nbuf; + xcb_randr_mode_info_iterator_t miter; + + nbuf = xcb_randr_get_screen_resources_current_names(reply); + miter = + xcb_randr_get_screen_resources_current_modes_iterator(reply); + while (miter.rem) + { + xcb_randr_mode_info_t *minfo; + + minfo = miter.data; + nbuf += minfo->name_len; + + if (minfo->id == mode) + { + ret->xid = minfo->id; + ret->width = minfo->width; + ret->height = minfo->height; + ret->dotClock = minfo->dot_clock; + ret->hSyncStart = minfo->hsync_start; + ret->hSyncEnd = minfo->hsync_end; + ret->hTotal = minfo->htotal; + ret->vSyncStart = minfo->vsync_start; + ret->vSyncEnd = minfo->vsync_end; + ret->vTotal = minfo->vtotal; + ret->modeFlags = minfo->mode_flags; + + ret->name = NULL; + ret->nameLength = minfo->name_len; + if (ret->nameLength > 0) + { + ret->name = malloc(ret->nameLength + 1); + if (ret->name) + memcpy(ret->name, nbuf, ret->nameLength + 1); + } + + break; + } + xcb_randr_mode_info_next(&miter); + } + } + + free(reply); + } + return ret; +} + +static Ecore_X_Randr_Mode_Info ** +_ecore_xcb_randr_12_modes_info_get(Ecore_X_Window root, + int *num) +{ + Ecore_X_Randr_Mode_Info **ret = NULL; + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + if (reply) + { + if (num) *num = reply->num_modes; + ret = malloc(sizeof(Ecore_X_Randr_Mode_Info *) * reply->num_modes); + if (ret) + { + xcb_randr_mode_info_iterator_t miter; + int i = 0; + uint8_t *nbuf; + + nbuf = xcb_randr_get_screen_resources_names(reply); + miter = xcb_randr_get_screen_resources_modes_iterator(reply); + while (miter.rem) + { + xcb_randr_mode_info_t *minfo; + + minfo = miter.data; + nbuf += minfo->name_len; + if ((ret[i] = malloc(sizeof(Ecore_X_Randr_Mode_Info)))) + { + ret[i]->xid = minfo->id; + ret[i]->width = minfo->width; + ret[i]->height = minfo->height; + ret[i]->dotClock = minfo->dot_clock; + ret[i]->hSyncStart = minfo->hsync_start; + ret[i]->hSyncEnd = minfo->hsync_end; + ret[i]->hTotal = minfo->htotal; + ret[i]->vSyncStart = minfo->vsync_start; + ret[i]->vSyncEnd = minfo->vsync_end; + ret[i]->vTotal = minfo->vtotal; + ret[i]->modeFlags = minfo->mode_flags; + + ret[i]->name = NULL; + ret[i]->nameLength = minfo->name_len; + if (ret[i]->nameLength > 0) + { + ret[i]->name = malloc(ret[i]->nameLength + 1); + if (ret[i]->name) + memcpy(ret[i]->name, nbuf, + ret[i]->nameLength + 1); + } + } + else + { + while (i > 0) + free(ret[--i]); + free(ret); + ret = NULL; + break; + } + i++; + xcb_randr_mode_info_next(&miter); + } + } + free(reply); + } + return ret; +} + +static Ecore_X_Randr_Mode_Info ** +_ecore_xcb_randr_13_modes_info_get(Ecore_X_Window root, + int *num) +{ + Ecore_X_Randr_Mode_Info **ret = NULL; + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(root); + if (reply) + { + if (num) *num = reply->num_modes; + ret = malloc(sizeof(Ecore_X_Randr_Mode_Info *) * reply->num_modes); + if (ret) + { + xcb_randr_mode_info_iterator_t miter; + int i = 0; + uint8_t *nbuf; + + nbuf = xcb_randr_get_screen_resources_current_names(reply); + miter = + xcb_randr_get_screen_resources_current_modes_iterator(reply); + while (miter.rem) + { + xcb_randr_mode_info_t *minfo; + + minfo = miter.data; + nbuf += minfo->name_len; + if ((ret[i] = malloc(sizeof(Ecore_X_Randr_Mode_Info)))) + { + ret[i]->xid = minfo->id; + ret[i]->width = minfo->width; + ret[i]->height = minfo->height; + ret[i]->dotClock = minfo->dot_clock; + ret[i]->hSyncStart = minfo->hsync_start; + ret[i]->hSyncEnd = minfo->hsync_end; + ret[i]->hTotal = minfo->htotal; + ret[i]->vSyncStart = minfo->vsync_start; + ret[i]->vSyncEnd = minfo->vsync_end; + ret[i]->vTotal = minfo->vtotal; + ret[i]->modeFlags = minfo->mode_flags; + + ret[i]->name = NULL; + ret[i]->nameLength = minfo->name_len; + if (ret[i]->nameLength > 0) + { + ret[i]->name = malloc(ret[i]->nameLength + 1); + if (ret[i]->name) + memcpy(ret[i]->name, nbuf, + ret[i]->nameLength + 1); + } + } + else + { + while (i > 0) + free(ret[--i]); + free(ret); + ret = NULL; + break; + } + i++; + xcb_randr_mode_info_next(&miter); + } + } + free(reply); + } + return ret; +} + +static void +_ecore_xcb_randr_12_mode_size_get(Ecore_X_Window root, + Ecore_X_Randr_Mode mode, + int *w, + int *h) +{ + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + if (reply) + { + xcb_randr_mode_info_iterator_t miter; + + miter = xcb_randr_get_screen_resources_modes_iterator(reply); + while (miter.rem) + { + xcb_randr_mode_info_t *minfo; + + minfo = miter.data; + if (minfo->id == mode) + { + if (w) *w = minfo->width; + if (h) *h = minfo->height; + break; + } + xcb_randr_mode_info_next(&miter); + } + free(reply); + } +} + +static void +_ecore_xcb_randr_13_mode_size_get(Ecore_X_Window root, + Ecore_X_Randr_Mode mode, + int *w, + int *h) +{ + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(root); + if (reply) + { + xcb_randr_mode_info_iterator_t miter; + + miter = xcb_randr_get_screen_resources_current_modes_iterator(reply); + while (miter.rem) + { + xcb_randr_mode_info_t *minfo; + + minfo = miter.data; + if (minfo->id == mode) + { + if (w) *w = minfo->width; + if (h) *h = minfo->height; + break; + } + xcb_randr_mode_info_next(&miter); + } + free(reply); + } +} + +static Ecore_X_Randr_Output * +_ecore_xcb_randr_12_output_clones_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num) +{ + Ecore_X_Randr_Output *outputs = NULL; + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + if (reply) + { + xcb_randr_get_output_info_cookie_t ocookie; + xcb_randr_get_output_info_reply_t *oreply; + + ocookie = + xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, + reply->config_timestamp); + oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, + ocookie, NULL); + if (oreply) + { + if (num) *num = oreply->num_clones; + + outputs = + malloc(sizeof(Ecore_X_Randr_Output) * oreply->num_clones); + if (outputs) + { + memcpy(outputs, xcb_randr_get_output_info_clones(oreply), + sizeof(Ecore_X_Randr_Output) * oreply->num_clones); + } + free(oreply); + } + free(reply); + } + return outputs; +} + +static Ecore_X_Randr_Output * +_ecore_xcb_randr_13_output_clones_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num) +{ + Ecore_X_Randr_Output *outputs = NULL; + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(root); + if (reply) + { + xcb_randr_get_output_info_cookie_t ocookie; + xcb_randr_get_output_info_reply_t *oreply; + + ocookie = + xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, + reply->config_timestamp); + oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, + ocookie, NULL); + if (oreply) + { + if (num) *num = oreply->num_clones; + + outputs = + malloc(sizeof(Ecore_X_Randr_Output) * oreply->num_clones); + if (outputs) + { + memcpy(outputs, xcb_randr_get_output_info_clones(oreply), + sizeof(Ecore_X_Randr_Output) * oreply->num_clones); + } + free(oreply); + } + free(reply); + } + return outputs; +} + +static Ecore_X_Randr_Crtc * +_ecore_xcb_randr_12_output_possible_crtcs_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num) +{ + Ecore_X_Randr_Crtc *crtcs = NULL; + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + if (reply) + { + xcb_randr_get_output_info_cookie_t ocookie; + xcb_randr_get_output_info_reply_t *oreply; + + ocookie = + xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, + reply->config_timestamp); + oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, + ocookie, NULL); + if (oreply) + { + if (num) *num = oreply->num_crtcs; + + crtcs = malloc(sizeof(Ecore_X_Randr_Crtc) * oreply->num_crtcs); + if (crtcs) + { + memcpy(crtcs, xcb_randr_get_output_info_crtcs(oreply), + sizeof(Ecore_X_Randr_Crtc) * oreply->num_crtcs); + } + free(oreply); + } + free(reply); + } + return crtcs; +} + +static Ecore_X_Randr_Crtc * +_ecore_xcb_randr_13_output_possible_crtcs_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num) +{ + Ecore_X_Randr_Crtc *crtcs = NULL; + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(root); + if (reply) + { + xcb_randr_get_output_info_cookie_t ocookie; + xcb_randr_get_output_info_reply_t *oreply; + + ocookie = + xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, + reply->config_timestamp); + oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, + ocookie, NULL); + if (oreply) + { + if (num) *num = oreply->num_crtcs; + + crtcs = malloc(sizeof(Ecore_X_Randr_Crtc) * oreply->num_crtcs); + if (crtcs) + { + memcpy(crtcs, xcb_randr_get_output_info_crtcs(oreply), + sizeof(Ecore_X_Randr_Crtc) * oreply->num_crtcs); + } + free(oreply); + } + free(reply); + } + return crtcs; +} + +static char * +_ecore_xcb_randr_12_output_name_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *len) +{ + char *ret = NULL; + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + if (reply) + { + xcb_randr_get_output_info_cookie_t ocookie; + xcb_randr_get_output_info_reply_t *oreply; + + ocookie = + xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, + reply->config_timestamp); + oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, + ocookie, NULL); + if (oreply) + { + uint8_t *nbuf; + + nbuf = xcb_randr_get_output_info_name(oreply); + nbuf += oreply->name_len; + + if (len) *len = oreply->name_len; + if (oreply->name_len > 0) + { + ret = malloc(oreply->name_len + 1); + if (ret) + memcpy(ret, nbuf, oreply->name_len + 1); + } + + free(oreply); + } + free(reply); + } + return ret; +} + +static char * +_ecore_xcb_randr_13_output_name_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *len) +{ + char *ret = NULL; + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(root); + if (reply) + { + xcb_randr_get_output_info_cookie_t ocookie; + xcb_randr_get_output_info_reply_t *oreply; + + ocookie = + xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, + reply->config_timestamp); + oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, + ocookie, NULL); + if (oreply) + { + uint8_t *nbuf; + + nbuf = xcb_randr_get_output_info_name(oreply); + nbuf += oreply->name_len; + + if (len) *len = oreply->name_len; + if (oreply->name_len > 0) + { + ret = malloc(oreply->name_len + 1); + if (ret) + memcpy(ret, nbuf, oreply->name_len + 1); + } + + free(oreply); + } + free(reply); + } + return ret; +} + +static Ecore_X_Randr_Connection_Status +_ecore_xcb_randr_12_output_connection_status_get(Ecore_X_Window root, + Ecore_X_Randr_Output output) +{ + Ecore_X_Randr_Connection_Status ret = ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN; + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + if (reply) + { + xcb_randr_get_output_info_cookie_t ocookie; + xcb_randr_get_output_info_reply_t *oreply; + + ocookie = + xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, + reply->config_timestamp); + oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, + ocookie, NULL); + if (oreply) + { + ret = oreply->connection; + free(oreply); + } + free(reply); + } + return ret; +} + +static Ecore_X_Randr_Connection_Status +_ecore_xcb_randr_13_output_connection_status_get(Ecore_X_Window root, + Ecore_X_Randr_Output output) +{ + Ecore_X_Randr_Connection_Status ret = ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN; + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(root); + if (reply) + { + xcb_randr_get_output_info_cookie_t ocookie; + xcb_randr_get_output_info_reply_t *oreply; + + ocookie = + xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, + reply->config_timestamp); + oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, + ocookie, NULL); + if (oreply) + { + ret = oreply->connection; + free(oreply); + } + free(reply); + } + return ret; +} + +static Ecore_X_Randr_Output * +_ecore_xcb_randr_12_outputs_get(Ecore_X_Window root, + int *num) +{ + Ecore_X_Randr_Output *ret = NULL; + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + if (reply) + { + if (num) *num = reply->num_outputs; + ret = malloc(sizeof(Ecore_X_Randr_Output) * reply->num_outputs); + if (ret) + memcpy(ret, xcb_randr_get_screen_resources_outputs(reply), + sizeof(Ecore_X_Randr_Output) * reply->num_outputs); + free(reply); + } + return ret; +} + +static Ecore_X_Randr_Output * +_ecore_xcb_randr_13_outputs_get(Ecore_X_Window root, + int *num) +{ + Ecore_X_Randr_Output *ret = NULL; + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(root); + if (reply) + { + if (num) *num = reply->num_outputs; + ret = malloc(sizeof(Ecore_X_Randr_Output) * reply->num_outputs); + if (ret) + memcpy(ret, xcb_randr_get_screen_resources_current_outputs(reply), + sizeof(Ecore_X_Randr_Output) * reply->num_outputs); + free(reply); + } + return ret; +} + +static Ecore_X_Randr_Crtc +_ecore_xcb_randr_12_output_crtc_get(Ecore_X_Window root, + Ecore_X_Randr_Output output) +{ + Ecore_X_Randr_Crtc ret = Ecore_X_Randr_None; + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(root); + if (reply) + { + xcb_randr_get_output_info_cookie_t ocookie; + xcb_randr_get_output_info_reply_t *oreply; + + ocookie = + xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, + reply->config_timestamp); + oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, + ocookie, NULL); + if (oreply) + { + ret = oreply->crtc; + free(oreply); + } + free(reply); + } + return ret; +} + +static Ecore_X_Randr_Crtc +_ecore_xcb_randr_13_output_crtc_get(Ecore_X_Window root, + Ecore_X_Randr_Output output) +{ + Ecore_X_Randr_Crtc ret = Ecore_X_Randr_None; + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(root); + if (reply) + { + xcb_randr_get_output_info_cookie_t ocookie; + xcb_randr_get_output_info_reply_t *oreply; + + ocookie = + xcb_randr_get_output_info_unchecked(_ecore_xcb_conn, output, + reply->config_timestamp); + oreply = xcb_randr_get_output_info_reply(_ecore_xcb_conn, + ocookie, NULL); + if (oreply) + { + ret = oreply->crtc; + free(oreply); + } + free(reply); + } + return ret; +} + +static xcb_randr_get_screen_resources_reply_t * +_ecore_xcb_randr_12_get_resources(Ecore_X_Window win) +{ + xcb_randr_get_screen_resources_cookie_t cookie; + xcb_randr_get_screen_resources_reply_t *reply; + + cookie = xcb_randr_get_screen_resources_unchecked(_ecore_xcb_conn, win); + reply = xcb_randr_get_screen_resources_reply(_ecore_xcb_conn, cookie, NULL); + return reply; +} + +static xcb_randr_get_screen_resources_current_reply_t * +_ecore_xcb_randr_13_get_resources(Ecore_X_Window win) +{ + xcb_randr_get_screen_resources_current_cookie_t cookie; + xcb_randr_get_screen_resources_current_reply_t *reply; + + cookie = + xcb_randr_get_screen_resources_current_unchecked(_ecore_xcb_conn, win); + reply = + xcb_randr_get_screen_resources_current_reply(_ecore_xcb_conn, + cookie, NULL); + return reply; +} + +static xcb_timestamp_t +_ecore_xcb_randr_12_get_resource_timestamp(Ecore_X_Window win) +{ + xcb_timestamp_t stamp = 0; + xcb_randr_get_screen_resources_reply_t *reply; + + reply = _ecore_xcb_randr_12_get_resources(win); + stamp = reply->config_timestamp; + free(reply); + return stamp; +} + +static xcb_timestamp_t +_ecore_xcb_randr_13_get_resource_timestamp(Ecore_X_Window win) +{ + xcb_timestamp_t stamp = 0; + xcb_randr_get_screen_resources_current_reply_t *reply; + + reply = _ecore_xcb_randr_13_get_resources(win); + stamp = reply->config_timestamp; + free(reply); + return stamp; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_region.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_region.c new file mode 100644 index 0000000..a221d8f --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_region.c @@ -0,0 +1,159 @@ +#include "ecore_xcb_private.h" +#include + +/* + * [ ] XPolygonRegion + * [ ] XShrinkRegion + * [ ] XClipBox + * [ ] XXorRegion + */ + +EAPI Ecore_X_XRegion * +ecore_x_xregion_new() +{ + pixman_region16_t *region; + + region = (pixman_region16_t *)malloc(sizeof(pixman_region16_t)); + if (!region) return NULL; + + pixman_region_init(region); + + return (Ecore_X_XRegion *)region; +} + +EAPI void +ecore_x_xregion_free(Ecore_X_XRegion *region) +{ + if (!region) return; + + pixman_region_fini(region); + free(region); +} + +EAPI Eina_Bool +ecore_x_xregion_set(Ecore_X_XRegion *region, + Ecore_X_GC gc) +{ + xcb_rectangle_t *rects; + pixman_box16_t *boxes; + int num = 0, i = 0; + + CHECK_XCB_CONN; + + if (!region) return EINA_FALSE; + + boxes = pixman_region_rectangles((pixman_region16_t *)region, &num); + if ((!boxes) || (num == 0)) return EINA_FALSE; + + rects = (xcb_rectangle_t *)malloc(sizeof(xcb_rectangle_t) * num); + if (!rects) return EINA_FALSE; + + for (i = 0; i < num; i++) + { + rects[i].x = boxes[i].x1; + rects[i].y = boxes[i].y1; + rects[i].width = boxes[i].x2 - boxes[i].x1 + 1; + rects[i].height = boxes[i].y2 - boxes[i].y1 + 1; + } + + xcb_set_clip_rectangles(_ecore_xcb_conn, XCB_CLIP_ORDERING_YX_BANDED, + gc, 0, 0, num, rects); + +// ecore_x_flush(); + return EINA_TRUE; +} + +EAPI void +ecore_x_xregion_translate(Ecore_X_XRegion *region, + int x, + int y) +{ + if (!region) return; + + pixman_region_translate((pixman_region16_t *)region, x, y); +} + +EAPI Eina_Bool +ecore_x_xregion_intersect(Ecore_X_XRegion *dst, + Ecore_X_XRegion *r1, + Ecore_X_XRegion *r2) +{ + return pixman_region_intersect((pixman_region16_t *)dst, + (pixman_region16_t *)r1, + (pixman_region16_t *)r2); +} + +EAPI Eina_Bool +ecore_x_xregion_union(Ecore_X_XRegion *dst, + Ecore_X_XRegion *r1, + Ecore_X_XRegion *r2) +{ + return pixman_region_union((pixman_region16_t *)dst, + (pixman_region16_t *)r1, + (pixman_region16_t *)r2); +} + +EAPI Eina_Bool +ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, + Ecore_X_XRegion *src, + Ecore_X_Rectangle *rect) +{ + return pixman_region_union_rect((pixman_region16_t *)dst, + (pixman_region16_t *)src, + rect->x, rect->y, rect->width, rect->height); +} + +EAPI Eina_Bool +ecore_x_xregion_subtract(Ecore_X_XRegion *dst, + Ecore_X_XRegion *rm, + Ecore_X_XRegion *rs) +{ + return pixman_region_subtract((pixman_region16_t *)dst, + (pixman_region16_t *)rm, + (pixman_region16_t *)rs); +} + +EAPI Eina_Bool +ecore_x_xregion_is_empty(Ecore_X_XRegion *region) +{ + if (!region) return EINA_TRUE; + + return !pixman_region_not_empty((pixman_region16_t *)region); +} + +EAPI Eina_Bool +ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, + Ecore_X_XRegion *r2) +{ + if ((!r1) || (!r2)) return EINA_FALSE; + + return pixman_region_equal((pixman_region16_t *)r1, + (pixman_region16_t *)r2); +} + +EAPI Eina_Bool +ecore_x_xregion_point_contain(Ecore_X_XRegion *region, + int x, + int y) +{ + if (!region) return EINA_FALSE; + + return pixman_region_contains_point((pixman_region16_t *)region, x, y, NULL); +} + +EAPI Eina_Bool +ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, + Ecore_X_Rectangle *rect) +{ + pixman_box16_t box; + + if ((!region) || (!rect)) return EINA_FALSE; + + box.x1 = rect->x; + box.y1 = rect->y; + box.x2 = rect->x + rect->width - 1; + box.y2 = rect->y + rect->height - 1; + + return pixman_region_contains_rectangle((pixman_region16_t *)region, &box); +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_render.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_render.c new file mode 100644 index 0000000..f36b4d2 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_render.c @@ -0,0 +1,225 @@ +#include "ecore_xcb_private.h" +#include // for isupper/tolower +#ifdef ECORE_XCB_RENDER +# include +# include +#endif + +/* local function prototypes */ +static Eina_Bool _ecore_xcb_render_parse_boolean(char *v); + +/* local variables */ +static Eina_Bool _render_avail = EINA_FALSE; +static Eina_Bool _render_argb = EINA_FALSE; +static Eina_Bool _render_anim = EINA_FALSE; + +void +_ecore_xcb_render_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_RENDER + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_render_id); +#endif +} + +void +_ecore_xcb_render_finalize(void) +{ +#ifdef ECORE_XCB_RENDER + const xcb_query_extension_reply_t *ext_reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_RENDER + ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_render_id); + if ((ext_reply) && (ext_reply->present)) + { + xcb_render_query_version_cookie_t cookie; + xcb_render_query_version_reply_t *reply; + + cookie = + xcb_render_query_version_unchecked(_ecore_xcb_conn, + XCB_RENDER_MAJOR_VERSION, + XCB_RENDER_MINOR_VERSION); + reply = xcb_render_query_version_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { +// if ((reply->major_version >= XCB_RENDER_MAJOR_VERSION) && + if (reply->minor_version >= XCB_RENDER_MINOR_VERSION) + { + char *v = NULL; + + _render_avail = EINA_TRUE; + _ecore_xcb_xdefaults_init(); + if ((reply->major_version > 0) || (reply->minor_version >= 5)) + { + _render_argb = EINA_TRUE; + v = getenv("XCURSOR_CORE"); + if (!v) + v = _ecore_xcb_xdefaults_string_get("Xcursor", "core"); + if ((v) && (_ecore_xcb_render_parse_boolean(v))) + _render_argb = EINA_FALSE; + } + if ((_render_argb) && + ((reply->major_version > 0) || (reply->minor_version >= 8))) + { + _render_anim = EINA_TRUE; + v = getenv("XCURSOR_ANIM"); + if (!v) + v = _ecore_xcb_xdefaults_string_get("Xcursor", "anim"); + if ((v) && (_ecore_xcb_render_parse_boolean(v))) + _render_anim = EINA_FALSE; + } + _ecore_xcb_xdefaults_shutdown(); + } + } + free(reply); + } +#endif +} + +Eina_Bool +_ecore_xcb_render_avail_get(void) +{ + return _render_avail; +} + +Eina_Bool +_ecore_xcb_render_argb_get(void) +{ + return _render_argb; +} + +Eina_Bool +_ecore_xcb_render_anim_get(void) +{ + return _render_anim; +} + +Eina_Bool +_ecore_xcb_render_visual_supports_alpha(Ecore_X_Visual visual) +{ + Eina_Bool ret = EINA_FALSE; +#ifdef ECORE_XCB_RENDER + const xcb_render_query_pict_formats_reply_t *reply; + xcb_render_pictvisual_t *vis; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!visual) return EINA_FALSE; + if (!_render_avail) return EINA_FALSE; + +#ifdef ECORE_XCB_RENDER + reply = xcb_render_util_query_formats(_ecore_xcb_conn); + if (!reply) return EINA_FALSE; + + vis = + xcb_render_util_find_visual_format(reply, + ((xcb_visualtype_t *)visual)->visual_id); + if (vis) + { + xcb_render_pictforminfo_t temp; + xcb_render_pictforminfo_t *format; + + temp.id = vis->format; + format = + xcb_render_util_find_format(reply, XCB_PICT_FORMAT_ID, &temp, 0); + + if ((format->type == XCB_RENDER_PICT_TYPE_DIRECT) && + (format->direct.alpha_mask)) + ret = EINA_TRUE; + } + +#endif + + return ret; +} + +uint32_t +_ecore_xcb_render_find_visual_id(int type, + Eina_Bool check_alpha) +{ +#ifdef ECORE_XCB_RENDER + const xcb_render_query_pict_formats_reply_t *reply; + xcb_render_pictvisual_t *visual = NULL; + xcb_render_pictscreen_iterator_t screens; + xcb_render_pictdepth_iterator_t depths; + xcb_render_pictvisual_iterator_t visuals; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_render_avail) return 0; + +#ifdef ECORE_XCB_RENDER + reply = xcb_render_util_query_formats(_ecore_xcb_conn); + if (!reply) return 0; + + for (screens = xcb_render_query_pict_formats_screens_iterator(reply); + screens.rem; xcb_render_pictscreen_next(&screens)) + { + for (depths = xcb_render_pictscreen_depths_iterator(screens.data); + depths.rem; xcb_render_pictdepth_next(&depths)) + { + for (visuals = xcb_render_pictdepth_visuals_iterator(depths.data); + visuals.rem; xcb_render_pictvisual_next(&visuals)) + { + xcb_render_pictforminfo_t temp; + xcb_render_pictforminfo_t *format; + + visual = visuals.data; + temp.id = visual->format; + + format = + xcb_render_util_find_format(reply, XCB_PICT_FORMAT_ID, + &temp, 0); + if (!format) continue; + if (format->type == type) + { + if (check_alpha) + { + if (format->direct.alpha_mask) + return visual->visual; + } + else + return visual->visual; + } + } + } + } +#endif + + return 0; +} + +/* local function prototypes */ +static Eina_Bool +_ecore_xcb_render_parse_boolean(char *v) +{ + char c; + + c = *v; + if (isupper((int)c)) + c = tolower(c); + if ((c == 't') || (c == 'y') || (c == '1')) + return EINA_TRUE; + if ((c == 'f') || (c == 'n') || (c == '0')) + return EINA_FALSE; + if (c == 'o') + { + char d; + + d = v[1]; + if (isupper((int)d)) + d = tolower(d); + if (d == 'n') return EINA_TRUE; + if (d == 'f') return EINA_FALSE; + } + return EINA_FALSE; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c new file mode 100644 index 0000000..cb7249f --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_screensaver.c @@ -0,0 +1,338 @@ +#include "ecore_xcb_private.h" +# ifdef ECORE_XCB_SCREENSAVER +# include +# endif + +/* local variables */ +static Eina_Bool _screensaver_avail = EINA_FALSE; + +/* external variables */ +int _ecore_xcb_event_screensaver = -1; + +void +_ecore_xcb_screensaver_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_SCREENSAVER + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_screensaver_id); +#endif +} + +void +_ecore_xcb_screensaver_finalize(void) +{ +#ifdef ECORE_XCB_SCREENSAVER + const xcb_query_extension_reply_t *ext_reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_SCREENSAVER + ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_screensaver_id); + if ((ext_reply) && (ext_reply->present)) + { + xcb_screensaver_query_version_cookie_t cookie; + xcb_screensaver_query_version_reply_t *reply; + + cookie = + xcb_screensaver_query_version_unchecked(_ecore_xcb_conn, + XCB_SCREENSAVER_MAJOR_VERSION, + XCB_SCREENSAVER_MINOR_VERSION); + reply = + xcb_screensaver_query_version_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + if ((reply->server_major_version >= XCB_SCREENSAVER_MAJOR_VERSION) && + (reply->server_minor_version >= XCB_SCREENSAVER_MINOR_VERSION)) + _screensaver_avail = EINA_TRUE; + + free(reply); + } + + if (_screensaver_avail) + _ecore_xcb_event_screensaver = ext_reply->first_event; + } +#endif +} + +EAPI int +ecore_x_screensaver_idle_time_get(void) +{ + int ret = 0; +#ifdef ECORE_XCB_SCREENSAVER + xcb_screensaver_query_info_cookie_t cookie; + xcb_screensaver_query_info_reply_t *reply; + Ecore_X_Window root; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_screensaver_avail) return 0; + +#ifdef ECORE_XCB_SCREENSAVER + root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + cookie = xcb_screensaver_query_info_unchecked(_ecore_xcb_conn, root); + reply = xcb_screensaver_query_info_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return 0; + ret = (reply->ms_until_server / 1000); + free(reply); +#endif + + return ret; +} + +EAPI void +ecore_x_screensaver_set(int timeout, + int interval, + int prefer_blanking, + int allow_exposures) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_screensaver_avail) return; + +#ifdef ECORE_XCB_SCREENSAVER + xcb_set_screen_saver(_ecore_xcb_conn, + timeout, interval, prefer_blanking, allow_exposures); +#endif +} + +EAPI void +ecore_x_screensaver_timeout_set(int timeout) +{ +#ifdef ECORE_XCB_SCREENSAVER + xcb_get_screen_saver_cookie_t cookie; + xcb_get_screen_saver_reply_t *reply; + uint16_t pint; + uint8_t pblank, pexpo; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_screensaver_avail) return; + +#ifdef ECORE_XCB_SCREENSAVER + cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); + reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return; + pint = reply->interval; + pblank = reply->prefer_blanking; + pexpo = reply->allow_exposures; + free(reply); + xcb_set_screen_saver(_ecore_xcb_conn, timeout, pint, pblank, pexpo); +#endif +} + +EAPI int +ecore_x_screensaver_timeout_get(void) +{ + int timeout = 0; +#ifdef ECORE_XCB_SCREENSAVER + xcb_get_screen_saver_cookie_t cookie; + xcb_get_screen_saver_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_screensaver_avail) return 0; + +#ifdef ECORE_XCB_SCREENSAVER + cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); + reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return 0; + timeout = reply->timeout; + free(reply); +#endif + + return timeout; +} + +EAPI void +ecore_x_screensaver_blank_set(int blank) +{ +#ifdef ECORE_XCB_SCREENSAVER + xcb_get_screen_saver_cookie_t cookie; + xcb_get_screen_saver_reply_t *reply; + uint16_t pint, pto; + uint8_t pexpo; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_screensaver_avail) return; + +#ifdef ECORE_XCB_SCREENSAVER + cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); + reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return; + pto = reply->timeout; + pint = reply->interval; + pexpo = reply->allow_exposures; + free(reply); + xcb_set_screen_saver(_ecore_xcb_conn, pto, pint, blank, pexpo); +#endif +} + +EAPI int +ecore_x_screensaver_blank_get(void) +{ + int blank = 0; +#ifdef ECORE_XCB_SCREENSAVER + xcb_get_screen_saver_cookie_t cookie; + xcb_get_screen_saver_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_screensaver_avail) return 0; + +#ifdef ECORE_XCB_SCREENSAVER + cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); + reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return 0; + blank = reply->prefer_blanking; + free(reply); +#endif + + return blank; +} + +EAPI void +ecore_x_screensaver_expose_set(int expose) +{ +#ifdef ECORE_XCB_SCREENSAVER + xcb_get_screen_saver_cookie_t cookie; + xcb_get_screen_saver_reply_t *reply; + uint16_t pint, pto; + uint8_t pblank; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_screensaver_avail) return; + +#ifdef ECORE_XCB_SCREENSAVER + cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); + reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return; + pto = reply->timeout; + pint = reply->interval; + pblank = reply->prefer_blanking; + free(reply); + xcb_set_screen_saver(_ecore_xcb_conn, pto, pint, pblank, expose); +#endif +} + +EAPI int +ecore_x_screensaver_expose_get(void) +{ + int expose = 0; +#ifdef ECORE_XCB_SCREENSAVER + xcb_get_screen_saver_cookie_t cookie; + xcb_get_screen_saver_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_screensaver_avail) return 0; + +#ifdef ECORE_XCB_SCREENSAVER + cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); + reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return 0; + expose = reply->allow_exposures; + free(reply); +#endif + + return expose; +} + +EAPI void +ecore_x_screensaver_interval_set(int interval) +{ +#ifdef ECORE_XCB_SCREENSAVER + xcb_get_screen_saver_cookie_t cookie; + xcb_get_screen_saver_reply_t *reply; + uint16_t pto; + uint8_t pblank, pexpose; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_screensaver_avail) return; + +#ifdef ECORE_XCB_SCREENSAVER + cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); + reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return; + pto = reply->timeout; + pblank = reply->prefer_blanking; + pexpose = reply->allow_exposures; + free(reply); + xcb_set_screen_saver(_ecore_xcb_conn, pto, interval, pblank, pexpose); +#endif +} + +EAPI int +ecore_x_screensaver_interval_get(void) +{ + int interval = 0; +#ifdef ECORE_XCB_SCREENSAVER + xcb_get_screen_saver_cookie_t cookie; + xcb_get_screen_saver_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_screensaver_avail) return 0; + +#ifdef ECORE_XCB_SCREENSAVER + cookie = xcb_get_screen_saver_unchecked(_ecore_xcb_conn); + reply = xcb_get_screen_saver_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return 0; + interval = reply->interval; + free(reply); +#endif + + return interval; +} + +EAPI void +ecore_x_screensaver_event_listen_set(Eina_Bool on) +{ +#ifdef ECORE_XCB_SCREENSAVER + Ecore_X_Window root; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_screensaver_avail) return; + +#ifdef ECORE_XCB_SCREENSAVER + root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + if (on) + xcb_screensaver_select_input(_ecore_xcb_conn, root, + XCB_SCREENSAVER_EVENT_NOTIFY_MASK); + else + xcb_screensaver_select_input(_ecore_xcb_conn, root, 0); +#endif +} + +EAPI Eina_Bool +ecore_x_screensaver_event_available_get(void) +{ + return _screensaver_avail; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_selection.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_selection.c new file mode 100644 index 0000000..7b994bd --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_selection.c @@ -0,0 +1,1039 @@ +#include "ecore_xcb_private.h" +//#include "Ecore_X_Atoms.h" + +#define ECORE_XCB_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x)) + +/* local function prototypes */ +static Eina_Bool _ecore_xcb_selection_converter_text(char *target, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *type, + int *size_type); +static void *_ecore_xcb_selection_parser_text(const char *target __UNUSED__, + void *data, + int size, + int format __UNUSED__); +static void *_ecore_xcb_selection_parser_files(const char *target, + void *data, + int size, + int format __UNUSED__); +static void *_ecore_xcb_selection_parser_targets(const char *target __UNUSED__, + void *data, + int size, + int format __UNUSED__); + +//static int _ecore_xcb_selection_data_free(void *data); +static int _ecore_xcb_selection_data_text_free(void *data); +static int _ecore_xcb_selection_data_targets_free(void *data); +static int _ecore_xcb_selection_data_files_free(void *data); +static int _ecore_xcb_selection_data_default_free(void *data); +static Eina_Bool _ecore_xcb_selection_set(Ecore_X_Window win, + const void *data, + int size, + Ecore_X_Atom selection); +static void _ecore_xcb_selection_request(Ecore_X_Window win, + Ecore_X_Atom selection, + const char *target); +static Ecore_X_Atom _ecore_xcb_selection_target_atom_get(const char *target); + +/* local variables */ +static Ecore_X_Selection_Intern _selections[4]; +static Ecore_X_Selection_Converter *_converters = NULL; +static Ecore_X_Selection_Parser *_parsers = NULL; + +/* local functions */ +void +_ecore_xcb_selection_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + memset(_selections, 0, sizeof(_selections)); + + /* init converters */ + ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT, + _ecore_xcb_selection_converter_text); + ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING, + _ecore_xcb_selection_converter_text); + ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT, + _ecore_xcb_selection_converter_text); + ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING, + _ecore_xcb_selection_converter_text); + + /* init parsers */ + ecore_x_selection_parser_add("text/plain", + _ecore_xcb_selection_parser_text); + ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING, + _ecore_xcb_selection_parser_text); + ecore_x_selection_parser_add("text/uri-list", + _ecore_xcb_selection_parser_files); + ecore_x_selection_parser_add("_NETSCAPE_URL", + _ecore_xcb_selection_parser_files); + ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS, + _ecore_xcb_selection_parser_targets); +} + +void +_ecore_xcb_selection_shutdown(void) +{ + Ecore_X_Selection_Converter *cnv; + Ecore_X_Selection_Parser *prs; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + /* free selection converters */ + cnv = _converters; + while (cnv) + { + Ecore_X_Selection_Converter *tmp; + + tmp = cnv->next; + free(cnv); + cnv = tmp; + } + _converters = NULL; + + /* free parsers */ + prs = _parsers; + while (prs) + { + Ecore_X_Selection_Parser *tmp; + + tmp = prs; + prs = prs->next; + free(tmp->target); + free(tmp); + } + _parsers = NULL; +} + +/* public functions */ +EAPI void +ecore_x_selection_converter_atom_add(Ecore_X_Atom target, + Eina_Bool (*func)(char *target, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *type, + int *size_type)) +{ + Ecore_X_Selection_Converter *cnv; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + cnv = _converters; + if (_converters) + { + while (1) + { + if (cnv->target == target) + { + cnv->convert = func; + return; + } + if (cnv->next) + cnv = cnv->next; + else + break; + } + cnv->next = calloc(1, sizeof(Ecore_X_Selection_Converter)); + if (!cnv->next) return; + cnv = cnv->next; + } + else + { + _converters = calloc(1, sizeof(Ecore_X_Selection_Converter)); + if (!_converters) return; + cnv = _converters; + } + cnv->target = target; + cnv->convert = func; +} + +EAPI void +ecore_x_selection_converter_add(char *target, + Eina_Bool (*func)(char *target, + void *data, + int size, + void **date_ret, + int *size_ret, + Ecore_X_Atom *atom_ret, + int *ret)) +{ + Ecore_X_Atom atarget; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if ((!func) || (!target)) return; + atarget = _ecore_xcb_selection_target_atom_get(target); + ecore_x_selection_converter_atom_add(atarget, func); +} + +EAPI void +ecore_x_selection_converter_del(char *target) +{ + Ecore_X_Atom atarget; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!target) return; + atarget = _ecore_xcb_selection_target_atom_get(target); + ecore_x_selection_converter_atom_del(atarget); +} + +EAPI void +ecore_x_selection_converter_atom_del(Ecore_X_Atom target) +{ + Ecore_X_Selection_Converter *conv, *pconv = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + conv = _converters; + while (conv) + { + if (conv->target == target) + { + if (pconv) + pconv->next = conv->next; + else + _converters = conv->next; + free(conv); + return; + } + pconv = conv; + conv = conv->next; + } +} + +EAPI void +ecore_x_selection_parser_add(const char *target, + void *(*func)(const char *target, void *data, int size, int format)) +{ + Ecore_X_Selection_Parser *prs; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!target) return; + prs = _parsers; + if (prs) + { + while (prs->next) + { + if (!strcmp(prs->target, target)) + { + prs->parse = func; + return; + } + prs = prs->next; + } + prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser)); + prs = prs->next; + } + else + { + _parsers = calloc(1, sizeof(Ecore_X_Selection_Parser)); + prs = _parsers; + } + prs->target = strdup(target); + prs->parse = func; +} + +EAPI void +ecore_x_selection_parser_del(const char *target) +{ + Ecore_X_Selection_Parser *prs, *pprs = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!target) return; + + prs = _parsers; + while (prs) + { + if (!strcmp(prs->target, target)) + { + if (pprs) + pprs->next = prs->next; + else + _parsers = prs->next; + free(prs->target); + free(prs); + return; + } + pprs = prs; + prs = prs->next; + } +} + +/** + * Claim ownership of the PRIMARY selection and set its data. + * @param w The window to which this selection belongs + * @param data The data associated with the selection + * @param size The size of the data buffer in bytes + * @return Returns 1 if the ownership of the selection was successfully + * claimed, or 0 if unsuccessful. + */ +EAPI Eina_Bool +ecore_x_selection_primary_set(Ecore_X_Window win, + const void *data, + int size) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_selection_set(win, data, size, + ECORE_X_ATOM_SELECTION_PRIMARY); +} + +/** + * Release ownership of the primary selection + * @return Returns 1 if the selection was successfully cleared, + * or 0 if unsuccessful. + */ +EAPI Eina_Bool +ecore_x_selection_primary_clear(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_selection_set(XCB_NONE, NULL, 0, + ECORE_X_ATOM_SELECTION_PRIMARY); +} + +EAPI void +ecore_x_selection_primary_request(Ecore_X_Window win, + const char *target) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_PRIMARY, target); +} + +/** + * Claim ownership of the SECONDARY selection and set its data. + * @param w The window to which this selection belongs + * @param data The data associated with the selection + * @param size The size of the data buffer in bytes + * @return Returns 1 if the ownership of the selection was successfully + * claimed, or 0 if unsuccessful. + */ +EAPI Eina_Bool +ecore_x_selection_secondary_set(Ecore_X_Window win, + const void *data, + int size) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_selection_set(win, data, size, + ECORE_X_ATOM_SELECTION_SECONDARY); +} + +/** + * Release ownership of the secondary selection + * @return Returns 1 if the selection was successfully cleared, + * or 0 if unsuccessful. + */ +EAPI Eina_Bool +ecore_x_selection_secondary_clear(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_selection_set(XCB_NONE, NULL, 0, + ECORE_X_ATOM_SELECTION_SECONDARY); +} + +EAPI void +ecore_x_selection_secondary_request(Ecore_X_Window win, + const char *target) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_SECONDARY, target); +} + +/** + * Claim ownership of the XDND selection and set its data. + * @param w The window to which this selection belongs + * @param data The data associated with the selection + * @param size The size of the data buffer in bytes + * @return Returns 1 if the ownership of the selection was successfully + * claimed, or 0 if unsuccessful. + */ +EAPI Eina_Bool +ecore_x_selection_xdnd_set(Ecore_X_Window win, + const void *data, + int size) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_selection_set(win, data, size, + ECORE_X_ATOM_SELECTION_XDND); +} + +/** + * Release ownership of the XDND selection + * @return Returns 1 if the selection was successfully cleared, + * or 0 if unsuccessful. + */ +EAPI Eina_Bool +ecore_x_selection_xdnd_clear(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_selection_set(XCB_NONE, NULL, 0, + ECORE_X_ATOM_SELECTION_XDND); +} + +EAPI void +ecore_x_selection_xdnd_request(Ecore_X_Window win, + const char *target) +{ + Ecore_X_Atom atom; + Ecore_X_DND_Target *_target; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + _target = _ecore_xcb_dnd_target_get(); + atom = _ecore_xcb_selection_target_atom_get(target); + + xcb_convert_selection(_ecore_xcb_conn, win, ECORE_X_ATOM_SELECTION_XDND, + atom, ECORE_X_ATOM_SELECTION_PROP_XDND, _target->time); +} + +/** + * Claim ownership of the CLIPBOARD selection and set its data. + * @param w The window to which this selection belongs + * @param data The data associated with the selection + * @param size The size of the data buffer in bytes + * @return Returns 1 if the ownership of the selection was successfully + * claimed, or 0 if unsuccessful. + * + * Get the converted data from a previous CLIPBOARD selection + * request. The buffer must be freed when done with. + */ +EAPI Eina_Bool +ecore_x_selection_clipboard_set(Ecore_X_Window win, + const void *data, + int size) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_selection_set(win, data, size, + ECORE_X_ATOM_SELECTION_CLIPBOARD); +} + +/** + * Release ownership of the clipboard selection + * @return Returns 1 if the selection was successfully cleared, + * or 0 if unsuccessful. + */ +EAPI Eina_Bool +ecore_x_selection_clipboard_clear(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_selection_set(XCB_NONE, NULL, 0, + ECORE_X_ATOM_SELECTION_CLIPBOARD); +} + +EAPI void +ecore_x_selection_clipboard_request(Ecore_X_Window win, + const char *target) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_CLIPBOARD, target); +} + +EAPI Eina_Bool +ecore_x_selection_convert(Ecore_X_Atom selection, + Ecore_X_Atom target, + void **data_ret, + int *size, + Ecore_X_Atom *targtype, + int *typesize) +{ + Ecore_X_Selection_Intern *sel; + Ecore_X_Selection_Converter *cnv; + void *data; + char *tgt_str; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + sel = _ecore_xcb_selection_get(selection); + tgt_str = _ecore_xcb_selection_target_get(target); + + for (cnv = _converters; cnv; cnv = cnv->next) + { + if (cnv->target == target) + { + int r = 0; + + r = cnv->convert(tgt_str, sel->data, sel->length, &data, size, + targtype, typesize); + free(tgt_str); + if (r) + { + if (data_ret) *data_ret = data; + return r; + } + else + return EINA_FALSE; + } + } + + return EINA_FALSE; +} + +EAPI Eina_Bool +ecore_x_selection_notify_send(Ecore_X_Window requestor, + Ecore_X_Atom selection, + Ecore_X_Atom target, + Ecore_X_Atom property, + Ecore_X_Time tim) +{ + xcb_selection_notify_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + memset(&ev, 0, sizeof(xcb_selection_notify_event_t)); + + ev.response_type = XCB_SELECTION_NOTIFY; + ev.requestor = requestor; + ev.selection = selection; + ev.target = target; + ev.property = property; + ev.time = tim; + + xcb_send_event(_ecore_xcb_conn, 0, requestor, + XCB_EVENT_MASK_NO_EVENT, (const char *)&ev); +// ecore_x_flush(); + + return EINA_TRUE; +} + +EAPI void +ecore_x_selection_owner_set(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Time tim) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_set_selection_owner(_ecore_xcb_conn, win, atom, tim); +} + +EAPI Ecore_X_Window +ecore_x_selection_owner_get(Ecore_X_Atom atom) +{ + xcb_get_selection_owner_cookie_t cookie; + xcb_get_selection_owner_reply_t *reply; + Ecore_X_Window ret; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = xcb_get_selection_owner(_ecore_xcb_conn, atom); + reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return 0; + ret = reply->owner; + free(reply); + return ret; +} + +void * +_ecore_xcb_selection_parse(const char *target, + void *data, + int size, + int format) +{ + Ecore_X_Selection_Parser *prs; + Ecore_X_Selection_Data *sel; + + for (prs = _parsers; prs; prs = prs->next) + { + if (!strcmp(prs->target, target)) + { + sel = prs->parse(target, data, size, format); + if (sel) return sel; + } + } + + sel = calloc(1, sizeof(Ecore_X_Selection_Data)); + if (!sel) return NULL; + sel->free = _ecore_xcb_selection_data_default_free; + sel->length = size; + sel->format = format; + sel->data = data; + + return sel; +} + +Ecore_X_Selection_Intern * +_ecore_xcb_selection_get(Ecore_X_Atom selection) +{ + if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) + return &_selections[0]; + else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) + return &_selections[1]; + else if (selection == ECORE_X_ATOM_SELECTION_XDND) + return &_selections[2]; + else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) + return &_selections[3]; + else + return NULL; +} + +/* local functions */ +static Eina_Bool +_ecore_xcb_selection_set(Ecore_X_Window win, + const void *data, + int size, + Ecore_X_Atom selection) +{ + xcb_get_selection_owner_cookie_t cookie; + xcb_get_selection_owner_reply_t *reply; + int in = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_set_selection_owner(_ecore_xcb_conn, win, selection, XCB_CURRENT_TIME); + + cookie = xcb_get_selection_owner(_ecore_xcb_conn, selection); + reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + + if (reply->owner != win) + { + free(reply); + return EINA_FALSE; + } + free(reply); + + if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) + in = 0; + else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) + in = 1; + else if (selection == ECORE_X_ATOM_SELECTION_XDND) + in = 2; + else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) + in = 3; + else + return EINA_FALSE; + + if (data) + { + unsigned char *buff = NULL; + + _selections[in].win = win; + _selections[in].selection = selection; + _selections[in].length = size; + _selections[in].time = _ecore_xcb_events_last_time_get(); + + buff = malloc(size); + if (!buff) return EINA_FALSE; + memcpy(buff, data, size); + _selections[in].data = buff; + } + else if (_selections[in].data) + { + free(_selections[in].data); + memset(&_selections[in], 0, sizeof(Ecore_X_Selection_Data)); + } + + return EINA_TRUE; +} + +static void +_ecore_xcb_selection_request(Ecore_X_Window win, + Ecore_X_Atom selection, + const char *target) +{ + Ecore_X_Atom atarget, prop; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) + prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY; + else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) + prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY; + else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) + prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD; + else + return; + + atarget = _ecore_xcb_selection_target_atom_get(target); + + xcb_convert_selection(_ecore_xcb_conn, win, selection, atarget, prop, + XCB_CURRENT_TIME); +} + +static Eina_Bool +_ecore_xcb_selection_converter_text(char *target, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *type __UNUSED__, + int *size_type __UNUSED__) +{ + Ecore_Xcb_Encoding_Style style; + Ecore_Xcb_Textproperty ret; + char *str; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if ((!data) || (!size)) return EINA_FALSE; + + if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT)) + style = XcbTextStyle; + else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT)) + style = XcbCompoundTextStyle; + else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING)) + style = XcbStringStyle; + else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING)) + style = XcbUTF8StringStyle; + else + return EINA_FALSE; + + str = alloca(size + 1); + memcpy(str, data, size); + str[size] = '\0'; + +#ifdef HAVE_ICONV + if (_ecore_xcb_utf8_textlist_to_textproperty(&str, 1, style, &ret)) + { + int size = 0; + + size = (strlen((char *)ret.value) + 1); + *data_ret = malloc(size); + if (!*data_ret) return EINA_FALSE; + memcpy(*data_ret, ret.value, size); + *size_ret = size; + if (ret.value) free(ret.value); + return EINA_TRUE; + } +#else + if (_ecore_xcb_mb_textlist_to_textproperty(&str, 1, style, &ret)) + { + int size = 0; + + size = (strlen((char *)ret.value) + 1); + *data_ret = malloc(size); + if (!*data_ret) return EINA_FALSE; + memcpy(*data_ret, ret.value, size); + *size_ret = size; + if (ret.value) free(ret.value); + return EINA_TRUE; + } +#endif + else + return EINA_TRUE; + + return EINA_FALSE; +} + +static void * +_ecore_xcb_selection_parser_text(const char *target __UNUSED__, + void *data, + int size, + int format __UNUSED__) +{ + Ecore_X_Selection_Data_Text *sel; + unsigned char *_data; + void *t; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(_data = data)) return NULL; + + sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text)); + if (!sel) return NULL; + + if (_data[size - 1]) + { + size++; + t = realloc(_data, size); + if (!t) + { + free(sel); + return NULL; + } + _data = t; + _data[size - 1] = 0; + } + sel->text = (char *)_data; + ECORE_XCB_SELECTION_DATA(sel)->length = size; + ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TEXT; + ECORE_XCB_SELECTION_DATA(sel)->data = _data; + ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_text_free; + return sel; +} + +static void * +_ecore_xcb_selection_parser_files(const char *target, + void *data, + int size, + int format __UNUSED__) +{ + Ecore_X_Selection_Data_Files *sel; + char *_data, *tmp, *t, **t2; + int i = 0, is = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if ((strcmp(target, "text/uri-list")) && + (strcmp(target, "_NETSCAPE_URL"))) return NULL; + + if (!(_data = data)) return NULL; + + sel = calloc(1, sizeof(Ecore_X_Selection_Data_Files)); + if (!sel) return NULL; + + ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_files_free; + + if (_data[size - 1]) + { + size++; + t = realloc(_data, size); + if (!t) + { + free(sel); + return NULL; + } + _data = t; + _data[size - 1] = 0; + } + + tmp = malloc(size); + if (!tmp) + { + free(sel); + return NULL; + } + + while ((is < size) && (_data[is])) + { + if ((i == 0) && (_data[is] == '#')) + { + for (; ((_data[is]) && (_data[is] != '\n')); is++) ; + } + else + { + if ((_data[is] != '\r') && (_data[is] != '\n')) + tmp[i++] = _data[is++]; + else + { + while ((_data[is] == '\r') || (_data[is] == '\n')) + is++; + tmp[i] = 0; + sel->num_files++; + t2 = realloc(sel->files, sel->num_files * sizeof(char *)); + if (t2) + { + sel->files = t2; + sel->files[sel->num_files - 1] = strdup(tmp); + } + tmp[0] = 0; + i = 0; + } + } + } + if (i > 0) + { + tmp[i] = 0; + sel->num_files++; + t2 = realloc(sel->files, sel->num_files * sizeof(char *)); + if (t2) + { + sel->files = t2; + sel->files[sel->num_files - 1] = strdup(tmp); + } + } + if (tmp) free(tmp); + if (_data) free(_data); + + ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_FILES; + ECORE_XCB_SELECTION_DATA(sel)->length = sel->num_files; + + return ECORE_XCB_SELECTION_DATA(sel); +} + +static void * +_ecore_xcb_selection_parser_targets(const char *target __UNUSED__, + void *data, + int size, + int format __UNUSED__) +{ + Ecore_X_Selection_Data_Targets *sel; + unsigned long *targets; + int i = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!(targets = (unsigned long *)data)) return NULL; + + sel = calloc(1, sizeof(Ecore_X_Selection_Data_Targets)); + if (!sel) return NULL; + + sel->num_targets = (size - 2); + sel->targets = malloc((size - 2) * sizeof(char *)); + if (!sel->targets) + { + free(sel); + return NULL; + } + + for (i = 2; i < size; i++) + { + xcb_get_atom_name_cookie_t cookie; + xcb_get_atom_name_reply_t *reply; + char *name = NULL; + int len = 0; + + cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, targets[i]); + reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + len = xcb_get_atom_name_name_length(reply); + name = (char *)malloc(sizeof(char) * (len + 1)); + if (name) + { + memcpy(name, xcb_get_atom_name_name(reply), len); + name[len] = '\0'; + sel->targets[i - 2] = name; + } + free(reply); + } + } + + ECORE_XCB_SELECTION_DATA(sel)->free = + _ecore_xcb_selection_data_targets_free; + ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TARGETS; + ECORE_XCB_SELECTION_DATA(sel)->length = size; + ECORE_XCB_SELECTION_DATA(sel)->data = data; + + return sel; +} + +/* + static int + _ecore_xcb_selection_data_free(void *data) + { + Ecore_X_Selection_Data *sel; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sel = data)) return 0; + if (sel->data) free(sel->data); + free(sel); + return 1; + } + */ + +static int +_ecore_xcb_selection_data_text_free(void *data) +{ + Ecore_X_Selection_Data_Text *sel; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sel = data)) return 0; + if (sel->text) free(sel->text); + free(sel); + return 1; +} + +static int +_ecore_xcb_selection_data_targets_free(void *data) +{ + Ecore_X_Selection_Data_Targets *sel; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sel = data)) return 0; + if (sel->targets) + { + int i = 0; + + for (i = 0; i < sel->num_targets; i++) + if (sel->targets[i]) free(sel->targets[i]); + if (sel->targets) free(sel->targets); + } + free(sel); + return 1; +} + +static int +_ecore_xcb_selection_data_files_free(void *data) +{ + Ecore_X_Selection_Data_Files *sel; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!(sel = data)) return 0; + if (sel->files) + { + int i = 0; + + for (i = 0; i < sel->num_files; i++) + if (sel->files[i]) free(sel->files[i]); + if (sel->files) free(sel->files); + } + free(sel); + return 0; +} + +static int +_ecore_xcb_selection_data_default_free(void *data) +{ + Ecore_X_Selection_Data *sel; + + if (!(sel = data)) return 1; + free(sel->data); + free(sel); + return 1; +} + +static Ecore_X_Atom +_ecore_xcb_selection_target_atom_get(const char *target) +{ + Ecore_X_Atom x_target; + + if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT)) + x_target = ECORE_X_ATOM_TEXT; + else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT)) + x_target = ECORE_X_ATOM_COMPOUND_TEXT; + else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING)) + x_target = ECORE_X_ATOM_STRING; + else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING)) + x_target = ECORE_X_ATOM_UTF8_STRING; + else if (!strcmp(target, ECORE_X_SELECTION_TARGET_FILENAME)) + x_target = ECORE_X_ATOM_FILE_NAME; + else + x_target = ecore_x_atom_get(target); + + return x_target; +} + +char * +_ecore_xcb_selection_target_get(Ecore_X_Atom target) +{ + if (target == ECORE_X_ATOM_FILE_NAME) + return strdup(ECORE_X_SELECTION_TARGET_FILENAME); + else if (target == ECORE_X_ATOM_STRING) + return strdup(ECORE_X_SELECTION_TARGET_STRING); + else if (target == ECORE_X_ATOM_UTF8_STRING) + return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING); + else if (target == ECORE_X_ATOM_TEXT) + return strdup(ECORE_X_SELECTION_TARGET_TEXT); + else + return ecore_x_atom_name_get(target); +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_shape.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_shape.c new file mode 100644 index 0000000..913f199 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_shape.c @@ -0,0 +1,50 @@ +#include "ecore_xcb_private.h" +#ifdef ECORE_XCB_SHAPE +# include +#endif + +/* external variables */ +int _ecore_xcb_event_shape = -1; + +void +_ecore_xcb_shape_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_SHAPE + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_shape_id); +#endif +} + +void +_ecore_xcb_shape_finalize(void) +{ +#ifdef ECORE_XCB_SHAPE + const xcb_query_extension_reply_t *ext_reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_SHAPE + ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_shape_id); + if ((ext_reply) && (ext_reply->present)) + { + xcb_shape_query_version_cookie_t cookie; + xcb_shape_query_version_reply_t *reply; + Eina_Bool _shape_avail; + + _shape_avail = EINA_FALSE; + cookie = xcb_shape_query_version_unchecked(_ecore_xcb_conn); + reply = xcb_shape_query_version_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + _shape_avail = EINA_TRUE; + free(reply); + } + + if (_shape_avail) + _ecore_xcb_event_shape = ext_reply->first_event; + } +#endif +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_sync.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_sync.c new file mode 100644 index 0000000..75f4e4f --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_sync.c @@ -0,0 +1,338 @@ +#include "ecore_xcb_private.h" +# ifdef ECORE_XCB_SYNC +# include +# endif + +/* local variables */ +static Eina_Bool _sync_avail = EINA_FALSE; + +/* external variables */ +int _ecore_xcb_event_sync = -1; + +void +_ecore_xcb_sync_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_SYNC + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_sync_id); +#endif +} + +void +_ecore_xcb_sync_finalize(void) +{ +#ifdef ECORE_XCB_SYNC + const xcb_query_extension_reply_t *ext_reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_SYNC + ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_sync_id); + if ((ext_reply) && (ext_reply->present)) + { + xcb_sync_initialize_cookie_t cookie; + xcb_sync_initialize_reply_t *reply; + + cookie = + xcb_sync_initialize_unchecked(_ecore_xcb_conn, + XCB_SYNC_MAJOR_VERSION, + XCB_SYNC_MINOR_VERSION); + reply = xcb_sync_initialize_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + if (reply->major_version >= 3) _sync_avail = EINA_TRUE; + free(reply); + } + + if (_sync_avail) + _ecore_xcb_event_sync = ext_reply->first_event; + } +#endif +} + +void +_ecore_xcb_sync_magic_send(int val, + Ecore_X_Window win) +{ + xcb_client_message_event_t ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + memset(&ev, 0, sizeof(xcb_client_message_event_t)); + ev.response_type = XCB_CLIENT_MESSAGE; + ev.format = 32; + ev.window = win; + ev.type = 27777; + ev.data.data32[0] = 0x7162534; + ev.data.data32[1] = (0x10000000 + val); + ev.data.data32[2] = win; + + xcb_send_event(_ecore_xcb_conn, 0, win, XCB_EVENT_MASK_NO_EVENT, + (const char *)&ev); +// ecore_x_flush(); +} + +/* public functions */ +EAPI Ecore_X_Sync_Alarm +ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter) +{ +#ifdef ECORE_XCB_SYNC + uint32_t list[6], mask; + xcb_sync_int64_t init; + Ecore_X_Sync_Alarm alarm; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if ((!_sync_avail) || (!counter)) return 0; + +#ifdef ECORE_XCB_SYNC + init.lo = 0; + init.hi = 0; + xcb_sync_set_counter(_ecore_xcb_conn, counter, init); + + mask = (XCB_SYNC_CA_COUNTER | XCB_SYNC_CA_VALUE_TYPE | + XCB_SYNC_CA_VALUE | XCB_SYNC_CA_TEST_TYPE | + XCB_SYNC_CA_DELTA | XCB_SYNC_CA_EVENTS); + list[0] = counter; + list[1] = XCB_SYNC_VALUETYPE_ABSOLUTE; + list[2] = 1; + list[3] = XCB_SYNC_TESTTYPE_POSITIVE_COMPARISON; + list[4] = 1; + list[5] = 1; + alarm = xcb_generate_id(_ecore_xcb_conn); + + xcb_sync_create_alarm(_ecore_xcb_conn, alarm, mask, list); + ecore_x_sync(); // needed + + return alarm; +#endif + return 0; +} + +EAPI Eina_Bool +ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if ((!_sync_avail) || (!alarm)) return EINA_FALSE; + +#ifdef ECORE_XCB_SYNC + xcb_sync_destroy_alarm(_ecore_xcb_conn, alarm); +// ecore_x_flush(); + return EINA_TRUE; +#endif + + return EINA_FALSE; +} + +EAPI Eina_Bool +ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, + unsigned int *val) +{ +#ifdef ECORE_XCB_SYNC + xcb_sync_query_counter_cookie_t cookie; + xcb_sync_query_counter_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if ((!_sync_avail) || (!counter)) return EINA_FALSE; + +#ifdef ECORE_XCB_SYNC + cookie = xcb_sync_query_counter_unchecked(_ecore_xcb_conn, counter); + reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + if (val) *val = (unsigned int)reply->counter_value.lo; + free(reply); + return EINA_TRUE; + } +#endif + return EINA_FALSE; +} + +EAPI void +ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, + int by) +{ +#ifdef ECORE_XCB_SYNC + xcb_sync_int64_t v; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if ((!_sync_avail) || (!counter)) return; + +#ifdef ECORE_XCB_SYNC + v.hi = (by < 0) ? ~0 : 0; + v.lo = by; + + xcb_sync_change_counter(_ecore_xcb_conn, counter, v); +// ecore_x_flush(); +#endif +} + +EAPI void +ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, + int val) +{ +#ifdef ECORE_XCB_SYNC + xcb_sync_query_counter_cookie_t cookie; + xcb_sync_query_counter_reply_t *reply; + xcb_sync_int64_t v1, v2; + xcb_sync_waitcondition_t cond; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if ((!_sync_avail) || (!counter)) return; + +#ifdef ECORE_XCB_SYNC + cookie = xcb_sync_query_counter_unchecked(_ecore_xcb_conn, counter); + reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return; + v1 = reply->counter_value; + free(reply); + + v1.hi = (val < 0) ? ~0 : 0; + v1.lo = val; + v2.hi = ((val + 1) < 0) ? ~0 : 0; + v2.lo = (val + 1); + + cond.trigger.counter = counter; + cond.trigger.wait_type = XCB_SYNC_VALUETYPE_ABSOLUTE; + cond.trigger.wait_value = v1; + cond.trigger.test_type = XCB_SYNC_TESTTYPE_POSITIVE_COMPARISON; + cond.event_threshold = v2; + + xcb_sync_await(_ecore_xcb_conn, 1, &cond); +// ecore_x_flush(); +#endif +} + +EAPI Ecore_X_Sync_Counter +ecore_x_sync_counter_new(int val) +{ +#ifdef ECORE_XCB_SYNC + xcb_sync_counter_t counter; + xcb_sync_int64_t v; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_sync_avail) return 0; + +#ifdef ECORE_XCB_SYNC + v.hi = (val < 0) ? ~0 : 0; + v.lo = val; + + counter = xcb_generate_id(_ecore_xcb_conn); + xcb_sync_create_counter(_ecore_xcb_conn, counter, v); +// ecore_x_flush(); + + return counter; +#endif + + return 0; +} + +EAPI void +ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if ((!_sync_avail) || (!counter)) return; + +#ifdef ECORE_XCB_SYNC + xcb_sync_destroy_counter(_ecore_xcb_conn, counter); +// ecore_x_flush(); +#endif +} + +EAPI void +ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter, + int val) +{ +#ifdef ECORE_XCB_SYNC + xcb_sync_int64_t v; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if ((!_sync_avail) || (!counter)) return; + +#ifdef ECORE_XCB_SYNC + v.hi = (val < 0) ? ~0 : 0; + v.lo = val; + + xcb_sync_set_counter(_ecore_xcb_conn, counter, v); +// ecore_x_flush(); +#endif +} + +EAPI void +ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter, + int val_hi, + unsigned int val_lo) +{ +#ifdef ECORE_XCB_SYNC + xcb_sync_int64_t v; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if ((!_sync_avail) || (!counter)) return; + +#ifdef ECORE_XCB_SYNC + v.hi = val_hi; + v.lo = val_lo; + + xcb_sync_set_counter(_ecore_xcb_conn, counter, v); +// ecore_x_flush(); +#endif +} + +EAPI Eina_Bool +ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter, + int *val_hi, + unsigned int *val_lo) +{ +#ifdef ECORE_XCB_SYNC + xcb_sync_query_counter_cookie_t cookie; + xcb_sync_query_counter_reply_t *reply; + xcb_sync_int64_t value; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if ((!_sync_avail) || (!counter)) return EINA_FALSE; + +#ifdef ECORE_XCB_SYNC + cookie = + xcb_sync_query_counter_unchecked(_ecore_xcb_conn, + (xcb_sync_counter_t)counter); + reply = xcb_sync_query_counter_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + value = reply->counter_value; + free(reply); + if (val_hi) *val_hi = (int)value.hi; + if (val_lo) *val_lo = (unsigned int)value.lo; + return EINA_TRUE; +#endif + + return EINA_FALSE; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_textlist.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_textlist.c new file mode 100644 index 0000000..2a5c854 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_textlist.c @@ -0,0 +1,509 @@ +#include "ecore_xcb_private.h" +//#include "Ecore_X_Atoms.h" +#include +#ifdef HAVE_ICONV +# include +#endif +#ifndef CODESET +# define CODESET "INVALID" +#endif + +static int _ecore_xcb_textlist_get_buffer_size(Eina_Bool is_wide, + void *list, + int count); +static int _ecore_xcb_textlist_get_wc_len(wchar_t *wstr); +static void *_ecore_xcb_textlist_alloc_list(Eina_Bool is_wide, + int count, + int nitems); +static void _ecore_xcb_textlist_copy_list(Eina_Bool is_wide, + void *text, + char **list, + int count); +static wchar_t *_ecore_xcb_textlist_copy_wchar(wchar_t *str1, + wchar_t *str2); +static int _ecore_xcb_textlist_len_wchar(wchar_t *str); + +#ifdef HAVE_ICONV +Eina_Bool +_ecore_xcb_utf8_textlist_to_textproperty(char **list, + int count, + Ecore_Xcb_Encoding_Style style, + Ecore_Xcb_Textproperty *ret) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_textlist_to_textproperty("utf8string", list, count, + style, ret); +} + +#endif + +Eina_Bool +_ecore_xcb_mb_textlist_to_textproperty(char **list, + int count, + Ecore_Xcb_Encoding_Style style, + Ecore_Xcb_Textproperty *ret) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_textlist_to_textproperty("multiByte", list, count, + style, ret); +} + +/* NB: This Function May Not Be Correct !!! + * (as I do not know text conversion, locales, etc, etc very well) + * + * Portions were ripped from libX11 XTextListToTextProperty + */ +Eina_Bool +_ecore_xcb_textlist_to_textproperty(const char *type, + char **list, + int count, + Ecore_Xcb_Encoding_Style style, + Ecore_Xcb_Textproperty *ret) +{ + Eina_Bool is_wide = EINA_FALSE; + Ecore_X_Atom encoding; + int len = 0, nitems = 0, i = 0; + size_t from_left = 0, to_left = 0; + int unconv_num = 0, val = 0; + char *buff, *to, *value, *from; + const char *to_type, *from_type; + char **mb = NULL; + wchar_t **wc = NULL; +#ifdef HAVE_ICONV + iconv_t conv; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!strcmp("wideChar", type)) is_wide = EINA_TRUE; + len = _ecore_xcb_textlist_get_buffer_size(is_wide, list, count); + if (!(buff = (char *)malloc(len * sizeof(char)))) return EINA_FALSE; + from_type = nl_langinfo(CODESET); + switch (style) + { + case XcbStringStyle: + case XcbStdICCTextStyle: + encoding = ECORE_X_ATOM_STRING; + to_type = nl_langinfo(CODESET); +// to_type = "string"; + break; + + case XcbUTF8StringStyle: + encoding = ECORE_X_ATOM_UTF8_STRING; + to_type = "UTF-8"; + break; + + case XcbCompoundTextStyle: + encoding = ECORE_X_ATOM_COMPOUND_TEXT; + to_type = nl_langinfo(CODESET); +// to_type = "compoundText"; + break; + + case XcbTextStyle: + encoding = ECORE_X_ATOM_TEXT; + to_type = nl_langinfo(CODESET); +// to_type = "multiByte"; + if (!is_wide) + { + nitems = 0; + mb = (char **)list; + to = buff; + for (i = 0; ((i < count) && (len > 0)); i++) + { + if (*mb) strcpy(to, *mb); + else *to = '\0'; + from_left = (*mb ? strlen(*mb) : 0) + 1; + nitems += from_left; + to += from_left; + mb++; + } + unconv_num = 0; + goto done; + } + break; + + default: + free(buff); + return EINA_FALSE; + break; + } + + if (count < 1) + { + nitems = 0; + goto done; + } + +retry: +#ifdef HAVE_ICONV + conv = iconv_open(to_type, from_type); +#endif + + if (is_wide) + wc = (wchar_t **)list; + else + mb = (char **)list; + + to = buff; + to_left = len; + unconv_num = 0; + for (i = 1; to_left > 0; i++) + { + if (is_wide) + { + from = (char *)*wc; + from_left = _ecore_xcb_textlist_get_wc_len(*wc); + wc++; + } + else + { + from = *mb; + from_left = (*mb ? strlen(*mb) : 0); + mb++; + } + +#ifdef HAVE_ICONV + val = iconv(conv, &from, &from_left, &to, &to_left); +#endif + if (val < 0) continue; + if ((val > 0) && (style == XcbStdICCTextStyle) && + (encoding == ECORE_X_ATOM_STRING)) + { +#ifdef HAVE_ICONV + iconv_close(conv); +#endif + encoding = ECORE_X_ATOM_COMPOUND_TEXT; + goto retry; + } + + unconv_num += val; + *to++ = '\0'; + to_left--; + if (i >= count) break; + } + +#ifdef HAVE_ICONV + iconv_close(conv); +#endif + nitems = (to - buff); + +done: + if (nitems <= 0) nitems = 1; + if (!(value = (char *)malloc(nitems * sizeof(char)))) + { + free(buff); + return EINA_FALSE; + } + if (nitems == 1) + *value = 0; + else + memcpy(value, buff, nitems); + nitems--; + free(buff); + + ret->value = value; + ret->encoding = encoding; + ret->format = 8; + ret->nitems = nitems; + + return EINA_TRUE; +} + +#ifdef HAVE_ICONV +Eina_Bool +_ecore_xcb_utf8_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, + char ***list_ret, + int *count_ret) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_textproperty_to_textlist(text_prop, "utf8String", + list_ret, count_ret); +} + +#endif + +Eina_Bool +_ecore_xcb_mb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, + char ***list_ret, + int *count_ret) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return _ecore_xcb_textproperty_to_textlist(text_prop, "multiByte", + list_ret, count_ret); +} + +Eina_Bool +_ecore_xcb_textproperty_to_textlist(const Ecore_Xcb_Textproperty *text_prop, + const char *type, + char ***list_ret, + int *count_ret) +{ + Eina_Bool is_wide = EINA_FALSE; + Eina_Bool do_strcpy = EINA_FALSE; + const char *from_type; + char *buff, *to, *from; + char *lptr, *sptr; + int nitems = 0, len = 0, num = 0, ret = 0; + size_t from_left = 0, to_left = 0; +#ifdef HAVE_ICONV + iconv_t conv = 0; +#endif + + *list_ret = NULL; + *count_ret = 0; + if (!strcmp("wideChar", type)) is_wide = EINA_TRUE; + + nitems = text_prop->nitems; + if (nitems <= 0) return EINA_TRUE; + + if (text_prop->format != 8) return EINA_FALSE; + + from_type = nl_langinfo(CODESET); + if (text_prop->encoding == ECORE_X_ATOM_UTF8_STRING) + from_type = "UTF-8"; + + if (is_wide) + len = (text_prop->nitems + 1) * sizeof(wchar_t); + else + { + if (!strcmp(type, "utf8String")) + len = text_prop->nitems * 6 + 1; + else + len = text_prop->nitems * MB_CUR_MAX + 1; + } + + buff = (char *)malloc(len * sizeof(char)); + if (!buff) return EINA_FALSE; + + to = buff; + to_left = len; + + if (!strcmp(from_type, type)) + do_strcpy = EINA_TRUE; + else + { +#ifdef HAVE_ICONV + conv = iconv_open(type, from_type); +#endif + if (!conv) + { + free(buff); + return EINA_FALSE; + } + } + + lptr = sptr = text_prop->value; + num = *count_ret = 0; + while (1) + { + if ((nitems == 0) || (*sptr == 0)) + { + from = lptr; + from_left = sptr - lptr; + lptr = sptr; + if (do_strcpy) + { + int l = 0; + + l = MIN(from_left, to_left); + strncpy(to, from, l); + from += len; + to += len; + from_left -= l; + to_left -= l; + ret = 0; + } + else + ret = iconv(conv, &from, &from_left, &to, &to_left); + + if (ret < 0) continue; + num += ret; + (*count_ret)++; + if (nitems == 0) break; + lptr = ++sptr; + if (is_wide) + { + *((wchar_t *)to) = (wchar_t)0; + to += sizeof(wchar_t); + to_left -= sizeof(wchar_t); + } + else + { + *((char *)to) = '\0'; + to++; + to_left--; + } + } + else + sptr++; + + nitems--; + } + +#if HAVE_ICONV + if (!do_strcpy) iconv_close(conv); +#endif + + if (is_wide) + { + *((wchar_t *)to) = (wchar_t)0; + to_left -= sizeof(wchar_t); + } + else + { + *((char *)to) = '\0'; + to_left--; + } + + *list_ret = + _ecore_xcb_textlist_alloc_list(is_wide, *count_ret, (len - to_left)); + if (*list_ret) + _ecore_xcb_textlist_copy_list(is_wide, buff, *list_ret, *count_ret); + + free(buff); + + return EINA_TRUE; +} + +static int +_ecore_xcb_textlist_get_buffer_size(Eina_Bool is_wide, + void *list, + int count) +{ + int len = 0; + char **mb; + wchar_t **wc; + + if (!list) return 0; + if (is_wide) + { + wc = (wchar_t **)list; + for (; count-- > 0; wc++) + if (*wc) len += _ecore_xcb_textlist_get_wc_len(*wc) + 1; + len *= 5; + } + else + { + mb = (char **)list; + for (; count-- > 0; mb++) + if (*mb) len += strlen(*mb) + 1; + len *= 3; + } + len = (len / 2048 + 1) * 2048; + return len; +} + +static int +_ecore_xcb_textlist_get_wc_len(wchar_t *wstr) +{ + wchar_t *ptr; + + ptr = wstr; + while (*ptr) + ptr++; + + return ptr - wstr; +} + +static void * +_ecore_xcb_textlist_alloc_list(Eina_Bool is_wide, + int count, + int nitems) +{ + if (is_wide) + { + wchar_t **list; + + list = (wchar_t **)malloc(count * sizeof(wchar_t *)); + if (!list) return NULL; + *list = (wchar_t *)malloc(nitems * sizeof(wchar_t)); + if (!*list) + { + free(list); + return NULL; + } + return *list; + } + else + { + char **list; + + list = (char **)malloc(count * sizeof(char *)); + if (!list) return NULL; + *list = (char *)malloc(nitems * sizeof(char)); + if (!*list) + { + free(list); + return NULL; + } + return *list; + } +} + +static void +_ecore_xcb_textlist_copy_list(Eina_Bool is_wide, + void *text, + char **list, + int count) +{ + int len = 0; + + if (is_wide) + { + wchar_t *txt, *str, **wlist; + + txt = (wchar_t *)text; + wlist = (wchar_t **)list; + for (str = *wlist; count > 0; count--, wlist++) + { + _ecore_xcb_textlist_copy_wchar(str, txt); + *wlist = str; + len = (_ecore_xcb_textlist_len_wchar(str) + 1); + str += len; + txt += len; + } + } + else + { + char *txt, *str, **slist; + + txt = (char *)text; + slist = (char **)list; + for (str = *slist; count > 0; count--, slist++) + { + strcpy(str, txt); + *slist = str; + len = strlen(str) + 1; + str += len; + txt += len; + } + } +} + +static wchar_t * +_ecore_xcb_textlist_copy_wchar(wchar_t *str1, + wchar_t *str2) +{ + wchar_t *tmp; + + tmp = str1; + while ((*str1++ = *str2++)) + ; + return tmp; +} + +static int +_ecore_xcb_textlist_len_wchar(wchar_t *str) +{ + wchar_t *ptr; + + ptr = str; + while (*ptr) + ptr++; + return ptr - str; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_vsync.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_vsync.c new file mode 100644 index 0000000..47efefc --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_vsync.c @@ -0,0 +1,375 @@ +#include "ecore_xcb_private.h" +# include +# include +# include + +#define ECORE_XCB_VSYNC_DRI2 1 +#define DRM_EVENT_CONTEXT_VERSION 2 + +#ifdef ECORE_XCB_VSYNC_DRI2 + +/* relevant header bits of dri/drm inlined here to avoid needing external */ +/* headers to build drm */ +typedef unsigned int drm_magic_t; + +typedef enum +{ + DRM_VBLANK_ABSOLUTE = 0x00000000, + DRM_VBLANK_RELATIVE = 0x00000001, + DRM_VBLANK_EVENT = 0x04000000, + DRM_VBLANK_FLIP = 0x08000000, + DRM_VBLANK_NEXTONMISS = 0x10000000, + DRM_VBLANK_SECONDARY = 0x20000000, + DRM_VBLANK_SIGNAL = 0x40000000 +} drmVBlankSeqType; + +typedef struct _drmVBlankReq +{ + drmVBlankSeqType type; + unsigned int sequence; + unsigned long signal; +} drmVBlankReq; + +typedef struct _drmVBlankReply +{ + drmVBlankSeqType type; + unsigned int sequence; + long tval_sec, tval_usec; +} drmVBlankReply; + +typedef union _drmVBlank +{ + drmVBlankReq request; + drmVBlankReply reply; +} drmVBlank; + +typedef struct _drmEventContext +{ + int version; + void (*vblank_handler)(int fd, + unsigned int sequence, + unsigned int tv_sec, + unsigned int tv_usec, + void *user_data); + void (*page_flip_handler)(int fd, + unsigned int sequence, + unsigned int tv_sec, + unsigned int tv_usec, + void *user_data); +} drmEventContext; + +static int (*sym_drmClose)(int fd) = NULL; +static int (*sym_drmGetMagic)(int fd, + drm_magic_t *magic) = NULL; +static int (*sym_drmWaitVBlank)(int fd, + drmVBlank *vbl) = NULL; +static int (*sym_drmHandleEvent)(int fd, + drmEventContext *evctx) = NULL; + +/* dri */ +static Bool (*sym_DRI2QueryExtension)(Display *display, + int *eventBase, + int *errorBase) = NULL; +static Bool (*sym_DRI2QueryVersion)(Display *display, + int *major, + int *minor) = NULL; +static Bool (*sym_DRI2Connect)(Display *display, + XID window, + char **driverName, + char **deviceName) = NULL; +static Bool (*sym_DRI2Authenticate)(Display *display, + XID window, + drm_magic_t magic) = NULL; + +/* local function prototypes */ +static Eina_Bool _ecore_xcb_dri_link(void); +static Eina_Bool _ecore_xcb_dri_start(void); +static void _ecore_xcb_dri_shutdown(void); + +static Eina_Bool _ecore_xcb_dri_cb(void *data __UNUSED__, + Ecore_Fd_Handler *fdh __UNUSED__); +static void _ecore_xcb_dri_tick_begin(void *data __UNUSED__); +static void _ecore_xcb_dri_tick_end(void *data __UNUSED__); +static void _ecore_xcb_dri_tick_schedule(void); +static void _ecore_xcb_dri_vblank_handler(int fd __UNUSED__, + unsigned int frame __UNUSED__, + unsigned int sec __UNUSED__, + unsigned int usec __UNUSED__, + void *data __UNUSED__); + +/* local variables */ +static Ecore_X_Window _vsync_root = 0; +static int _drm_fd = -1; +static Ecore_Fd_Handler *_drm_fdh = NULL; +static unsigned int _drm_magic = 0; +static Eina_Bool _drm_event_busy = EINA_FALSE; +static void *_drm_lib = NULL; +static void *_dri_lib = NULL; +static drmEventContext _drm_evctx; +#endif + +void +_ecore_xcb_dri_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); +} + +void +_ecore_xcb_dri_finalize(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); +} + +EAPI Eina_Bool +ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win) +{ +#ifdef ECORE_XCB_VSYNC_DRI2 + Ecore_X_Window root; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_VSYNC_DRI2 + root = ecore_x_window_root_get(win); + if (root != _vsync_root) + { + _vsync_root = root; + if (_vsync_root) + { + if (!_ecore_xcb_dri_link()) + { + ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); + return EINA_FALSE; + } + _ecore_xcb_dri_shutdown(); + if (!_ecore_xcb_dri_start()) + { + _vsync_root = 0; + ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); + return EINA_FALSE; + } + ecore_animator_custom_source_tick_begin_callback_set + (_ecore_xcb_dri_tick_begin, NULL); + ecore_animator_custom_source_tick_end_callback_set + (_ecore_xcb_dri_tick_end, NULL); + ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM); + } + else + { + if (_drm_fd >= 0) + { + _ecore_xcb_dri_shutdown(); + ecore_animator_custom_source_tick_begin_callback_set + (NULL, NULL); + ecore_animator_custom_source_tick_end_callback_set + (NULL, NULL); + ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); + } + } + } + return EINA_TRUE; +#else + return EINA_FALSE; + win = 0; +#endif +} + +/* local functions */ +#ifdef ECORE_XCB_VSYNC_DRI2 +static Eina_Bool +_ecore_xcb_dri_link(void) +{ + const char *_drm_libs[] = + { + "libdrm.so.2", + "libdrm.so.1", + "libdrm.so.0", + "libdrm.so", + NULL, + }; + const char *_dri_libs[] = + { + "libdri2.so.2", + "libdri2.so.1", + "libdri2.so.0", + "libdri2.so", + "libGL.so.4", + "libGL.so.3", + "libGL.so.2", + "libGL.so.1", + "libGL.so.0", + "libGL.so", + NULL, + }; + int i = 0, fail = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +# define SYM(lib, xx) \ + do { \ + sym_## xx = dlsym(lib, #xx); \ + if (!(sym_## xx)) { \ + fprintf(stderr, "%s\n", dlerror()); \ + fail = 1; \ + } \ + } while (0); + + if (_drm_lib) return EINA_TRUE; + + for (i = 0; _drm_libs[i]; i++) + { + _drm_lib = dlopen(_drm_libs[i], (RTLD_LOCAL | RTLD_LAZY)); + if (_drm_lib) + { + fail = 0; + SYM(_drm_lib, drmClose); + SYM(_drm_lib, drmGetMagic); + SYM(_drm_lib, drmWaitVBlank); + SYM(_drm_lib, drmHandleEvent); + if (fail) + { + dlclose(_drm_lib); + _drm_lib = NULL; + } + else + break; + } + } + if (!_drm_lib) return EINA_FALSE; + for (i = 0; _dri_libs[i]; i++) + { + if ((_dri_lib = dlopen(_dri_libs[i], (RTLD_LOCAL | RTLD_LAZY)))) + { + fail = 0; + SYM(_dri_lib, DRI2QueryExtension); + SYM(_dri_lib, DRI2QueryVersion); + SYM(_dri_lib, DRI2Connect); + SYM(_dri_lib, DRI2Authenticate); + if (fail) + { + dlclose(_dri_lib); + _dri_lib = NULL; + } + else + break; + } + } + if (!_dri_lib) + { + dlclose(_drm_lib); + _drm_lib = NULL; + return EINA_FALSE; + } + + return EINA_TRUE; +} + +static Eina_Bool +_ecore_xcb_dri_start(void) +{ + Ecore_X_Display *disp; + int _dri2_event = 0, _dri2_error = 0; + int _dri2_major = 0, _dri2_minor = 0; + char *device = NULL, *driver = NULL; + + disp = ecore_x_display_get(); + if (!sym_DRI2QueryExtension(disp, &_dri2_event, &_dri2_error)) + return 0; + if (!sym_DRI2QueryVersion(disp, &_dri2_major, &_dri2_minor)) + return 0; + if (_dri2_major < 2) return 0; + if (!sym_DRI2Connect(disp, _vsync_root, &driver, &device)) + return 0; + + _drm_fd = open(device, O_RDWR); + if (_drm_fd < 0) return 0; + + sym_drmGetMagic(_drm_fd, &_drm_magic); + if (!sym_DRI2Authenticate(disp, _vsync_root, _drm_magic)) + { + close(_drm_fd); + _drm_fd = -1; + return EINA_FALSE; + } + + memset(&_drm_evctx, 0, sizeof(_drm_evctx)); + _drm_evctx.version = DRM_EVENT_CONTEXT_VERSION; + _drm_evctx.vblank_handler = _ecore_xcb_dri_vblank_handler; + _drm_evctx.page_flip_handler = NULL; + + _drm_fdh = ecore_main_fd_handler_add(_drm_fd, ECORE_FD_READ, + _ecore_xcb_dri_cb, NULL, NULL, NULL); + if (!_drm_fdh) + { + close(_drm_fd); + _drm_fd = -1; + return EINA_FALSE; + } + + return EINA_TRUE; +} + +static void +_ecore_xcb_dri_shutdown(void) +{ + if (_drm_fd >= 0) + { + close(_drm_fd); + _drm_fd = -1; + } + if (_drm_fdh) + { + ecore_main_fd_handler_del(_drm_fdh); + _drm_fdh = NULL; + } +} + +static Eina_Bool +_ecore_xcb_dri_cb(void *data __UNUSED__, + Ecore_Fd_Handler *fdh __UNUSED__) +{ + sym_drmHandleEvent(_drm_fd, &_drm_evctx); + return ECORE_CALLBACK_RENEW; +} + +static void +_ecore_xcb_dri_tick_begin(void *data __UNUSED__) +{ + _drm_event_busy = EINA_TRUE; + _ecore_xcb_dri_tick_schedule(); +} + +static void +_ecore_xcb_dri_tick_end(void *data __UNUSED__) +{ + _drm_event_busy = EINA_FALSE; +} + +static void +_ecore_xcb_dri_tick_schedule(void) +{ + drmVBlank vbl; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + vbl.request.type = (DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT); + vbl.request.sequence = 1; + vbl.request.signal = 0; + + sym_drmWaitVBlank(_drm_fd, &vbl); +} + +static void +_ecore_xcb_dri_vblank_handler(int fd __UNUSED__, + unsigned int frame __UNUSED__, + unsigned int sec __UNUSED__, + unsigned int usec __UNUSED__, + void *data __UNUSED__) +{ + ecore_animator_custom_tick(); + if (_drm_event_busy) _ecore_xcb_dri_tick_schedule(); +} + +#endif diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window.c new file mode 100644 index 0000000..2616c93 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window.c @@ -0,0 +1,2233 @@ +#include "ecore_xcb_private.h" +#ifdef ECORE_XCB_RENDER +# include +#endif +#ifdef ECORE_XCB_SHAPE +# include +#endif +#ifdef ECORE_XCB_XPRINT +#include +#endif + +/* local function prototypes */ +static Ecore_X_Window _ecore_xcb_window_argb_internal_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h, + uint8_t override_redirect, + uint8_t save_under); +static Ecore_X_Window _ecore_xcb_window_at_xy_get(Ecore_X_Window base, + int bx, + int by, + int x, + int y, + Ecore_X_Window *skip, + int skip_num); +static int _ecore_xcb_window_modifiers_get(unsigned int state); +static xcb_visualtype_t *_ecore_xcb_window_find_visual_by_id(xcb_visualid_t id); +#ifdef ECORE_XCB_XPRINT +static xcb_screen_t *_ecore_xcb_window_screen_of_display(int screen); +#endif + +/* local variables */ +static int ignore_num = 0; +static Ecore_X_Window *ignore_list = NULL; + +/* external variables */ +int _ecore_xcb_button_grabs_num = 0; +int _ecore_xcb_key_grabs_num = 0; +Ecore_X_Window *_ecore_xcb_button_grabs = NULL; +Ecore_X_Window *_ecore_xcb_key_grabs = NULL; +Eina_Bool (*_ecore_xcb_window_grab_replay_func)(void *data, + int type, + void *event); +void *_ecore_xcb_window_grab_replay_data; + +/** + * @defgroup Ecore_X_Window_Create_Group X Window Creation Functions + * + * Functions that can be used to create an X window. + */ + +/** + * Creates a new window. + * @param parent The parent window to use. If @p parent is @c 0, the root + * window of the default display is used. + * @param x X position. + * @param y Y position. + * @param w Width. + * @param h Height. + * @return The new window handle. + * @ingroup Ecore_X_Window_Create_Group + */ +EAPI Ecore_X_Window +ecore_x_window_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h) +{ + Ecore_X_Window win; + uint32_t mask, mask_list[9]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (parent == 0) + parent = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + /* NB: Order here is very important due to xcb_cw_t enum */ + mask = (XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY | + XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | + XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | + XCB_CW_DONT_PROPAGATE); + + mask_list[0] = XCB_BACK_PIXMAP_NONE; + mask_list[1] = 0; + mask_list[2] = XCB_GRAVITY_NORTH_WEST; + mask_list[3] = XCB_GRAVITY_NORTH_WEST; + mask_list[4] = XCB_BACKING_STORE_NOT_USEFUL; + mask_list[5] = 0; + mask_list[6] = 0; + mask_list[7] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | + XCB_EVENT_MASK_BUTTON_PRESS | + XCB_EVENT_MASK_BUTTON_RELEASE | + XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | + XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE | + XCB_EVENT_MASK_VISIBILITY_CHANGE | + XCB_EVENT_MASK_STRUCTURE_NOTIFY | + XCB_EVENT_MASK_FOCUS_CHANGE | + XCB_EVENT_MASK_PROPERTY_CHANGE | + XCB_EVENT_MASK_COLOR_MAP_CHANGE); + mask_list[8] = XCB_EVENT_MASK_NO_EVENT; + + win = xcb_generate_id(_ecore_xcb_conn); + xcb_create_window(_ecore_xcb_conn, XCB_COPY_FROM_PARENT, + win, parent, x, y, w, h, 0, + XCB_WINDOW_CLASS_INPUT_OUTPUT, + XCB_COPY_FROM_PARENT, mask, mask_list); + + if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root) + ecore_x_window_defaults_set(win); + + return win; +} + +/** + * Creates a window with the override redirect attribute set to @c True. + * @param parent The parent window to use. If @p parent is @c 0, the root + * window of the default display is used. + * @param x X position. + * @param y Y position. + * @param w Width. + * @param h Height. + * @return The new window handle. + * @ingroup Ecore_X_Window_Create_Group + */ +EAPI Ecore_X_Window +ecore_x_window_override_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h) +{ + Ecore_X_Window win; + uint32_t mask, mask_list[9]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (parent == 0) + parent = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + /* NB: Order here is very important due to xcb_cw_t enum */ + mask = (XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY | + XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | + XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER | XCB_CW_EVENT_MASK | + XCB_CW_DONT_PROPAGATE); + + mask_list[0] = XCB_BACK_PIXMAP_NONE; + mask_list[1] = 0; + mask_list[2] = XCB_GRAVITY_NORTH_WEST; + mask_list[3] = XCB_GRAVITY_NORTH_WEST; + mask_list[4] = XCB_BACKING_STORE_NOT_USEFUL; + mask_list[5] = 1; + mask_list[6] = 0; + mask_list[7] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | + XCB_EVENT_MASK_BUTTON_PRESS | + XCB_EVENT_MASK_BUTTON_RELEASE | + XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | + XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE | + XCB_EVENT_MASK_VISIBILITY_CHANGE | + XCB_EVENT_MASK_STRUCTURE_NOTIFY | + XCB_EVENT_MASK_FOCUS_CHANGE | + XCB_EVENT_MASK_PROPERTY_CHANGE | + XCB_EVENT_MASK_COLOR_MAP_CHANGE); + mask_list[8] = XCB_EVENT_MASK_NO_EVENT; + + win = xcb_generate_id(_ecore_xcb_conn); + xcb_create_window(_ecore_xcb_conn, XCB_COPY_FROM_PARENT, + win, parent, x, y, w, h, 0, + XCB_WINDOW_CLASS_INPUT_OUTPUT, + XCB_COPY_FROM_PARENT, mask, mask_list); + + return win; +} + +/** + * Creates a new input window. + * @param parent The parent window to use. If @p parent is @c 0, the root + * window of the default display is used. + * @param x X position. + * @param y Y position. + * @param w Width. + * @param h Height. + * @return The new window. + * @ingroup Ecore_X_Window_Create_Group + */ +EAPI Ecore_X_Window +ecore_x_window_input_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h) +{ + Ecore_X_Window win; + uint32_t mask, mask_list[3]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__) + CHECK_XCB_CONN; + + if (parent == 0) + parent = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + /* NB: Order here is very important due to xcb_cw_t enum */ + mask = (XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK | + XCB_CW_DONT_PROPAGATE); + + mask_list[0] = 1; + mask_list[1] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | + XCB_EVENT_MASK_BUTTON_PRESS | + XCB_EVENT_MASK_BUTTON_RELEASE | + XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | + XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE | + XCB_EVENT_MASK_VISIBILITY_CHANGE | + XCB_EVENT_MASK_STRUCTURE_NOTIFY | + XCB_EVENT_MASK_FOCUS_CHANGE | + XCB_EVENT_MASK_PROPERTY_CHANGE | + XCB_EVENT_MASK_COLOR_MAP_CHANGE); + mask_list[2] = XCB_EVENT_MASK_NO_EVENT; + + win = xcb_generate_id(_ecore_xcb_conn); + xcb_create_window(_ecore_xcb_conn, XCB_COPY_FROM_PARENT, + win, parent, x, y, w, h, 0, + XCB_WINDOW_CLASS_INPUT_ONLY, + XCB_COPY_FROM_PARENT, mask, mask_list); + + return win; +} + +/** + * Creates a new window. + * @param parent The parent window to use. If @p parent is @c 0, the root + * window of the default display is used. + * @param x X position. + * @param y Y position. + * @param w Width. + * @param h Height. + * @return The new window handle. + * @ingroup Ecore_X_Window_Create_Group + */ +EAPI Ecore_X_Window +ecore_x_window_manager_argb_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h) +{ + Ecore_X_Window win = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + win = _ecore_xcb_window_argb_internal_new(parent, x, y, w, h, 1, 0); + + return win; +} + +/** + * Creates a new window. + * @param parent The parent window to use. If @p parent is @c 0, the root + * window of the default display is used. + * @param x X position. + * @param y Y position. + * @param w Width. + * @param h Height. + * @return The new window handle. + * @ingroup Ecore_X_Window_Create_Group + */ +EAPI Ecore_X_Window +ecore_x_window_argb_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h) +{ + Ecore_X_Window win = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + win = _ecore_xcb_window_argb_internal_new(parent, x, y, w, h, 0, 0); + + return win; +} + +/** + * Creates a window with the override redirect attribute set to @c True. + * @param parent The parent window to use. If @p parent is @c 0, the root + * window of the default display is used. + * @param x X position. + * @param y Y position. + * @param w Width. + * @param h Height. + * @return The new window handle. + * @ingroup Ecore_X_Window_Create_Group + */ +EAPI Ecore_X_Window +ecore_x_window_override_argb_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h) +{ + Ecore_X_Window win = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + win = _ecore_xcb_window_argb_internal_new(parent, x, y, w, h, 1, 0); + + return win; +} + +/** + * @defgroup Ecore_X_Window_Destroy_Group X Window Destroy Functions + * + * Functions to destroy X windows. + */ + +/** + * Deletes the given window. + * @param win The given window. + * @ingroup Ecore_X_Window_Destroy_Group + */ +EAPI void +ecore_x_window_free(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (win) + { + /* xcb_destroy_notify_event_t ev; */ + /* Ecore_X_Window root; */ + + /* if (xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).rem == 1) */ + /* root = ((xcb_screen_t *)_ecore_xcb_screen)->root; */ + /* else */ + /* { */ + /* xcb_get_geometry_cookie_t cookie; */ + /* xcb_get_geometry_reply_t *reply; */ + + /* cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win); */ + /* reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL); */ + /* if (!reply) return; */ + /* root = reply->root; */ + /* free(reply); */ + /* } */ + + /* memset(&ev, 0, sizeof(xcb_destroy_notify_event_t)); */ + + /* ev.response_type = XCB_DESTROY_NOTIFY; */ + /* ev.window = win; */ + /* ev.event = root; */ + + /* xcb_send_event(_ecore_xcb_conn, 0, root, */ + /* XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | */ + /* XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, */ + /* (const char *)&ev); */ + + xcb_destroy_window(_ecore_xcb_conn, win); +// ecore_x_flush(); + } +} + +/** + * Sends a delete request to the given window. + * @param win The given window. + * @ingroup Ecore_X_Window_Destroy_Group + */ +EAPI void +ecore_x_window_delete_request_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!win) return; + ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, + XCB_EVENT_MASK_NO_EVENT, + ECORE_X_ATOM_WM_DELETE_WINDOW, + XCB_CURRENT_TIME, 0, 0, 0); +} + +EAPI void +ecore_x_window_configure(Ecore_X_Window win, + Ecore_X_Window_Configure_Mask mask, + int x, + int y, + int w, + int h, + int border_width, + Ecore_X_Window sibling, + int stack_mode) +{ + uint16_t vmask = 0; + uint32_t vlist[7]; + unsigned int i = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) return; + + if (mask & XCB_CONFIG_WINDOW_X) + { + vmask |= XCB_CONFIG_WINDOW_X; + vlist[i++] = x; + } + if (mask & XCB_CONFIG_WINDOW_Y) + { + vmask |= XCB_CONFIG_WINDOW_Y; + vlist[i++] = y; + } + if (mask & XCB_CONFIG_WINDOW_WIDTH) + { + vmask |= XCB_CONFIG_WINDOW_WIDTH; + vlist[i++] = w; + } + if (mask & XCB_CONFIG_WINDOW_HEIGHT) + { + vmask |= XCB_CONFIG_WINDOW_HEIGHT; + vlist[i++] = h; + } + if (mask & XCB_CONFIG_WINDOW_BORDER_WIDTH) + { + vmask |= XCB_CONFIG_WINDOW_BORDER_WIDTH; + vlist[i++] = border_width; + } + if (mask & XCB_CONFIG_WINDOW_SIBLING) + { + vmask |= XCB_CONFIG_WINDOW_SIBLING; + vlist[i++] = sibling; + } + if (mask & XCB_CONFIG_WINDOW_STACK_MODE) + { + vmask |= XCB_CONFIG_WINDOW_STACK_MODE; + vlist[i++] = stack_mode; + } + + xcb_configure_window(_ecore_xcb_conn, win, vmask, + (const uint32_t *)&vlist); +// ecore_x_flush(); +} + +/** + * @defgroup Ecore_X_Window_Geometry_Group X Window Geometry Functions + * + * Functions that change or retrieve the geometry of X windows. + */ + +/** + * Moves a window to the position @p x, @p y. + * + * The position is relative to the upper left hand corner of the + * parent window. + * + * @param win The window to move. + * @param x X position. + * @param y Y position. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI void +ecore_x_window_move(Ecore_X_Window win, + int x, + int y) +{ + uint32_t list[2], mask; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) return; + + mask = (XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y); + list[0] = x; + list[1] = y; + + xcb_configure_window(_ecore_xcb_conn, win, mask, + (const uint32_t *)&list); +// ecore_x_flush(); +} + +/** + * Resizes a window. + * @param win The window to resize. + * @param w New width of the window. + * @param h New height of the window. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI void +ecore_x_window_resize(Ecore_X_Window win, + int w, + int h) +{ + uint32_t list[2], mask; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) return; + if (w < 1) w = 1; + if (h < 1) h = 1; + + mask = (XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT); + list[0] = w; + list[1] = h; + + xcb_configure_window(_ecore_xcb_conn, win, mask, + (const uint32_t *)&list); +// ecore_x_flush(); +} + +/** + * Moves and resizes a window. + * @param win The window to move and resize. + * @param x New X position of the window. + * @param y New Y position of the window. + * @param w New width of the window. + * @param h New height of the window. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI void +ecore_x_window_move_resize(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + uint32_t list[4], mask; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) return; + if (w < 1) w = 1; + if (h < 1) h = 1; + + mask = (XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | + XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT); + list[0] = x; + list[1] = y; + list[2] = w; + list[3] = h; + + xcb_configure_window(_ecore_xcb_conn, win, mask, + (const uint32_t *)&list); +// ecore_x_flush(); +} + +/** + * Retrieves the width of the border of the given window. + * @param win The given window. + * @return Width of the border of @p win. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI int +ecore_x_window_border_width_get(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!win) return 0; + return ecore_x_drawable_border_width_get(win); +} + +/** + * Sets the width of the border of the given window. + * @param win The given window. + * @param width The new border width. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI void +ecore_x_window_border_width_set(Ecore_X_Window win, + int border_width) +{ + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) return; + + list = border_width; + + xcb_configure_window(_ecore_xcb_conn, win, + XCB_CONFIG_WINDOW_BORDER_WIDTH, &list); +// ecore_x_flush(); +} + +/** + * @defgroup Ecore_X_Window_Z_Order_Group X Window Z Order Functions + * + * Functions that change the Z order of X windows. + */ + +/** + * Raises the given window. + * @param win The window to raise. + * @ingroup Ecore_X_Window_Z_Order_Group + */ +EAPI void +ecore_x_window_raise(Ecore_X_Window win) +{ + uint32_t list[] = { XCB_STACK_MODE_ABOVE }; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_configure_window(_ecore_xcb_conn, win, + XCB_CONFIG_WINDOW_STACK_MODE, list); +// ecore_x_flush(); +} + +/** + * Lowers the given window. + * @param win The window to lower. + * @ingroup Ecore_X_Window_Z_Order_Group + */ +EAPI void +ecore_x_window_lower(Ecore_X_Window win) +{ + uint32_t list[] = { XCB_STACK_MODE_BELOW }; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_configure_window(_ecore_xcb_conn, win, + XCB_CONFIG_WINDOW_STACK_MODE, list); +// ecore_x_flush(); +} + +/** + * Retrieves the depth of the given window. + * @param win The given window. + * @return Depth of the window. + */ +EAPI int +ecore_x_window_depth_get(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return ecore_x_drawable_depth_get(win); +} + +/** + * @defgroup Ecore_X_Window_Properties_Group X Window Property Functions + * + * Functions that set window properties. + */ + +/** + * Sets the default properties for the given window. + * + * The default properties set for the window are @c WM_CLIENT_MACHINE and + * @c _NET_WM_PID. + * + * @param win The given window. + * @ingroup Ecore_X_Window_Properties_Groups + */ +EAPI void +ecore_x_window_defaults_set(Ecore_X_Window win) +{ + char buff[MAXHOSTNAMELEN], **argv; + int argc; + pid_t pid; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + gethostname(buff, MAXHOSTNAMELEN); + buff[MAXHOSTNAMELEN - 1] = '\0'; + + xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, + ECORE_X_ATOM_WM_CLIENT_MACHINE, ECORE_X_ATOM_STRING, + 8, strlen(buff), buff); + + pid = getpid(); + ecore_x_netwm_pid_set(win, pid); + ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL); + ecore_app_args_get(&argc, &argv); + ecore_x_icccm_command_set(win, argc, argv); +} + +/** + * @defgroup Ecore_X_Window_Visibility_Group X Window Visibility Functions + * + * Functions to access and change the visibility of X windows. + */ + +/** + * Shows a window. + * + * Synonymous to "mapping" a window in X Window System terminology. + * + * @param win The window to show. + * @ingroup Ecore_X_Window_Visibility + */ +EAPI void +ecore_x_window_show(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (win) + xcb_map_window(_ecore_xcb_conn, win); +} + +/** + * Hides a window. + * + * Synonymous to "unmapping" a window in X Window System terminology. + * + * @param win The window to hide. + * @ingroup Ecore_X_Window_Visibility + */ +EAPI void +ecore_x_window_hide(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (win) + { + xcb_unmap_notify_event_t ev; + Ecore_X_Window root; + + if (xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)).rem == 1) + root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + else + { + xcb_get_geometry_cookie_t cookie; + xcb_get_geometry_reply_t *reply; + + cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win); + reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return; + root = reply->root; + free(reply); + } + + memset(&ev, 0, sizeof(xcb_unmap_notify_event_t)); + + ev.response_type = XCB_UNMAP_NOTIFY; + ev.window = win; + ev.event = root; + ev.from_configure = 0; + + xcb_send_event(_ecore_xcb_conn, 0, root, + (XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | + XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT), + (const char *)&ev); + + xcb_unmap_window(_ecore_xcb_conn, win); +// ecore_x_flush(); + } +} + +/** + * @defgroup Ecore_X_Window_Focus_Functions X Window Focus Functions + * + * Functions that give the focus to an X Window. + */ + +/** + * Sets the focus to the window @p win. + * @param win The window to focus. + * @ingroup Ecore_X_Window_Focus_Functions + */ +EAPI void +ecore_x_window_focus(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + xcb_set_input_focus(_ecore_xcb_conn, + XCB_INPUT_FOCUS_PARENT, win, XCB_CURRENT_TIME); +// ecore_x_flush(); +} + +/** + * Sets the focus to the given window at a specific time. + * @param win The window to focus. + * @param t When to set the focus to the window. + * @ingroup Ecore_X_Window_Focus_Functions + */ +EAPI void +ecore_x_window_focus_at_time(Ecore_X_Window win, + Ecore_X_Time time) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; + xcb_set_input_focus(_ecore_xcb_conn, XCB_INPUT_FOCUS_PARENT, win, time); +// ecore_x_flush(); +} + +/** + * @defgroup Ecore_X_Window_Parent_Group X Window Parent Functions + * + * Functions that retrieve or changes the parent window of a window. + */ + +/** + * Moves a window to within another window at a given position. + * @param win The window to reparent. + * @param new_parent The new parent window. + * @param x X position within new parent window. + * @param y Y position within new parent window. + * @ingroup Ecore_X_Window_Parent_Group + */ +EAPI void +ecore_x_window_reparent(Ecore_X_Window win, + Ecore_X_Window parent, + int x, + int y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (parent == 0) + parent = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + xcb_reparent_window(_ecore_xcb_conn, win, parent, x, y); +// ecore_x_flush(); +} + +EAPI void +ecore_x_window_pixmap_set(Ecore_X_Window win, + Ecore_X_Pixmap pixmap) +{ + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + list = pixmap; + + xcb_change_window_attributes(_ecore_xcb_conn, win, + XCB_CW_BACK_PIXMAP, &list); +// ecore_x_flush(); +} + +/** + * Sets the background color of the given window. + * @param win The given window + * @param r red value (0...65536, 16 bits) + * @param g green value (0...65536, 16 bits) + * @param b blue value (0...65536, 16 bits) + */ +EAPI void +ecore_x_window_background_color_set(Ecore_X_Window win, + unsigned short red, + unsigned short green, + unsigned short blue) +{ + xcb_alloc_color_cookie_t cookie; + xcb_alloc_color_reply_t *reply; + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = + xcb_alloc_color_unchecked(_ecore_xcb_conn, + ((xcb_screen_t *)_ecore_xcb_screen)->default_colormap, + red, green, blue); + reply = xcb_alloc_color_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return; + list = reply->pixel; + free(reply); + + xcb_change_window_attributes(_ecore_xcb_conn, win, + XCB_CW_BACK_PIXEL, &list); +// ecore_x_flush(); +} + +EAPI void +ecore_x_window_pixel_gravity_set(Ecore_X_Window win, + Ecore_X_Gravity gravity) +{ + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + list = gravity; + + xcb_change_window_attributes(_ecore_xcb_conn, win, + XCB_CW_BIT_GRAVITY, &list); +// ecore_x_flush(); +} + +EAPI void +ecore_x_window_gravity_set(Ecore_X_Window win, + Ecore_X_Gravity gravity) +{ + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + list = gravity; + + xcb_change_window_attributes(_ecore_xcb_conn, win, + XCB_CW_WIN_GRAVITY, &list); +// ecore_x_flush(); +} + +EAPI void +ecore_x_window_override_set(Ecore_X_Window win, + Eina_Bool override) +{ + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + list = override; + + xcb_change_window_attributes(_ecore_xcb_conn, win, + XCB_CW_OVERRIDE_REDIRECT, &list); +// ecore_x_flush(); +} + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI void +ecore_x_window_cursor_show(Ecore_X_Window win, + Eina_Bool show) +{ + uint32_t list = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + if (!show) + { + Ecore_X_Cursor cursor; + Ecore_X_Pixmap p, m; + Ecore_X_GC gc; + xcb_point_t point; + + p = xcb_generate_id(_ecore_xcb_conn); + xcb_create_pixmap(_ecore_xcb_conn, 1, p, win, 1, 1); + m = xcb_generate_id(_ecore_xcb_conn); + xcb_create_pixmap(_ecore_xcb_conn, 1, m, win, 1, 1); + gc = xcb_generate_id(_ecore_xcb_conn); + xcb_create_gc(_ecore_xcb_conn, gc, win, 0, NULL); + xcb_change_gc(_ecore_xcb_conn, gc, XCB_GC_FOREGROUND, &list); + point.x = 0; + point.y = 0; + xcb_poly_point(_ecore_xcb_conn, XCB_COORD_MODE_ORIGIN, + win, gc, 1, &point); + xcb_free_gc(_ecore_xcb_conn, gc); + + cursor = xcb_generate_id(_ecore_xcb_conn); + xcb_create_cursor(_ecore_xcb_conn, cursor, + p, m, 0, 0, 0, 0, 0, 0, 0, 0); + list = cursor; + + xcb_change_window_attributes(_ecore_xcb_conn, win, + XCB_CW_CURSOR, &list); + + xcb_free_cursor(_ecore_xcb_conn, cursor); + xcb_free_pixmap(_ecore_xcb_conn, m); + xcb_free_pixmap(_ecore_xcb_conn, p); + } + else + { + xcb_change_window_attributes(_ecore_xcb_conn, win, + XCB_CW_CURSOR, &list); + } +// ecore_x_flush(); +} + +EAPI void +ecore_x_window_cursor_set(Ecore_X_Window win, + Ecore_X_Cursor cursor) +{ + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + list = cursor; + + xcb_change_window_attributes(_ecore_xcb_conn, win, XCB_CW_CURSOR, &list); +// ecore_x_flush(); +} + +EAPI void +ecore_x_window_container_manage(Ecore_X_Window win) +{ + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + list = (XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY); + + xcb_change_window_attributes(_ecore_xcb_conn, win, + XCB_CW_EVENT_MASK, &list); +// ecore_x_flush(); +} + +EAPI void +ecore_x_window_client_manage(Ecore_X_Window win) +{ + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + list = (XCB_EVENT_MASK_VISIBILITY_CHANGE | + XCB_EVENT_MASK_FOCUS_CHANGE | + XCB_EVENT_MASK_PROPERTY_CHANGE | + XCB_EVENT_MASK_COLOR_MAP_CHANGE | + XCB_EVENT_MASK_STRUCTURE_NOTIFY | + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY); + + xcb_change_window_attributes(_ecore_xcb_conn, win, + XCB_CW_EVENT_MASK, &list); + +#ifdef ECORE_XCB_SHAPE + xcb_shape_select_input(_ecore_xcb_conn, win, EINA_TRUE); +#endif +// ecore_x_flush(); +} + +EAPI void +ecore_x_window_sniff(Ecore_X_Window win) +{ + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + list = (XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | + XCB_EVENT_MASK_PROPERTY_CHANGE); + + xcb_change_window_attributes(_ecore_xcb_conn, win, + XCB_CW_EVENT_MASK, &list); +// ecore_x_flush(); +} + +EAPI void +ecore_x_window_client_sniff(Ecore_X_Window win) +{ + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + list = (XCB_EVENT_MASK_VISIBILITY_CHANGE | + XCB_EVENT_MASK_STRUCTURE_NOTIFY | + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | + XCB_EVENT_MASK_FOCUS_CHANGE | + XCB_EVENT_MASK_PROPERTY_CHANGE | + XCB_EVENT_MASK_COLOR_MAP_CHANGE); + + xcb_change_window_attributes(_ecore_xcb_conn, win, + XCB_CW_EVENT_MASK, &list); +#ifdef ECORE_XCB_SHAPE + xcb_shape_select_input(_ecore_xcb_conn, win, EINA_TRUE); +#endif +// ecore_x_flush(); +} + +EAPI void +ecore_x_window_area_clear(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_clear_area(_ecore_xcb_conn, 0, win, x, y, w, h); +// ecore_x_flush(); +} + +EAPI void +ecore_x_window_area_expose(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_clear_area(_ecore_xcb_conn, 1, win, x, y, w, h); +// ecore_x_flush(); +} + +EAPI void +ecore_x_window_save_set_add(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_change_save_set(_ecore_xcb_conn, XCB_SET_MODE_INSERT, win); +} + +EAPI void +ecore_x_window_save_set_del(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_change_save_set(_ecore_xcb_conn, XCB_SET_MODE_DELETE, win); +} + +/** + * gets the focus to the window @p win. + * @return The window that has focus. + * @ingroup Ecore_X_Window_Focus_Functions + */ +EAPI Ecore_X_Window +ecore_x_window_focus_get(void) +{ + xcb_get_input_focus_cookie_t cookie; + xcb_get_input_focus_reply_t *reply; + Ecore_X_Window focus = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = xcb_get_input_focus_unchecked(_ecore_xcb_conn); + reply = xcb_get_input_focus_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return 0; + focus = reply->focus; + free(reply); + return focus; +} + +EAPI int +ecore_x_window_argb_get(Ecore_X_Window win) +{ + uint8_t ret = 0; +#ifdef ECORE_XCB_RENDER + Ecore_X_Visual visual; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +// if (!win) return ret; + +#ifdef ECORE_XCB_RENDER + /* grab the window's visual */ + visual = _ecore_xcb_window_visual_get(win); + + /* check if this visual supports alpha */ + ret = _ecore_xcb_render_visual_supports_alpha(visual); +#endif + + return ret; +} + +EAPI Eina_Bool +ecore_x_window_manage(Ecore_X_Window win) +{ + xcb_get_window_attributes_cookie_t cookie; + xcb_get_window_attributes_reply_t *reply; + xcb_void_cookie_t change_cookie; + xcb_generic_error_t *err; + uint32_t list; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = xcb_get_window_attributes(_ecore_xcb_conn, win); + reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + + ecore_x_sync(); // needed + + list = (XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | + XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_RESIZE_REDIRECT | + XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | + XCB_EVENT_MASK_STRUCTURE_NOTIFY | + XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | + reply->your_event_mask); + free(reply); + + change_cookie = xcb_change_window_attributes(_ecore_xcb_conn, win, + XCB_CW_EVENT_MASK, &list); + + ecore_x_sync(); // needed + + err = xcb_request_check(_ecore_xcb_conn, change_cookie); + if (err) + { + _ecore_xcb_error_handle(err); + free(err); + return EINA_FALSE; + } + + return EINA_TRUE; +} + +EAPI Eina_Bool +ecore_x_window_attributes_get(Ecore_X_Window win, + Ecore_X_Window_Attributes *att_ret) +{ + xcb_get_window_attributes_cookie_t cookie; + xcb_get_window_attributes_reply_t *reply; + xcb_get_geometry_cookie_t gcookie; + xcb_get_geometry_reply_t *greply; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, win); + reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + + memset(att_ret, 0, sizeof(Ecore_X_Window_Attributes)); + + if (reply->map_state != XCB_MAP_STATE_UNMAPPED) + att_ret->visible = EINA_TRUE; + + if (reply->map_state == XCB_MAP_STATE_VIEWABLE) + att_ret->viewable = EINA_TRUE; + + if (reply->override_redirect) + att_ret->override = EINA_TRUE; + + if (reply->_class == XCB_WINDOW_CLASS_INPUT_ONLY) + att_ret->input_only = EINA_TRUE; + + if (reply->save_under) + att_ret->save_under = EINA_TRUE; + + att_ret->event_mask.mine = reply->your_event_mask; + att_ret->event_mask.all = reply->all_event_masks; + att_ret->event_mask.no_propagate = reply->do_not_propagate_mask; + att_ret->window_gravity = reply->win_gravity; + att_ret->pixel_gravity = reply->bit_gravity; + att_ret->colormap = reply->colormap; + att_ret->visual = _ecore_xcb_window_find_visual_by_id(reply->visual); + + free(reply); + + gcookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win); + greply = xcb_get_geometry_reply(_ecore_xcb_conn, gcookie, NULL); + if (!greply) return EINA_TRUE; + + /* xcb_translate_coordinates_reply_t *trans; */ + /* xcb_query_tree_cookie_t tcookie; */ + /* xcb_query_tree_reply_t *treply; */ + + /* tcookie = xcb_query_tree(_ecore_xcb_conn, win); */ + /* treply = xcb_query_tree_reply(_ecore_xcb_conn, tcookie, NULL); */ + + /* trans = */ + /* xcb_translate_coordinates_reply(_ecore_xcb_conn, */ + /* xcb_translate_coordinates(_ecore_xcb_conn, */ + /* win, treply->parent, greply->x, greply->y), NULL); */ + /* free(treply); */ + + att_ret->root = greply->root; + att_ret->depth = greply->depth; +// att_ret->x = trans->dst_x; +// att_ret->y = trans->dst_y; + att_ret->x = greply->x; + att_ret->y = greply->y; + att_ret->w = greply->width; + att_ret->h = greply->height; + att_ret->border = greply->border_width; + +// free(trans); + + free(greply); + return EINA_TRUE; +} + +/** + * Retrieves the size of the given window. + * @param win The given window. + * @param w Pointer to an integer into which the width is to be stored. + * @param h Pointer to an integer into which the height is to be stored. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI void +ecore_x_window_size_get(Ecore_X_Window win, + int *width, + int *height) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; + ecore_x_drawable_geometry_get(win, NULL, NULL, width, height); +} + +/** + * Set if a window should be ignored. + * @param win The given window. + * @param ignore if to ignore + */ +EAPI void +ecore_x_window_ignore_set(Ecore_X_Window win, + int ignore) +{ + int i = 0, j = 0, count = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (ignore) + { + if (ignore_list) + { + for (i = 0; i < ignore_num; i++) + if (win == ignore_list[i]) return; + + ignore_list = + realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window)); + if (!ignore_list) return; + + ignore_list[ignore_num++] = win; + } + else + { + ignore_num = 0; + ignore_list = malloc(sizeof(Ecore_X_Window)); + if (!ignore_list) return; + ignore_list[ignore_num++] = win; + } + } + else + { + if (!ignore_list) return; + for (count = ignore_num, i = 0, j = 0; i < count; i++) + { + if (win != ignore_list[i]) + ignore_list[j++] = ignore_list[i]; + else + ignore_num--; + } + if (ignore_num <= 0) + { + free(ignore_list); + ignore_list = NULL; + return; + } + + ignore_list = + realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window)); + } +} + +/** + * Get the ignore list + * @param num number of windows in the list + * @return list of windows to ignore + */ +EAPI Ecore_X_Window * +ecore_x_window_ignore_list(int *num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (num) *num = ignore_num; + return ignore_list; +} + +/** + * Get a list of all the root windows on the server. + * + * @note The returned array will need to be freed after use. + * @param num_ret Pointer to integer to put number of windows returned in. + * @return An array of all the root windows. @c NULL is returned if memory + * could not be allocated for the list, or if @p num_ret is @c NULL. + */ +EAPI Ecore_X_Window * +ecore_x_window_root_list(int *num_ret) +{ + xcb_screen_iterator_t iter; + uint8_t i, num; + Ecore_X_Window *roots = NULL; +#ifdef ECORE_XCB_XPRINT + const xcb_query_extension_reply_t *ext_reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!num_ret) return NULL; + if (num_ret) *num_ret = 0; + + /* if (xcb_connection_has_error(_ecore_xcb_conn)) */ + /* { */ + /* DBG("XCB Connection Has Error !!!"); */ + /* return NULL; */ + /* } */ + + num = ecore_x_screen_count_get(); + +#ifdef ECORE_XCB_XPRINT + ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_x_print_id); + if ((ext_reply) && (ext_reply->present)) + { + xcb_x_print_print_query_screens_cookie_t cookie; + xcb_x_print_print_query_screens_reply_t *reply; + + cookie = xcb_x_print_print_query_screens_unchecked(_ecore_xcb_conn); + reply = + xcb_x_print_print_query_screens_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + xcb_window_t *screens; + int psnum = 0, overlap = 0, j = 0, k = 0; + + psnum = xcb_x_print_print_query_screens_roots_length(reply); + screens = xcb_x_print_print_query_screens_roots(reply); + for (i = 0; i < num; i++) + { + for (j = 0; j < psnum; j++) + { + xcb_screen_t *s; + + if ((s = _ecore_xcb_window_screen_of_display(i))) + { + if (s->root == screens[j]) + overlap++; + } + } + } + if (!(roots = malloc((num - overlap) + * sizeof(Ecore_X_Window)))) return NULL; + for (i = 0; i < num; i++) + { + Eina_Bool is_print = EINA_FALSE; + + for (j = 0; j < psnum; j++) + { + xcb_screen_t *s; + + if ((s = _ecore_xcb_window_screen_of_display(i))) + { + if (s->root == screens[j]) + { + is_print = EINA_TRUE; + break; + } + } + } + if (!is_print) + { + xcb_screen_t *s; + + if ((s = _ecore_xcb_window_screen_of_display(i))) + { + roots[k] = s->root; + k++; + } + } + } + if (num_ret) *num_ret = k; + free(reply); + } + else + { + /* Fallback to default method */ + iter = + xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)); + if (!(roots = malloc(num * sizeof(Ecore_X_Window)))) return NULL; + if (num_ret) *num_ret = num; + for (i = 0; iter.rem; xcb_screen_next(&iter), i++) + roots[i] = iter.data->root; + } + } + else + { + /* Fallback to default method */ + iter = + xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)); + if (!(roots = malloc(num * sizeof(Ecore_X_Window)))) return NULL; + if (num_ret) *num_ret = num; + for (i = 0; iter.rem; xcb_screen_next(&iter), i++) + roots[i] = iter.data->root; + } +#else + iter = + xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)); + if (!(roots = malloc(num * sizeof(Ecore_X_Window)))) return NULL; + if (num_ret) *num_ret = num; + for (i = 0; iter.rem; xcb_screen_next(&iter), i++) + roots[i] = iter.data->root; +#endif + + return roots; +} + +EAPI Ecore_X_Window * +ecore_x_window_children_get(Ecore_X_Window win, + int *num) +{ + xcb_query_tree_cookie_t cookie; + xcb_query_tree_reply_t *reply; + Ecore_X_Window *windows = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (num) *num = 0; + cookie = xcb_query_tree_unchecked(_ecore_xcb_conn, win); + reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return NULL; + + if (num) *num = reply->children_len; + if (reply->children_len > 0) + { + windows = malloc(sizeof(Ecore_X_Window) * reply->children_len); + if (windows) + { + unsigned int i = 0; + xcb_window_t *w; + + w = xcb_query_tree_children(reply); + for (i = 0; i < reply->children_len; i++) + windows[i] = w[i]; + } + } + + free(reply); + return windows; +} + +/** + * Retrieves the root window a given window is on. + * @param win The window to get the root window of + * @return The root window of @p win + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI Ecore_X_Window +ecore_x_window_root_get(Ecore_X_Window win) +{ + xcb_get_geometry_cookie_t gcookie; + xcb_get_geometry_reply_t *greply; + Ecore_X_Window window = 0; + + /* LOGFN(__FILE__, __LINE__, __FUNCTION__); */ + CHECK_XCB_CONN; + + gcookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win); + greply = xcb_get_geometry_reply(_ecore_xcb_conn, gcookie, NULL); + if (!greply) return 0; + window = greply->root; + free(greply); + + return window; +} + +EAPI Ecore_X_Window +ecore_x_window_root_first_get(void) +{ + return ((xcb_screen_t *)_ecore_xcb_screen)->root; +} + +/** + * Retrieves the geometry of the given window. + * + * Note that the x & y coordingates are relative to your parent. In + * particular for reparenting window managers - relative to you window border. + * If you want screen coordinates either walk the window tree to the root, + * else for ecore_evas applications see ecore_evas_geometry_get(). Elementary + * applications can use elm_win_screen_position_get(). + * + * @param win The given window. + * @param x Pointer to an integer in which the X position is to be stored. + * @param y Pointer to an integer in which the Y position is to be stored. + * @param w Pointer to an integer in which the width is to be stored. + * @param h Pointer to an integer in which the height is to be stored. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI void +ecore_x_window_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *w, + int *h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!win) win = ((xcb_screen_t *)_ecore_xcb_screen)->root; + ecore_x_drawable_geometry_get(win, x, y, w, h); +} + +/** + * Retrieves the top, visible window at the given location. + * @param x The given X position. + * @param y The given Y position. + * @return The window at that position. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI Ecore_X_Window +ecore_x_window_at_xy_get(int x, + int y) +{ + Ecore_X_Window root, win = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + ecore_x_grab(); + win = _ecore_xcb_window_at_xy_get(root, 0, 0, x, y, NULL, 0); + ecore_x_ungrab(); + + return win ? win : root; +} + +/** + * Retrieves the top, visible window at the given location, + * but skips the windows in the list. + * @param x The given X position. + * @param y The given Y position. + * @return The window at that position. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI Ecore_X_Window +ecore_x_window_at_xy_with_skip_get(int x, + int y, + Ecore_X_Window *skip, + int skip_num) +{ + Ecore_X_Window root, win = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + ecore_x_grab(); + win = _ecore_xcb_window_at_xy_get(root, 0, 0, x, y, skip, skip_num); + ecore_x_ungrab(); + + return win ? win : root; +} + +EAPI Ecore_X_Window +ecore_x_window_at_xy_begin_get(Ecore_X_Window begin, + int x, + int y) +{ + Ecore_X_Window win = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + ecore_x_grab(); + win = _ecore_xcb_window_at_xy_get(begin, 0, 0, x, y, NULL, 0); + ecore_x_ungrab(); + + return win ? win : begin; +} + +/** + * Retrieves the parent window of the given window. + * @param win The given window. + * @return The parent window of @p win. + * @ingroup Ecore_X_Window_Parent_Group + */ +EAPI Ecore_X_Window +ecore_x_window_parent_get(Ecore_X_Window win) +{ + xcb_query_tree_cookie_t cookie; + xcb_query_tree_reply_t *reply; + Ecore_X_Window window = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +// if (!win) return 0; + cookie = xcb_query_tree(_ecore_xcb_conn, win); + reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return 0; + window = reply->parent; + free(reply); + + return window; +} + +/** + * Finds out whether the given window is currently visible. + * @param win The given window. + * @return 1 if the window is visible, otherwise 0. + * @ingroup Ecore_X_Window_Visibility_Group + */ +EAPI int +ecore_x_window_visible_get(Ecore_X_Window win) +{ + xcb_get_window_attributes_cookie_t cookie; + xcb_get_window_attributes_reply_t *reply; + int ret = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, win); + reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + + if (reply->map_state == XCB_MAP_STATE_VIEWABLE) + ret = EINA_TRUE; + + free(reply); + return ret; +} + +EAPI void +ecore_x_window_button_grab(Ecore_X_Window win, + int button, + Ecore_X_Event_Mask mask, + int mod, + int any_mod) +{ + int i = 0; + uint16_t m, locks[8], ev; + uint8_t b; + Ecore_X_Window *t; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + b = button; + if (b == 0) + b = XCB_BUTTON_INDEX_ANY; + + m = _ecore_xcb_window_modifiers_get(mod); + if (any_mod) m = XCB_MOD_MASK_ANY; + + locks[0] = 0; + locks[1] = ECORE_X_LOCK_CAPS; + locks[2] = ECORE_X_LOCK_NUM; + locks[3] = ECORE_X_LOCK_SCROLL; + locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; + locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; + locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + + ev = mask; + for (i = 0; i < 8; i++) + xcb_grab_button(_ecore_xcb_conn, 0, win, ev, + XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, + XCB_NONE, XCB_NONE, b, m | locks[i]); + + _ecore_xcb_button_grabs_num++; + t = realloc(_ecore_xcb_button_grabs, + _ecore_xcb_button_grabs_num * sizeof(Ecore_X_Window)); + if (!t) return; + + _ecore_xcb_button_grabs = t; + _ecore_xcb_button_grabs[_ecore_xcb_button_grabs_num - 1] = win; +} + +EAPI void +ecore_x_window_button_ungrab(Ecore_X_Window win, + int button, + int mod, + int any_mod) +{ + int i = 0; + uint16_t m = 0, locks[8]; + uint8_t b; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + b = button; + if (b == 0) b = XCB_BUTTON_INDEX_ANY; + + m = _ecore_xcb_window_modifiers_get(mod); + if (any_mod) m = XCB_MOD_MASK_ANY; + + locks[0] = 0; + locks[1] = ECORE_X_LOCK_CAPS; + locks[2] = ECORE_X_LOCK_NUM; + locks[3] = ECORE_X_LOCK_SCROLL; + locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; + locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; + locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + + for (i = 0; i < 8; i++) + xcb_ungrab_button(_ecore_xcb_conn, b, win, m | locks[i]); + + _ecore_xcb_sync_magic_send(1, win); +} + +EAPI void +ecore_x_window_key_grab(Ecore_X_Window win, + const char *key, + int mod, + int any_mod) +{ + xcb_keycode_t keycode = XCB_NO_SYMBOL; + uint16_t m = 0, locks[8]; + int i = 0; + Ecore_X_Window *t; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + keycode = _ecore_xcb_keymap_string_to_keycode(key); + if (keycode == XCB_NO_SYMBOL) return; + + m = _ecore_xcb_window_modifiers_get(mod); + if (any_mod) m = XCB_MOD_MASK_ANY; + + locks[0] = 0; + locks[1] = ECORE_X_LOCK_CAPS; + locks[2] = ECORE_X_LOCK_NUM; + locks[3] = ECORE_X_LOCK_SCROLL; + locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; + locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; + locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + + for (i = 0; i < 8; i++) + xcb_grab_key(_ecore_xcb_conn, 0, win, m | locks[i], + keycode, XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC); + _ecore_xcb_key_grabs_num++; + t = realloc(_ecore_xcb_key_grabs, + _ecore_xcb_key_grabs_num * sizeof(Ecore_X_Window)); + if (!t) return; + _ecore_xcb_key_grabs = t; + _ecore_xcb_key_grabs[_ecore_xcb_key_grabs_num - 1] = win; +} + +EAPI void +ecore_x_window_key_ungrab(Ecore_X_Window win, + const char *key, + int mod, + int any_mod) +{ + xcb_keycode_t keycode = XCB_NO_SYMBOL; + uint16_t m = 0, locks[8]; + int i = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + keycode = _ecore_xcb_keymap_string_to_keycode(key); + if (keycode == XCB_NO_SYMBOL) return; + + m = _ecore_xcb_window_modifiers_get(mod); + if (any_mod) m = XCB_MOD_MASK_ANY; + + locks[0] = 0; + locks[1] = ECORE_X_LOCK_CAPS; + locks[2] = ECORE_X_LOCK_NUM; + locks[3] = ECORE_X_LOCK_SCROLL; + locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; + locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; + locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + + for (i = 0; i < 8; i++) + xcb_ungrab_key(_ecore_xcb_conn, keycode, win, m | locks[i]); + + _ecore_xcb_sync_magic_send(2, win); +} + +/* local functions */ +Ecore_X_Window +_ecore_xcb_window_root_of_screen_get(int screen) +{ + xcb_screen_iterator_t iter; + + CHECK_XCB_CONN; + iter = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)); + for (; iter.rem; --screen, xcb_screen_next(&iter)) + if (screen == 0) + { + xcb_screen_t *s; + + if ((s = iter.data)) + return s->root; + } + return 0; +} + +static Ecore_X_Window +_ecore_xcb_window_argb_internal_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h, + uint8_t override_redirect, + uint8_t save_under) +{ + Ecore_X_Window win = 0; +#ifdef ECORE_XCB_RENDER + uint32_t value_list[10]; + uint32_t value_mask; + uint32_t vis; + Ecore_X_Colormap colormap; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_RENDER + if (parent == 0) + parent = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + vis = + _ecore_xcb_render_find_visual_id(XCB_RENDER_PICT_TYPE_DIRECT, EINA_TRUE); + + colormap = xcb_generate_id(_ecore_xcb_conn); + xcb_create_colormap(_ecore_xcb_conn, XCB_COLORMAP_ALLOC_NONE, + colormap, parent, vis); + + value_mask = (XCB_CW_BACK_PIXMAP | XCB_CW_BORDER_PIXEL | XCB_CW_BIT_GRAVITY | + XCB_CW_WIN_GRAVITY | XCB_CW_BACKING_STORE | + XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER | + XCB_CW_EVENT_MASK | XCB_CW_DONT_PROPAGATE | XCB_CW_COLORMAP); + + value_list[0] = XCB_BACK_PIXMAP_NONE; + value_list[1] = 0; + value_list[2] = XCB_GRAVITY_NORTH_WEST; + value_list[3] = XCB_GRAVITY_NORTH_WEST; + value_list[4] = XCB_BACKING_STORE_NOT_USEFUL; + value_list[5] = override_redirect; + value_list[6] = save_under; + value_list[7] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE | + XCB_EVENT_MASK_BUTTON_PRESS | + XCB_EVENT_MASK_BUTTON_RELEASE | + XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW | + XCB_EVENT_MASK_POINTER_MOTION | XCB_EVENT_MASK_EXPOSURE | + XCB_EVENT_MASK_VISIBILITY_CHANGE | + XCB_EVENT_MASK_STRUCTURE_NOTIFY | + XCB_EVENT_MASK_FOCUS_CHANGE | + XCB_EVENT_MASK_PROPERTY_CHANGE | + XCB_EVENT_MASK_COLOR_MAP_CHANGE); + value_list[8] = XCB_EVENT_MASK_NO_EVENT; + value_list[9] = colormap; + + win = xcb_generate_id(_ecore_xcb_conn); + xcb_create_window(_ecore_xcb_conn, 32, win, parent, x, y, w, h, 0, + XCB_WINDOW_CLASS_INPUT_OUTPUT, vis, value_mask, + value_list); + + xcb_free_colormap(_ecore_xcb_conn, colormap); + + if (parent == ((xcb_screen_t *)_ecore_xcb_screen)->root) + ecore_x_window_defaults_set(win); +#endif + + return win; +} + +static Ecore_X_Window +_ecore_xcb_window_at_xy_get(Ecore_X_Window base, + int bx, + int by, + int x, + int y, + Ecore_X_Window *skip, + int skip_num) +{ + xcb_query_tree_cookie_t cookie; + xcb_query_tree_reply_t *reply; + Ecore_X_Window *windows = NULL; + int wx, wy, ww, wh, num, i = 0; + Eina_Bool skipit = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!ecore_x_window_visible_get(base)) return 0; + + ecore_x_window_geometry_get(base, &wx, &wy, &ww, &wh); + wx += bx; + wy += by; + + if (!((x >= wx) && (y >= wy) && (x < (wx + ww)) && (y < (wy + wh)))) + return 0; + + cookie = xcb_query_tree_unchecked(_ecore_xcb_conn, base); + reply = xcb_query_tree_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return 0; + + num = reply->children_len; + windows = xcb_query_tree_children(reply); + + for (i = (num - 1); i >= 0; --i) + { + skipit = EINA_FALSE; + + if (skip) + { + int j = 0; + + for (j = 0; j < skip_num; j++) + { + if (windows[i] == skip[j]) + { + skipit = EINA_TRUE; + goto onward; + } + } + } +onward: + if (!skipit) + { + Ecore_X_Window child = 0; + + child = + _ecore_xcb_window_at_xy_get(windows[i], + wx, wy, x, y, skip, skip_num); + if (child) + { + if (reply) free(reply); + return child; + } + } + } + + if (reply) free(reply); + return base; +} + +Ecore_X_Visual +_ecore_xcb_window_visual_get(Ecore_X_Window win) +{ + xcb_get_window_attributes_cookie_t cookie; + xcb_get_window_attributes_reply_t *reply; + Ecore_X_Visual visual = 0; + + CHECK_XCB_CONN; + + cookie = xcb_get_window_attributes(_ecore_xcb_conn, win); + reply = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return 0; + visual = _ecore_xcb_window_find_visual_by_id(reply->visual); + free(reply); + + return visual; +} + +void +_ecore_xcb_window_button_grab_remove(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (_ecore_xcb_button_grabs_num > 0) + { + int i = 0, shuffle = 0; + + for (i = 0; i < _ecore_xcb_button_grabs_num; i++) + { + if (shuffle) + _ecore_xcb_button_grabs[i - 1] = _ecore_xcb_button_grabs[i]; + + if ((!shuffle) && (_ecore_xcb_button_grabs[i] == win)) + shuffle = 1; + } + + if (shuffle) + { + Ecore_X_Window *t; + + _ecore_xcb_button_grabs_num--; + if (_ecore_xcb_button_grabs_num <= 0) + { + free(_ecore_xcb_button_grabs); + _ecore_xcb_button_grabs = NULL; + return; + } + + t = realloc(_ecore_xcb_button_grabs, + _ecore_xcb_button_grabs_num * sizeof(Ecore_X_Window)); + if (!t) return; + _ecore_xcb_button_grabs = t; + } + } +} + +void +_ecore_xcb_window_key_grab_remove(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (_ecore_xcb_key_grabs_num > 0) + { + int i = 0, shuffle = 0; + + for (i = 0; i < _ecore_xcb_key_grabs_num; i++) + { + if (shuffle) + _ecore_xcb_key_grabs[i - 1] = _ecore_xcb_key_grabs[i]; + + if ((!shuffle) && (_ecore_xcb_key_grabs[i] == win)) + shuffle = 1; + } + + if (shuffle) + { + Ecore_X_Window *t; + + _ecore_xcb_key_grabs_num--; + if (_ecore_xcb_key_grabs_num <= 0) + { + free(_ecore_xcb_key_grabs); + _ecore_xcb_key_grabs = NULL; + return; + } + + t = realloc(_ecore_xcb_key_grabs, + _ecore_xcb_key_grabs_num * sizeof(Ecore_X_Window)); + if (!t) return; + _ecore_xcb_key_grabs = t; + } + } +} + +void +_ecore_xcb_window_grab_allow_events(Ecore_X_Window event_win, + Ecore_X_Window child_win, + int type, + void *event, + Ecore_X_Time timestamp) +{ + int i = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + for (i = 0; i < _ecore_xcb_button_grabs_num; i++) + { + if ((_ecore_xcb_button_grabs[i] == event_win) || + (_ecore_xcb_button_grabs[i] == child_win)) + { + Eina_Bool replay = EINA_FALSE; + + if (_ecore_xcb_window_grab_replay_func) + { + replay = + _ecore_xcb_window_grab_replay_func(_ecore_xcb_window_grab_replay_data, + type, event); + } + if (replay) + { + xcb_allow_events(_ecore_xcb_conn, + XCB_ALLOW_REPLAY_POINTER, timestamp); + } + else + { + xcb_allow_events(_ecore_xcb_conn, + XCB_ALLOW_ASYNC_POINTER, timestamp); + } + break; + } + } +} + +static int +_ecore_xcb_window_modifiers_get(unsigned int state) +{ + int xmodifiers = 0; + + if (state & ECORE_EVENT_MODIFIER_SHIFT) + xmodifiers |= ECORE_X_MODIFIER_SHIFT; + if (state & ECORE_EVENT_MODIFIER_CTRL) + xmodifiers |= ECORE_X_MODIFIER_CTRL; + if (state & ECORE_EVENT_MODIFIER_ALT) + xmodifiers |= ECORE_X_MODIFIER_ALT; + if (state & ECORE_EVENT_MODIFIER_WIN) + xmodifiers |= ECORE_X_MODIFIER_WIN; + if (state & ECORE_EVENT_LOCK_SCROLL) + xmodifiers |= ECORE_X_LOCK_SCROLL; + if (state & ECORE_EVENT_LOCK_NUM) + xmodifiers |= ECORE_X_LOCK_NUM; + if (state & ECORE_EVENT_LOCK_CAPS) + xmodifiers |= ECORE_X_LOCK_CAPS; + if (state & ECORE_EVENT_LOCK_SHIFT) + xmodifiers |= ECORE_X_LOCK_SHIFT; + + return xmodifiers; +} + +static xcb_visualtype_t * +_ecore_xcb_window_find_visual_by_id(xcb_visualid_t id) +{ + xcb_depth_iterator_t diter; + xcb_visualtype_iterator_t viter; + + CHECK_XCB_CONN; + diter = xcb_screen_allowed_depths_iterator(_ecore_xcb_screen); + for (; diter.rem; xcb_depth_next(&diter)) + { + viter = xcb_depth_visuals_iterator(diter.data); + for (; viter.rem; xcb_visualtype_next(&viter)) + { + if (viter.data->visual_id == id) + return viter.data; + } + } + return 0; +} + +#ifdef ECORE_XCB_XPRINT +static xcb_screen_t * +_ecore_xcb_window_screen_of_display(int screen) +{ + xcb_screen_iterator_t iter; + + CHECK_XCB_CONN; + iter = xcb_setup_roots_iterator(xcb_get_setup(_ecore_xcb_conn)); + for (; iter.rem; --screen, xcb_screen_next(&iter)) + if (screen == 0) + return iter.data; + + return NULL; +} + +#endif diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c new file mode 100644 index 0000000..e00fdc1 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_prop.c @@ -0,0 +1,720 @@ +#include "ecore_xcb_private.h" +#include + +EAPI int +ecore_x_window_prop_card32_get(Ecore_X_Window win, + Ecore_X_Atom atom, + unsigned int *val, + unsigned int len) +{ + xcb_get_property_cookie_t cookie; + xcb_get_property_reply_t *reply; + int num = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom, + ECORE_X_ATOM_CARDINAL, 0, 0x7fffffff); + reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return -1; + + if ((reply->type != ECORE_X_ATOM_CARDINAL) || (reply->format != 32)) + num = -1; + else if (reply->value_len == 0) + num = 0; + else + { + if (reply->value_len < len) + len = reply->value_len; + + if (val) + { + unsigned int i = 0; + unsigned char *v; + + v = xcb_get_property_value(reply); + for (i = 0; i < len; i++) + val[i] = ((uint32_t *)v)[i]; + num = len; + } + } + + if (reply) free(reply); + return num; +} + +EAPI void +ecore_x_window_prop_card32_set(Ecore_X_Window win, + Ecore_X_Atom atom, + unsigned int *val, + unsigned int num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#if SIZEOF_INT == SIZEOF_LONG + xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, + ECORE_X_ATOM_CARDINAL, 32, num, (unsigned char *)val); +// ecore_x_flush(); +#else + long *v2; + unsigned int i; + + v2 = malloc(num * sizeof(long)); + if (!v2) return; + for (i = 0; i < num; i++) + v2[i] = val[i]; + + xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, + ECORE_X_ATOM_CARDINAL, 32, num, (unsigned char *)v2); + free(v2); +// ecore_x_flush(); +#endif +} + +EAPI int +ecore_x_window_prop_card32_list_get(Ecore_X_Window win, + Ecore_X_Atom atom, + unsigned int **list) +{ + xcb_get_property_cookie_t cookie; + xcb_get_property_reply_t *reply; + int num = -1; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (list) *list = NULL; + + cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom, + XCB_ATOM_CARDINAL, 0, 0x7fffffff); + reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return -1; + + if ((reply->type != XCB_ATOM_CARDINAL) || (reply->format != 32)) + num = -1; + else if ((reply->value_len == 0) || (!xcb_get_property_value(reply))) + num = 0; + else + { + num = reply->value_len; + if (list) + { + unsigned int *val; + void *data; + int i = 0; + + val = malloc(num * sizeof(unsigned int)); + if (!val) + { + free(reply); + return -1; + } + data = xcb_get_property_value(reply); + for (i = 0; i < num; i++) + val[i] = ((uint32_t *)data)[i]; + *list = val; + } + } + + free(reply); + return num; +} + +EAPI int +ecore_x_window_prop_atom_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom *list, + unsigned int len) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_ATOM, list, len); +} + +EAPI void +ecore_x_window_prop_atom_set(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom *list, + unsigned int num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + /* xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, */ + /* ECORE_X_ATOM_ATOM, 32, num, list); */ + ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_ATOM, list, num); +} + +EAPI void +ecore_x_window_prop_xid_set(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID *xids, + unsigned int num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#if SIZEOF_INT == SIZEOF_LONG + xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, + type, 32, num, (unsigned char *)xids); +// ecore_x_flush(); +#else + long *v2; + unsigned int i; + + v2 = malloc(num * sizeof(long)); + if (!v2) return; + for (i = 0; i < num; i++) + v2[i] = xids[i]; + + xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, atom, + type, 32, num, (unsigned char *)v2); + free(v2); +// ecore_x_flush(); +#endif +} + +EAPI int +ecore_x_window_prop_xid_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID *xids, + unsigned int len) +{ + xcb_get_property_cookie_t cookie; + xcb_get_property_reply_t *reply; + int num = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + num = len; + cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom, type, + 0, 0x7fffffff); + reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return -1; + + if ((reply->type != type) || (reply->format != 32)) + num = -1; + else if (reply->value_len == 0) + num = 0; + else + { + unsigned int i = 0; + unsigned char *v; + + if (reply->value_len < len) + len = reply->value_len; + + v = xcb_get_property_value(reply); + for (i = 0; i < len; i++) + xids[i] = ((uint32_t *)v)[i]; + + num = len; + } + + if (reply) free(reply); + return num; +} + +EAPI void +ecore_x_window_prop_string_set(Ecore_X_Window win, + Ecore_X_Atom type, + const char *str) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, type, + ECORE_X_ATOM_UTF8_STRING, 8, strlen(str), str); +// ecore_x_flush(); +} + +EAPI char * +ecore_x_window_prop_string_get(Ecore_X_Window win, + Ecore_X_Atom type) +{ + xcb_get_property_cookie_t cookie; + xcb_get_property_reply_t *reply; + char *str = NULL; + int len = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + cookie = + xcb_get_property_unchecked(_ecore_xcb_conn, 0, + win ? win : ((xcb_screen_t *)_ecore_xcb_screen)->root, + type, XCB_GET_PROPERTY_TYPE_ANY, 0, 1000000L); + reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return NULL; + + len = ((reply->value_len * reply->format) / 8); + str = (char *)malloc((len + 1) * sizeof(char)); + memcpy(str, xcb_get_property_value(reply), len); + str[len] = '\0'; + + if (reply->type != ECORE_X_ATOM_UTF8_STRING) + { + Ecore_Xcb_Textproperty prop; + int count = 0; + char **list = NULL; + Eina_Bool ret = EINA_FALSE; + + prop.value = strdup(str); + prop.nitems = len; + prop.encoding = reply->type; + +#ifdef HAVE_ICONV + ret = _ecore_xcb_utf8_textproperty_to_textlist(&prop, &list, &count); +#else + ret = _ecore_xcb_mb_textproperty_to_textlist(&prop, &list, &count); +#endif + if (ret) + { + if (count > 0) + str = strdup(list[0]); + else + str = strdup((char *)prop.value); + + if (list) free(list); + } + else + str = strdup((char *)prop.value); + } + + free(reply); + return str; +} + +EAPI int +ecore_x_window_prop_window_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Window *list, + unsigned int len) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return ecore_x_window_prop_xid_get(win, atom, ECORE_X_ATOM_WINDOW, list, len); +} + +EAPI void +ecore_x_window_prop_window_set(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Window *list, + unsigned int num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_x_window_prop_xid_set(win, atom, ECORE_X_ATOM_WINDOW, list, num); +} + +EAPI int +ecore_x_window_prop_window_list_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Window **plst) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_WINDOW, plst); +} + +EAPI Ecore_X_Atom +ecore_x_window_prop_any_type(void) +{ + return XCB_ATOM_ANY; +} + +EAPI void +ecore_x_window_prop_property_del(Ecore_X_Window win, + Ecore_X_Atom property) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + xcb_delete_property(_ecore_xcb_conn, win, property); +} + +EAPI void +ecore_x_window_prop_property_set(Ecore_X_Window win, + Ecore_X_Atom property, + Ecore_X_Atom type, + int size, + void *data, + int num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (win == 0) + win = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + if (size != 32) + { + xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, + property, type, size, num, (unsigned char *)data); +// ecore_x_flush(); + } + else + { + uint32_t *dat; + int i = 0, *ptr; + + dat = malloc(sizeof(uint32_t) * num); + if (dat) + { + for (ptr = (int *)data, i = 0; i < num; i++) + dat[i] = ptr[i]; + xcb_change_property(_ecore_xcb_conn, XCB_PROP_MODE_REPLACE, win, + property, type, size, num, + (unsigned char *)dat); + free(dat); +// ecore_x_flush(); + } + } +} + +EAPI int +ecore_x_window_prop_property_get(Ecore_X_Window win, + Ecore_X_Atom property, + Ecore_X_Atom type, + int size, + unsigned char **data, + int *num) +{ + xcb_get_property_cookie_t cookie; + xcb_get_property_reply_t *reply; + int format = 0; + unsigned int i = 0; + void *value; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (num) *num = 0; + + if (data) + *data = NULL; + else + return 0; + + if (win == 0) + win = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + cookie = + xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, + property, type, 0, UINT_MAX); + reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return 0; + if ((reply->format != size) || (reply->value_len == 0)) + { + free(reply); + return 0; + } + + if (!(*data = malloc(reply->value_len * reply->format / 8))) + { + free(reply); + return 0; + } + + value = xcb_get_property_value(reply); + switch (reply->format) + { + case 8: + for (i = 0; i < reply->value_len; i++) + (*data)[i] = ((unsigned char *)value)[i]; + break; + + case 16: + for (i = 0; i < reply->value_len; i++) + ((unsigned short *)*data)[i] = ((unsigned short *)value)[i]; + break; + + case 32: + for (i = 0; i < reply->value_len; i++) + ((unsigned int *)*data)[i] = ((uint32_t *)value)[i]; + break; + } + + if (num) *num = reply->value_len; + format = reply->format; + free(reply); + return format; +} + +EAPI int +ecore_x_window_prop_atom_list_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom **list) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return ecore_x_window_prop_xid_list_get(win, atom, ECORE_X_ATOM_ATOM, list); +} + +EAPI void +ecore_x_window_prop_atom_list_change(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom item, + int op) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_xid_list_change(win, atom, ECORE_X_ATOM_ATOM, item, op); +} + +EAPI int +ecore_x_window_prop_xid_list_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID **xids) +{ + xcb_get_property_cookie_t cookie; + xcb_get_property_reply_t *reply; + int num = -1; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (xids) *xids = NULL; + + cookie = xcb_get_property_unchecked(_ecore_xcb_conn, 0, win, atom, type, + 0, 0x7fffffff); + reply = xcb_get_property_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return -1; + + if ((reply->type != type) || (reply->format != 32)) + num = -1; + else if ((reply->value_len == 0) || (!xcb_get_property_value(reply))) + num = 0; + else + { + Ecore_X_Atom *alst; + void *val; + + num = xcb_get_property_value_length(reply); + val = xcb_get_property_value(reply); + alst = malloc(num * sizeof(Ecore_X_ID)); + if (alst) + { + int i = 0; + + for (i = 0; i < num; i++) + alst[i] = ((uint32_t *)val)[i]; + *xids = alst; + } + } + + free(reply); + return num; +} + +EAPI void +ecore_x_window_prop_xid_list_change(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID item, + int op) +{ + Ecore_X_ID *lst; + int i = 0, num = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + num = ecore_x_window_prop_xid_list_get(win, atom, type, &lst); + if (num < 0) return; + + for (i = 0; i < num; i++) + { + if (lst[i] == item) break; + } + + if (i < num) + { + if (op == ECORE_X_PROP_LIST_ADD) + goto done; + num--; + for (; i < num; i++) + lst[i] = lst[i + 1]; + } + else + { + if (op == ECORE_X_PROP_LIST_REMOVE) + goto done; + num++; + lst = realloc(lst, num * sizeof(Ecore_X_ID)); + lst[i] = item; + } + ecore_x_window_prop_xid_set(win, atom, type, lst, num); + +done: + if (lst) free(lst); +} + +EAPI Eina_Bool +ecore_x_window_prop_protocol_isset(Ecore_X_Window win, + Ecore_X_WM_Protocol protocol) +{ + Eina_Bool ret = EINA_FALSE; + Ecore_X_Atom proto; +#ifdef OLD_XCB_VERSION + xcb_get_wm_protocols_reply_t protos; +#else + xcb_icccm_get_wm_protocols_reply_t protos; +#endif + xcb_get_property_cookie_t cookie; + uint8_t reply; + uint32_t count = 0, i = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (protocol >= ECORE_X_WM_PROTOCOL_NUM) return EINA_FALSE; + + proto = _ecore_xcb_atoms_wm_protocol[protocol]; +#ifdef OLD_XCB_VERSION + cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win, + ECORE_X_ATOM_WM_PROTOCOLS); + reply = xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL); +#else + cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win, + ECORE_X_ATOM_WM_PROTOCOLS); + reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie, + &protos, NULL); +#endif + if (!reply) return EINA_FALSE; + + count = protos.atoms_len; + for (i = 0; i < count; i++) + { + if (protos.atoms[i] == proto) + { + ret = EINA_TRUE; + break; + } + } + +#ifdef OLD_XCB_VERSION + xcb_get_wm_protocols_reply_wipe(&protos); +#else + xcb_icccm_get_wm_protocols_reply_wipe(&protos); +#endif + return ret; +} + +EAPI Ecore_X_WM_Protocol * +ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, + int *num_ret) +{ +#ifdef OLD_XCB_VERSION + xcb_get_wm_protocols_reply_t protos; +#else + xcb_icccm_get_wm_protocols_reply_t protos; +#endif + xcb_get_property_cookie_t cookie; + uint8_t reply; + uint32_t count = 0, i = 0; + Ecore_X_WM_Protocol *prot_ret = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!num_ret) return NULL; + + *num_ret = 0; + +#ifdef OLD_XCB_VERSION + cookie = xcb_get_wm_protocols_unchecked(_ecore_xcb_conn, win, + ECORE_X_ATOM_WM_PROTOCOLS); + reply = xcb_get_wm_protocols_reply(_ecore_xcb_conn, cookie, &protos, NULL); +#else + cookie = xcb_icccm_get_wm_protocols_unchecked(_ecore_xcb_conn, win, + ECORE_X_ATOM_WM_PROTOCOLS); + reply = xcb_icccm_get_wm_protocols_reply(_ecore_xcb_conn, cookie, + &protos, NULL); +#endif + if (!reply) return NULL; + + count = protos.atoms_len; + if (count <= 0) + { +#ifdef OLD_XCB_VERSION + xcb_get_wm_protocols_reply_wipe(&protos); +#else + xcb_icccm_get_wm_protocols_reply_wipe(&protos); +#endif + return NULL; + } + + prot_ret = calloc(1, count * sizeof(Ecore_X_WM_Protocol)); + if (!prot_ret) + { +#ifdef OLD_XCB_VERSION + xcb_get_wm_protocols_reply_wipe(&protos); +#else + xcb_icccm_get_wm_protocols_reply_wipe(&protos); +#endif + return NULL; + } + + for (i = 0; i < count; i++) + { + Ecore_X_WM_Protocol j; + + prot_ret[i] = -1; + for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++) + { + if (_ecore_xcb_atoms_wm_protocol[j] == protos.atoms[i]) + prot_ret[i] = j; + } + } + + if (num_ret) *num_ret = count; + +#ifdef OLD_XCB_VERSION + xcb_get_wm_protocols_reply_wipe(&protos); +#else + xcb_icccm_get_wm_protocols_reply_wipe(&protos); +#endif + return prot_ret; +} + +EAPI Ecore_X_Atom * +ecore_x_window_prop_list(Ecore_X_Window win, + int *num) +{ + xcb_list_properties_cookie_t cookie; + xcb_list_properties_reply_t *reply; + xcb_atom_t *atm; + Ecore_X_Atom *atoms; + int i = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (num) *num = 0; + + cookie = xcb_list_properties_unchecked(_ecore_xcb_conn, win); + reply = xcb_list_properties_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return NULL; + + atoms = (Ecore_X_Atom *)malloc(reply->atoms_len * sizeof(Ecore_X_Atom)); + if (!atoms) + { + free(reply); + return NULL; + } + + atm = xcb_list_properties_atoms(reply); + for (i = 0; i < reply->atoms_len; i++) + atoms[i] = atm[i]; + + if (num) *num = reply->atoms_len; + free(reply); + + return atoms; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_shadow.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_shadow.c new file mode 100644 index 0000000..4f24d62 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_shadow.c @@ -0,0 +1,408 @@ +#include "ecore_xcb_private.h" + +typedef struct _Shadow Shadow; +struct _Shadow +{ + Shadow *parent, **children; + Ecore_X_Window win; + int children_num; + short x, y; + unsigned short w, h; +}; + +static Eina_Bool _inside_rects(Shadow *s, + int x, + int y, + int bx, + int by, + Ecore_X_Rectangle *rects, + int num); + +//static int shadow_count = 0; +static Shadow **shadow_base = NULL; +static int shadow_num = 0; + +/* FIXME: round trips */ +static Shadow * +_ecore_x_window_tree_walk(Ecore_X_Window window) +{ + Shadow *s, **sl; + xcb_get_window_attributes_reply_t *reply_attr; + xcb_get_geometry_reply_t *reply_geom; + xcb_query_tree_reply_t *reply_tree; + xcb_get_window_attributes_cookie_t cookie_attr; + xcb_get_geometry_cookie_t cookie_geom; + xcb_query_tree_cookie_t cookie_tree; + int i, j; + + CHECK_XCB_CONN; + + cookie_attr = xcb_get_window_attributes_unchecked(_ecore_xcb_conn, window); + reply_attr = xcb_get_window_attributes_reply(_ecore_xcb_conn, cookie_attr, NULL); + if (!reply_attr) return NULL; + if (reply_attr->map_state != XCB_MAP_STATE_VIEWABLE) + { + free(reply_attr); + return NULL; + } + + free(reply_attr); + + cookie_geom = xcb_get_geometry_unchecked(_ecore_xcb_conn, window); + reply_geom = xcb_get_geometry_reply(_ecore_xcb_conn, cookie_geom, NULL); + if (!reply_geom) return NULL; + + if (!(s = calloc(1, sizeof(Shadow)))) + { + free(reply_geom); + return NULL; + } + + s->win = window; + s->x = reply_geom->x; + s->y = reply_geom->y; + s->w = reply_geom->width; + s->h = reply_geom->height; + + free(reply_geom); + + cookie_tree = xcb_query_tree_unchecked(_ecore_xcb_conn, window); + reply_tree = xcb_query_tree_reply(_ecore_xcb_conn, cookie_tree, NULL); + if (reply_tree) + { + xcb_window_t *list; + int num; + + num = xcb_query_tree_children_length(reply_tree); + list = xcb_query_tree_children(reply_tree); + + s->children = calloc(1, sizeof(Shadow *) * num); + if (s->children) + { + s->children_num = num; + for (i = 0; i < num; i++) + { + s->children[i] = _ecore_x_window_tree_walk(list[i]); + if (s->children[i]) + s->children[i]->parent = s; + } + /* compress list down */ + j = 0; + for (i = 0; i < num; i++) + { + if (s->children[i]) + { + s->children[j] = s->children[i]; + j++; + } + } + if (j == 0) + { + free(s->children); + s->children = NULL; + s->children_num = 0; + } + else + { + s->children_num = j; + sl = realloc(s->children, sizeof(Shadow *) * j); + if (sl) s->children = sl; + } + } + + free(reply_tree); + } + + return s; +} + +static void +_ecore_x_window_tree_shadow_free1(Shadow *s) +{ + int i = 0; + + if (!s) return; + if (s->children) + { + for (i = 0; i < s->children_num; i++) + { + if (s->children[i]) + _ecore_x_window_tree_shadow_free1(s->children[i]); + } + free(s->children); + } + + free(s); +} + +static void +_ecore_x_window_tree_shadow_free(void) +{ + int i = 0; + + if (!shadow_base) return; + + for (i = 0; i < shadow_num; i++) + { + if (!shadow_base[i]) continue; + _ecore_x_window_tree_shadow_free1(shadow_base[i]); + } + free(shadow_base); + shadow_base = NULL; + shadow_num = 0; +} + +static void +_ecore_x_window_tree_shadow_populate(void) +{ + Ecore_X_Window *roots = NULL; + int i = 0, num = 0; + + if ((roots = ecore_x_window_root_list(&num))) + { + shadow_base = calloc(1, sizeof(Shadow *) * num); + if (shadow_base) + { + shadow_num = num; + for (i = 0; i < num; i++) + shadow_base[i] = _ecore_x_window_tree_walk(roots[i]); + } + + free(roots); + } +} + +/* + static void + _ecore_x_window_tree_shadow_start(void) + { + shadow_count++; + if (shadow_count > 1) return; + _ecore_x_window_tree_shadow_populate(); + } + + static void + _ecore_x_window_tree_shadow_stop(void) + { + shadow_count--; + if (shadow_count != 0) return; + _ecore_x_window_tree_shadow_free(); + } + */ + +Shadow * +_ecore_x_window_shadow_tree_find_shadow(Shadow *s, + Ecore_X_Window win) +{ + Shadow *ss; + int i = 0; + + if (s->win == win) return s; + + if (s->children) + { + for (i = 0; i < s->children_num; i++) + { + if (!s->children[i]) continue; + + if ((ss = + _ecore_x_window_shadow_tree_find_shadow(s->children[i], win))) + return ss; + } + } + + return NULL; +} + +Shadow * +_ecore_x_window_shadow_tree_find(Ecore_X_Window base) +{ + Shadow *s; + int i = 0; + + for (i = 0; i < shadow_num; i++) + { + if (!shadow_base[i]) continue; + + if ((s = + _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base))) + return s; + } + return NULL; +} + +static Ecore_X_Window +_ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, + int bx, + int by, + int x, + int y, + Ecore_X_Window *skip, + int skip_num) +{ + Ecore_X_Window child; + Ecore_X_Rectangle *rects; + int i = 0, j = 0, wx = 0, wy = 0, num = 0; + + wx = s->x + bx; + wy = s->y + by; + if (!((x >= wx) && (y >= wy) && (x < (wx + s->w)) && (y < (wy + s->h)))) + return 0; + + rects = ecore_x_window_shape_rectangles_get(s->win, &num); + if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0; + num = 0; + rects = ecore_x_window_shape_input_rectangles_get(s->win, &num); + if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0; + + if (s->children) + { + int skipit = 0; + + for (i = s->children_num - 1; i >= 0; --i) + { + if (!s->children[i]) continue; + + skipit = 0; + if (skip) + { + for (j = 0; j < skip_num; j++) + { + if (s->children[i]->win == skip[j]) + { + skipit = 1; + goto onward; + } + } + } +onward: + if (!skipit) + { + if ((child = + _ecore_x_window_shadow_tree_at_xy_get_shadow(s->children[i], wx, wy, x, y, skip, skip_num))) + return child; + } + } + } + + return s->win; +} + +static Ecore_X_Window +_ecore_x_window_shadow_tree_at_xy_get(Ecore_X_Window base, + int bx, + int by, + int x, + int y, + Ecore_X_Window *skip, + int skip_num) +{ + Shadow *s; + + if (!shadow_base) + { + _ecore_x_window_tree_shadow_populate(); + if (!shadow_base) return 0; + } + + s = _ecore_x_window_shadow_tree_find(base); + if (!s) return 0; + + return _ecore_x_window_shadow_tree_at_xy_get_shadow(s, bx, by, x, y, skip, skip_num); +} + +static Eina_Bool +_inside_rects(Shadow *s, + int x, + int y, + int bx, + int by, + Ecore_X_Rectangle *rects, + int num) +{ + Eina_Bool inside = EINA_FALSE; + int i = 0; + + if (!rects) return EINA_FALSE; + for (i = 0; i < num; i++) + { + if ((x >= s->x + bx + rects[i].x) && + (y >= s->y + by + rects[i].y) && + (x < (int)(s->x + bx + rects[i].x + rects[i].width)) && + (y < (int)(s->y + by + rects[i].y + rects[i].height))) + { + inside = EINA_TRUE; + break; + } + } + free(rects); + return inside; +} + +/** + * Retrieves the top, visible window at the given location, + * but skips the windows in the list. This uses a shadow tree built from the + * window tree that is only updated the first time + * ecore_x_window_shadow_tree_at_xy_with_skip_get() is called, or the next time + * it is called after a ecore_x_window_shadow_tree_flush() + * @param base The base window to start searching from (normally root). + * @param x The given X position. + * @param y The given Y position. + * @return The window at that position. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI Ecore_X_Window +ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, + int x, + int y, + Ecore_X_Window *skip, + int skip_num) +{ + return _ecore_x_window_shadow_tree_at_xy_get(base, 0, 0, x, y, skip, skip_num); +} + +/** + * Retrieves the parent window a given window has. This uses the shadow window + * tree. + * @param root The root window of @p win - if 0, this will be automatically determined with extra processing overhead + * @param win The window to get the parent window of + * @return The parent window of @p win + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI Ecore_X_Window +ecore_x_window_shadow_parent_get(Ecore_X_Window root __UNUSED__, + Ecore_X_Window win) +{ + Shadow *s; + int i = 0; + + if (!shadow_base) + { + _ecore_x_window_tree_shadow_populate(); + if (!shadow_base) return 0; + } + + for (i = 0; i < shadow_num; i++) + { + if (!shadow_base[i]) continue; + + s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], win); + if (s) + { + if (!s->parent) return 0; + return s->parent->win; + } + } + return 0; +} + +/** + * Flushes the window shadow tree so nothing is stored. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI void +ecore_x_window_shadow_tree_flush(void) +{ + _ecore_x_window_tree_shadow_free(); +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_shape.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_shape.c new file mode 100644 index 0000000..6206a51 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_window_shape.c @@ -0,0 +1,790 @@ +#include "ecore_xcb_private.h" +#ifdef ECORE_XCB_SHAPE +# include +#endif + +/** + * @defgroup Ecore_X_Window_Shape X Window Shape Functions + * + * These functions use the shape extension of the X server to change + * shape of given windows. + */ + +/** + * Sets the input shape of the given window to that given by the pixmap @p mask. + * @param win The given window. + * @param mask A 1-bit depth pixmap that provides the new input shape of the + * window. + * @ingroup Ecore_X_Window_Shape + */ +EAPI void +ecore_x_window_shape_input_mask_set(Ecore_X_Window win, + Ecore_X_Pixmap mask) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, + win, 0, 0, mask); +// ecore_x_flush(); +#else + return; + win = 0; + mask = 0; +#endif +} + +/** + * Sets the shape of the given window to that given by the pixmap @p mask. + * @param win The given window. + * @param mask A 2-bit depth pixmap that provides the new shape of the + * window. + * @ingroup Ecore_X_Window_Shape + */ +EAPI void +ecore_x_window_shape_mask_set(Ecore_X_Window win, + Ecore_X_Pixmap mask) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + xcb_shape_mask(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, + win, 0, 0, mask); +// ecore_x_flush(); +#else + return; + win = 0; + mask = 0; +#endif +} + +EAPI void +ecore_x_window_shape_window_set(Ecore_X_Window win, + Ecore_X_Window shape_win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, + XCB_SHAPE_SK_BOUNDING, win, 0, 0, shape_win); +// ecore_x_flush(); +#else + return; + win = 0; + shape_win = 0; +#endif +} + +EAPI void +ecore_x_window_shape_window_set_xy(Ecore_X_Window win, + Ecore_X_Window shape_win, + int x, + int y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, + XCB_SHAPE_SK_BOUNDING, win, x, y, shape_win); +// ecore_x_flush(); +#else + return; + win = 0; + shape_win = 0; + x = 0; + y = 0; +#endif +} + +EAPI void +ecore_x_window_shape_rectangle_set(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ +#ifdef ECORE_XCB_SHAPE + xcb_rectangle_t rect; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, + XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, + win, 0, 0, 1, &rect); +// ecore_x_flush(); +#else + return; + win = 0; + x = 0; + y = 0; + w = 0; + h = 0; +#endif +} + +EAPI void +ecore_x_window_shape_rectangles_set(Ecore_X_Window win, + Ecore_X_Rectangle *rects, + int num) +{ +#ifdef ECORE_XCB_SHAPE + xcb_rectangle_t *rect = NULL; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!rects) return; + +#ifdef ECORE_XCB_SHAPE + if (num > 0) + { + int i = 0; + + if (!(rect = malloc(sizeof(xcb_rectangle_t) * num))) + return; + + for (i = 0; i < num; i++) + { + rect[i].x = rects[i].x; + rect[i].y = rects[i].y; + rect[i].width = rects[i].width; + rect[i].height = rects[i].height; + } + } + xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, + XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, + win, 0, 0, num, (xcb_rectangle_t *)rect); + + if (rect) free(rect); +// ecore_x_flush(); +#else + return; + win = 0; + num = 0; + rects = NULL; +#endif +} + +EAPI void +ecore_x_window_shape_window_add(Ecore_X_Window win, + Ecore_X_Window shape_win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, + XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, + win, 0, 0, shape_win); +// ecore_x_flush(); +#else + return; + win = 0; + shape_win = 0; +#endif +} + +EAPI void +ecore_x_window_shape_window_add_xy(Ecore_X_Window win, + Ecore_X_Window shape_win, + int x, + int y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, + XCB_SHAPE_SK_BOUNDING, XCB_SHAPE_SK_BOUNDING, + win, x, y, shape_win); +// ecore_x_flush(); +#else + return; + win = 0; + shape_win = 0; + x = 0; + y = 0; +#endif +} + +EAPI void +ecore_x_window_shape_rectangle_add(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ +#ifdef ECORE_XCB_SHAPE + xcb_rectangle_t rect; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, + XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, + win, 0, 0, 1, &rect); +// ecore_x_flush(); +#else + return; + win = 0; + x = 0; + y = 0; + w = 0; + h = 0; +#endif +} + +EAPI void +ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ +#ifdef ECORE_XCB_SHAPE + xcb_rectangle_t rect; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SUBTRACT, + XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, + win, 0, 0, 1, &rect); +// ecore_x_flush(); +#else + return; + win = 0; + x = 0; + y = 0; + w = 0; + h = 0; +#endif +} + +EAPI void +ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ +#ifdef ECORE_XCB_SHAPE + xcb_rectangle_t rect; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_INTERSECT, + XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, + win, 0, 0, 1, &rect); +// ecore_x_flush(); +#else + return; + win = 0; + x = 0; + y = 0; + w = 0; + h = 0; +#endif +} + +EAPI void +ecore_x_window_shape_rectangles_add(Ecore_X_Window win, + Ecore_X_Rectangle *rects, + int num) +{ +#ifdef ECORE_XCB_SHAPE + xcb_rectangle_t *rect = NULL; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + if (num > 0) + { + int i = 0; + + if (!(rect = malloc(sizeof(xcb_rectangle_t) * num))) + return; + + for (i = 0; i < num; i++) + { + rect[i].x = rects[i].x; + rect[i].y = rects[i].y; + rect[i].width = rects[i].width; + rect[i].height = rects[i].height; + } + } + + xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, + XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, + win, 0, 0, num, (xcb_rectangle_t *)&rect); + + if (rect) free(rect); +// ecore_x_flush(); +#else + return; + win = 0; + num = 0; + rects = NULL; +#endif +} + +EAPI Ecore_X_Rectangle * +ecore_x_window_shape_rectangles_get(Ecore_X_Window win, + int *num_ret) +{ + Ecore_X_Rectangle *rects = NULL; +#ifdef ECORE_XCB_SHAPE + xcb_shape_get_rectangles_cookie_t cookie; + xcb_shape_get_rectangles_reply_t *reply; + xcb_rectangle_t *r; + unsigned int i = 0; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (num_ret) *num_ret = 0; + +#ifdef ECORE_XCB_SHAPE + cookie = + xcb_shape_get_rectangles(_ecore_xcb_conn, win, XCB_SHAPE_SK_BOUNDING); + reply = xcb_shape_get_rectangles_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return NULL; + if (num_ret) *num_ret = reply->rectangles_len; + + if (reply->rectangles_len < 1) + { + free(reply); + if (num_ret) *num_ret = 0; + return NULL; + } + + rects = malloc(sizeof(Ecore_X_Rectangle) * reply->rectangles_len); + if (!rects) + { + free(reply); + if (num_ret) *num_ret = 0; + return NULL; + } + r = xcb_shape_get_rectangles_rectangles(reply); + for (i = 0; i < reply->rectangles_len; i++) + { + rects[i].x = r[i].x; + rects[i].y = r[i].y; + rects[i].width = r[i].width; + rects[i].height = r[i].height; + } + + free(reply); + + return rects; +#else + return rects; + win = 0; +#endif +} + +EAPI void +ecore_x_window_shape_events_select(Ecore_X_Window win, + Eina_Bool on) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + xcb_shape_select_input(_ecore_xcb_conn, win, on); +// ecore_x_flush(); +#else + return; + win = 0; + on = 0; +#endif +} + +EAPI Ecore_X_Rectangle * +ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, + int *num_ret) +{ + Ecore_X_Rectangle *rects = NULL; +#ifdef ECORE_XCB_SHAPE + xcb_shape_get_rectangles_cookie_t cookie; + xcb_shape_get_rectangles_reply_t *reply; + xcb_rectangle_t *r; + unsigned int i = 0; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (num_ret) *num_ret = 0; + +#ifdef ECORE_XCB_SHAPE + cookie = + xcb_shape_get_rectangles(_ecore_xcb_conn, win, XCB_SHAPE_SK_INPUT); + reply = xcb_shape_get_rectangles_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return NULL; + if (num_ret) *num_ret = reply->rectangles_len; + + if (reply->rectangles_len < 1) + { + free(reply); + if (num_ret) *num_ret = 0; + return NULL; + } + + rects = malloc(sizeof(Ecore_X_Rectangle) * reply->rectangles_len); + if (!rects) + { + free(reply); + if (num_ret) *num_ret = 0; + return NULL; + } + r = xcb_shape_get_rectangles_rectangles(reply); + for (i = 0; i < reply->rectangles_len; i++) + { + rects[i].x = r[i].x; + rects[i].y = r[i].y; + rects[i].width = r[i].width; + rects[i].height = r[i].height; + } + + free(reply); + + return rects; +#else + xcb_get_geometry_cookie_t cookie; + xcb_get_geometry_reply_t *reply; + + if (!(rects = malloc(sizeof(Ecore_X_Rectangle)))) + return NULL; + + /* get geometry */ + cookie = xcb_get_geometry_unchecked(_ecore_xcb_conn, win); + reply = xcb_get_geometry_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + rects[0].x = reply->x; + rects[0].y = reply->y; + rects[0].width = reply->width; + rects[0].height = reply->height; + free(reply); + } + if (num_ret) *num_ret = 1; + return rects; +#endif +} + +EAPI void +ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win, + Ecore_X_Rectangle *rects, + int num) +{ +#ifdef ECORE_XCB_SHAPE + xcb_rectangle_t *rect = NULL; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!rects) return; + +#ifdef ECORE_XCB_SHAPE + if (num > 0) + { + int i = 0; + + if (!(rect = malloc(sizeof(xcb_rectangle_t) * num))) + return; + + for (i = 0; i < num; i++) + { + rect[i].x = rects[i].x; + rect[i].y = rects[i].y; + rect[i].width = rects[i].width; + rect[i].height = rects[i].height; + } + } + xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, + XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, + win, 0, 0, num, (xcb_rectangle_t *)rect); + + if (rect) free(rect); +// ecore_x_flush(); +#else + return; + win = 0; + num = 0; + rects = NULL; +#endif +} + +EAPI void +ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ +#ifdef ECORE_XCB_SHAPE + xcb_rectangle_t rect; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SUBTRACT, + XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, + win, 0, 0, 1, &rect); +// ecore_x_flush(); +#else + return; + win = 0; + x = 0; + y = 0; + w = 0; + h = 0; +#endif +} + +EAPI void +ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ +#ifdef ECORE_XCB_SHAPE + xcb_rectangle_t rect; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, + XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, + win, 0, 0, 1, &rect); +// ecore_x_flush(); +#else + return; + win = 0; + x = 0; + y = 0; + w = 0; + h = 0; +#endif +} + +EAPI void +ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ +#ifdef ECORE_XCB_SHAPE + xcb_rectangle_t rect; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_SET, + XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, + win, 0, 0, 1, &rect); +// ecore_x_flush(); +#else + return; + win = 0; + x = 0; + y = 0; + w = 0; + h = 0; +#endif +} + +EAPI void +ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win, + Ecore_X_Window shape_win, + int x, + int y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, + XCB_SHAPE_SK_INPUT, win, x, y, shape_win); +// ecore_x_flush(); +#else + return; + win = 0; + shape_win = 0; + x = 0; + y = 0; +#endif +} + +EAPI void +ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win, + Ecore_X_Window shape_win, + int x, + int y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, XCB_SHAPE_SK_INPUT, + XCB_SHAPE_SK_INPUT, win, x, y, shape_win); +// ecore_x_flush(); +#else + return; + win = 0; + shape_win = 0; + x = 0; + y = 0; +#endif +} + +EAPI void +ecore_x_window_shape_input_window_set(Ecore_X_Window win, + Ecore_X_Window shape_win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + xcb_shape_combine(_ecore_xcb_conn, XCB_SHAPE_SO_SET, XCB_SHAPE_SK_INPUT, + XCB_SHAPE_SK_INPUT, win, 0, 0, shape_win); +// ecore_x_flush(); +#else + return; + win = 0; + shape_win = 0; +#endif +} + +EAPI void +ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ +#ifdef ECORE_XCB_SHAPE + xcb_rectangle_t rect; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_INTERSECT, + XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, + win, 0, 0, 1, &rect); +// ecore_x_flush(); +#else + return; + win = 0; + x = 0; + y = 0; + w = 0; + h = 0; +#endif +} + +EAPI void +ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, + Ecore_X_Rectangle *rects, + int num) +{ +#ifdef ECORE_XCB_SHAPE + xcb_rectangle_t *rect = NULL; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + +#ifdef ECORE_XCB_SHAPE + if (num > 0) + { + int i = 0; + + if (!(rect = malloc(sizeof(xcb_rectangle_t) * num))) + return; + + for (i = 0; i < num; i++) + { + rect[i].x = rects[i].x; + rect[i].y = rects[i].y; + rect[i].width = rects[i].width; + rect[i].height = rects[i].height; + } + } + + xcb_shape_rectangles(_ecore_xcb_conn, XCB_SHAPE_SO_UNION, + XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, + win, 0, 0, num, (xcb_rectangle_t *)&rect); + + if (rect) free(rect); +// ecore_x_flush(); +#else + return; + win = 0; + num = 0; + rects = NULL; +#endif +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c new file mode 100644 index 0000000..e0e5610 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xdefaults.c @@ -0,0 +1,116 @@ +#include "ecore_xcb_private.h" +#include + +/* local function prototypes */ +static Eina_Bool _ecore_xcb_xdefaults_glob_match(const char *str, + const char *glob); + +/* local variables */ +static Eina_File *_ecore_xcb_xdefaults_file = NULL; +static char *_ecore_xcb_xdefaults_data = NULL; + +void +_ecore_xcb_xdefaults_init(void) +{ + char buff[PATH_MAX]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + snprintf(buff, sizeof(buff), "%s/.Xdefaults", getenv("HOME")); + if ((_ecore_xcb_xdefaults_file = eina_file_open(buff, EINA_FALSE))) + { + eina_mmap_safety_enabled_set(EINA_TRUE); + + _ecore_xcb_xdefaults_data = + eina_file_map_all(_ecore_xcb_xdefaults_file, EINA_FILE_SEQUENTIAL); + } +} + +void +_ecore_xcb_xdefaults_shutdown(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + if (!_ecore_xcb_xdefaults_file) return; + if (_ecore_xcb_xdefaults_data) + eina_file_map_free(_ecore_xcb_xdefaults_file, _ecore_xcb_xdefaults_data); + if (_ecore_xcb_xdefaults_file) eina_file_close(_ecore_xcb_xdefaults_file); +} + +char * +_ecore_xcb_xdefaults_string_get(const char *prog, + const char *param) +{ + char buff[1024], ret[1024]; + char *str = NULL; + char **ea = NULL; + unsigned int count = 0, i = 0; + + if ((!_ecore_xcb_xdefaults_data) || (!_ecore_xcb_xdefaults_file)) + return NULL; + + snprintf(buff, sizeof(buff), "*%s*.*%s*", prog, param); + + str = _ecore_xcb_xdefaults_data; + ea = eina_str_split_full(str, "\n", -1, &count); + for (i = 0; i < count; i++) + { + if (_ecore_xcb_xdefaults_glob_match(ea[i], buff)) + sscanf(ea[i], "%*[^:]:%*[ ]%s", ret); + } + if ((ea) && (ea[0])) + { + free(ea[0]); + free(ea); + } + + return strdup(ret); +} + +int +_ecore_xcb_xdefaults_int_get(const char *prog, + const char *param) +{ + char buff[1024]; + char *str = NULL; + char **ea = NULL; + unsigned int count = 0, i = 0; + int ret = -1; + + if ((!_ecore_xcb_xdefaults_data) || (!_ecore_xcb_xdefaults_file)) + return 0; + + snprintf(buff, sizeof(buff), "*%s*.*%s*", prog, param); + + str = _ecore_xcb_xdefaults_data; + ea = eina_str_split_full(str, "\n", -1, &count); + for (i = 0; i < count; i++) + { + if (_ecore_xcb_xdefaults_glob_match(ea[i], buff)) + sscanf(ea[i], "%*[^:]:%*[ ]%d", &ret); + } + if ((ea) && (ea[0])) + { + free(ea[0]); + free(ea); + } + + return ret; +} + +/* local functions */ +static Eina_Bool +_ecore_xcb_xdefaults_glob_match(const char *str, + const char *glob) +{ + if ((!str) || (!glob)) return EINA_FALSE; + if (glob[0] == 0) + { + if (str[0] == 0) return EINA_TRUE; + return EINA_FALSE; + } + if (!strcmp(glob, "*")) return EINA_TRUE; + if (!fnmatch(glob, str, 0)) return EINA_TRUE; + return EINA_FALSE; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c new file mode 100644 index 0000000..bf9d5ee --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xfixes.c @@ -0,0 +1,750 @@ +#include "ecore_xcb_private.h" +# ifdef ECORE_XCB_XFIXES +# include +# endif + +/* local function prototypes */ +static xcb_rectangle_t *_ecore_xcb_rect_to_xcb(Ecore_X_Rectangle *rects, + int num); +static Ecore_X_Rectangle *_ecore_xcb_rect_to_ecore(xcb_rectangle_t *rects, + int num); + +/* local variables */ +static Eina_Bool _xfixes_avail = EINA_FALSE; + +/* external variables */ +int _ecore_xcb_event_xfixes = -1; + +void +_ecore_xcb_xfixes_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_XFIXES + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_xfixes_id); +#endif +} + +void +_ecore_xcb_xfixes_finalize(void) +{ +#ifdef ECORE_XCB_XFIXES + const xcb_query_extension_reply_t *ext_reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_XFIXES + ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_xfixes_id); + if ((ext_reply) && (ext_reply->present)) + { + xcb_xfixes_query_version_cookie_t cookie; + xcb_xfixes_query_version_reply_t *reply; + + cookie = + xcb_xfixes_query_version_unchecked(_ecore_xcb_conn, + XCB_XFIXES_MAJOR_VERSION, + XCB_XFIXES_MINOR_VERSION); + reply = xcb_xfixes_query_version_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + /* NB: XFixes Extension >= 3 needed for shape stuff. + * for now, I am removing this check so that it matches the + * xlib code closer. If the extension version ends up being + * that important, then re-enable this */ + + /* if (reply->major_version >= 3) */ + _xfixes_avail = EINA_TRUE; + free(reply); + } + + if (_xfixes_avail) + _ecore_xcb_event_xfixes = ext_reply->first_event; + } +#endif +} + +EAPI Eina_Bool +ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection) +{ +#ifdef ECORE_XCB_XFIXES + Ecore_X_Window root = 0; + xcb_void_cookie_t cookie; + xcb_generic_error_t *err; + int mask = 0; +#endif + + CHECK_XCB_CONN; + + if (!_xfixes_avail) return EINA_FALSE; + +#ifdef ECORE_XCB_XFIXES + root = ((xcb_screen_t *)_ecore_xcb_screen)->root; + + mask = (XCB_XFIXES_SELECTION_EVENT_MASK_SET_SELECTION_OWNER | + XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_WINDOW_DESTROY | + XCB_XFIXES_SELECTION_EVENT_MASK_SELECTION_CLIENT_CLOSE); + + cookie = + xcb_xfixes_select_selection_input_checked(_ecore_xcb_conn, root, + selection, mask); + err = xcb_request_check(_ecore_xcb_conn, cookie); + if (err) + { + free(err); + return EINA_FALSE; + } + + return EINA_TRUE; +#endif + return EINA_FALSE; +} + +Eina_Bool +_ecore_xcb_xfixes_avail_get(void) +{ + return _xfixes_avail; +} + +/** + * @defgroup Ecore_X_Fixes_Group X Fixes Extension Functions + * + * Functions related to the X Fixes extension. + */ + +/** + * Create a region from rectangles. + * @param rects The rectangles used to initialize the region. + * @param num The number of rectangles. + * @return The newly created region. + * + * Create a region initialized to the specified list of rectangles + * @p rects. The rectangles may be specified in any order, their union + * becomes the region. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI Ecore_X_Region +ecore_x_region_new(Ecore_X_Rectangle *rects, + int num) +{ + Ecore_X_Region region = 0; +#ifdef ECORE_XCB_XFIXES + xcb_rectangle_t *xrects; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return 0; + +#ifdef ECORE_XCB_XFIXES + xrects = _ecore_xcb_rect_to_xcb(rects, num); + region = xcb_generate_id(_ecore_xcb_conn); + xcb_xfixes_create_region(_ecore_xcb_conn, region, num, xrects); + free(xrects); +// ecore_x_flush(); +#endif + + return region; +} + +/** + * Create a region from a pixmap. + * @param bitmap The bitmap used to initialize the region. + * @return The newly created region. + * + * Creates a region initialized to the set of 'one' pixels in @p bitmap + * (which must be of depth 1, else Match error). + * @ingroup Ecore_X_Fixes_Group + */ +EAPI Ecore_X_Region +ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap) +{ + Ecore_X_Region region = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return 0; + +#ifdef ECORE_XCB_XFIXES + region = xcb_generate_id(_ecore_xcb_conn); + xcb_xfixes_create_region_from_bitmap(_ecore_xcb_conn, region, bitmap); +// ecore_x_flush(); +#endif + + return region; +} + +/** + * Create a region from a window. + * @param window The window used to initialize the region. + * @param type The type of the region. + * @return The newly created region. + * + * Creates a region initialized to the specified @p window region. See + * the Shape extension for the definition of Bounding and Clip + * regions. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI Ecore_X_Region +ecore_x_region_new_from_window(Ecore_X_Window win, + Ecore_X_Region_Type type) +{ + Ecore_X_Region region = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return 0; + +#ifdef ECORE_XCB_XFIXES + region = xcb_generate_id(_ecore_xcb_conn); + xcb_xfixes_create_region_from_window(_ecore_xcb_conn, region, win, type); +// ecore_x_flush(); +#endif + + return region; +} + +/** + * Create a region from a graphic context. + * @param gc The graphic context used to initialize the region. + * @return The newly created region. + * + * Creates a region initialized from the clip list of @p gc. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI Ecore_X_Region +ecore_x_region_new_from_gc(Ecore_X_GC gc) +{ + Ecore_X_Region region = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return 0; + +#ifdef ECORE_XCB_XFIXES + region = xcb_generate_id(_ecore_xcb_conn); + xcb_xfixes_create_region_from_gc(_ecore_xcb_conn, region, gc); +// ecore_x_flush(); +#endif + + return region; +} + +/** + * Create a region from a picture. + * @param picture The picture used to initialize the region. + * @return The newly created region. + * + * Creates a region initialized from the clip list of @p picture. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI Ecore_X_Region +ecore_x_region_new_from_picture(Ecore_X_Picture picture) +{ + Ecore_X_Region region = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return 0; + +#ifdef ECORE_XCB_XFIXES + region = xcb_generate_id(_ecore_xcb_conn); + xcb_xfixes_create_region_from_picture(_ecore_xcb_conn, region, picture); +// ecore_x_flush(); +#endif + + return region; +} + +/** + * Destroy a region. + * @param region The region to destroy. + * + * Destroy the specified @p region. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI void +ecore_x_region_free(Ecore_X_Region region) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return; + +#ifdef ECORE_XCB_XFIXES + xcb_xfixes_destroy_region(_ecore_xcb_conn, region); +// ecore_x_flush(); +#endif +} + +/** + * Set the content of a region. + * @param region The region to destroy. + * @param rects The rectangles used to set the region. + * @param num The number of rectangles. + * + * Replace the current contents of @p region with the region formed + * by the union of the rectangles @p rects. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI void +ecore_x_region_set(Ecore_X_Region region, + Ecore_X_Rectangle *rects, + int num) +{ +#ifdef ECORE_XCB_XFIXES + xcb_rectangle_t *xrects; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return; + +#ifdef ECORE_XCB_XFIXES + xrects = _ecore_xcb_rect_to_xcb(rects, num); + xcb_xfixes_set_region(_ecore_xcb_conn, region, num, xrects); + free(xrects); +// ecore_x_flush(); +#endif +} + +/** + * Copy the content of a region. + * @param dest The destination region. + * @param source The source region. + * + * Replace the contents of @p dest with the contents of @p source. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI void +ecore_x_region_copy(Ecore_X_Region dest, + Ecore_X_Region source) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return; + + // NB: Hmmmm...this may need converting to/fro xcb_rectangle_t +#ifdef ECORE_XCB_XFIXES + xcb_xfixes_copy_region(_ecore_xcb_conn, source, dest); +// ecore_x_flush(); +#endif +} + +/** + * Make the union of two regions. + * @param dest The destination region. + * @param source1 The first source region. + * @param source2 The second source region. + * + * Replace the contents of @p dest with the union of @p source1 and + * @p source2. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI void +ecore_x_region_combine(Ecore_X_Region dest, + Ecore_X_Region source1, + Ecore_X_Region source2) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return; + +#ifdef ECORE_XCB_XFIXES + xcb_xfixes_union_region(_ecore_xcb_conn, source1, source2, dest); +// ecore_x_flush(); +#endif +} + +/** + * Make the intersection of two regions. + * @param dest The destination region. + * @param source1 The first source region. + * @param source2 The second source region. + * + * Replace the contents of @p dest with the intersection of @p source1 and + * @p source2. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI void +ecore_x_region_intersect(Ecore_X_Region dest, + Ecore_X_Region source1, + Ecore_X_Region source2) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return; + +#ifdef ECORE_XCB_XFIXES + xcb_xfixes_intersect_region(_ecore_xcb_conn, source1, source2, dest); +// ecore_x_flush(); +#endif +} + +/** + * Make the subtraction of two regions. + * @param dest The destination region. + * @param source1 The first source region. + * @param source2 The second source region. + * + * Replace the contents of @p dest with the subtraction of @p source1 by + * @p source2. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI void +ecore_x_region_subtract(Ecore_X_Region dest, + Ecore_X_Region source1, + Ecore_X_Region source2) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return; + +#ifdef ECORE_XCB_XFIXES + xcb_xfixes_subtract_region(_ecore_xcb_conn, source1, source2, dest); +// ecore_x_flush(); +#endif +} + +/** + * Make the subtraction of regions by bounds. + * @param dest The destination region. + * @param bounds The bounds. + * @param source The source region. + * + * The @p source region is subtracted from the region specified by + * @p bounds. The result is placed in @p dest, replacing its + * contents. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI void +ecore_x_region_invert(Ecore_X_Region dest, + Ecore_X_Rectangle *bounds, + Ecore_X_Region source) +{ +#ifdef ECORE_XCB_XFIXES + xcb_rectangle_t xrects; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return; + +#ifdef ECORE_XCB_XFIXES + xrects.x = bounds->x; + xrects.y = bounds->y; + xrects.width = bounds->width; + xrects.height = bounds->height; + + xcb_xfixes_invert_region(_ecore_xcb_conn, source, xrects, dest); +// ecore_x_flush(); +#endif +} + +/** + * Translate a region. + * @param region The region to translate. + * @param dx The horizontal translation. + * @param dy The vertical translation. + * + * The @p region is translated by @p dx and @p dy in place. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI void +ecore_x_region_translate(Ecore_X_Region region, + int dx, + int dy) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return; + +#ifdef ECORE_XCB_XFIXES + xcb_xfixes_translate_region(_ecore_xcb_conn, region, dx, dy); +// ecore_x_flush(); +#endif +} + +/** + * Extent a region. + * @param dest The destination region. + * @param source The source region. + * + * The extents of the @p source region are placed in @p dest. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI void +ecore_x_region_extents(Ecore_X_Region dest, + Ecore_X_Region source) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return; + +#ifdef ECORE_XCB_XFIXES + xcb_xfixes_region_extents(_ecore_xcb_conn, source, dest); +// ecore_x_flush(); +#endif +} + +/** + * Return the rectangles that compose a region. + * @param region The region (Unused). + * @param num The number of returned rectangles. + * @param bounds The returned bounds of the region. + * @return The returned rectangles. + * + * The @p region passed to ecore_xcb_region_fetch_prefetch() is + * returned as a list of rectagles in XY-banded order. + * + * To use this function, you must call before, and in order, + * ecore_xcb_region_fetch_prefetch(), which sends the XFixesFetchRegion request, + * then ecore_xcb_region_fetch_fetch(), which gets the reply. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI Ecore_X_Rectangle * +ecore_x_region_fetch(Ecore_X_Region region, + int *num, + Ecore_X_Rectangle *bounds) +{ + Ecore_X_Rectangle extents = { 0, 0, 0, 0 }; + Ecore_X_Rectangle *rects = NULL; +#ifdef ECORE_XCB_XFIXES + xcb_xfixes_fetch_region_cookie_t cookie; + xcb_xfixes_fetch_region_reply_t *reply; + xcb_rectangle_t *r; + int n = 0; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (num) *num = 0; + if (bounds) *bounds = extents; + if (!_xfixes_avail) return NULL; + +#ifdef ECORE_XCB_XFIXES + cookie = xcb_xfixes_fetch_region_unchecked(_ecore_xcb_conn, region); + reply = xcb_xfixes_fetch_region_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return NULL; + + r = xcb_xfixes_fetch_region_rectangles(reply); + n = xcb_xfixes_fetch_region_rectangles_length(reply); + rects = _ecore_xcb_rect_to_ecore(r, n); + if (num) *num = n; + + /* rects = (Ecore_X_Rectangle *)malloc(n * sizeof(Ecore_X_Rectangle)); */ + /* if (!rects) */ + /* { */ + /* free(reply); */ + /* return NULL; */ + /* } */ + + /* for (i = 0; i < n; i++) */ + /* { */ + /* rects[i].x = r[i].x; */ + /* rects[i].y = r[i].y; */ + /* rects[i].width = r[i].width; */ + /* rects[i].height = r[i].height; */ + /* } */ + + (*bounds).x = reply->extents.x; + (*bounds).y = reply->extents.y; + (*bounds).width = reply->extents.width; + (*bounds).height = reply->extents.height; + + free(reply); +#endif + + return rects; +} + +/** + * Expand a region. + * @param dest The destination region. + * @param source The source region. + * @param left The number of pixels to add on the left. + * @param right The number of pixels to add on the right. + * @param top The number of pixels to add at the top. + * @param bottom The number of pixels to add at the bottom. + * + * Put in @p dest the area specified by expanding each rectangle in + * the @p source region by the specified number of pixels to the + * @p left, @p right, @p top and @p bottom. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI void +ecore_x_region_expand(Ecore_X_Region dest, + Ecore_X_Region source, + unsigned int left, + unsigned int right, + unsigned int top, + unsigned int bottom) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return; + +#ifdef ECORE_XCB_XFIXES + xcb_xfixes_expand_region(_ecore_xcb_conn, source, dest, left, right, top, bottom); +// ecore_x_flush(); +#endif +} + +/** + * Change clip-mask in a graphic context to the specified region. + * @param region The region to change. + * @param gc The clip-mask graphic context. + * @param x_origin The horizontal translation. + * @param y_origin The vertical translation. + * + * Changes clip-mask in @p gc to the specified @p region and + * sets the clip origin with the values of @p x_origin and @p y_origin. + * Output will be clippped to remain contained within the region. The + * clip origin is interpreted relative to the origin of whatever + * destination drawable is specified in a graphics request. The + * region is interpreted relative to the clip origin. Future changes + * to region have no effect on the gc clip-mask. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI void +ecore_x_region_gc_clip_set(Ecore_X_Region region, + Ecore_X_GC gc, + int x, + int y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return; + +#ifdef ECORE_XCB_XFIXES + xcb_xfixes_set_gc_clip_region(_ecore_xcb_conn, gc, region, x, y); +// ecore_x_flush(); +#endif +} + +/** + * Change the shape extension of a window. + * @param region The region. + * @param dest The window whose shape is changed. + * @param type The kind of shape. + * @param x_offset The horizontal offset. + * @param y_offset The vertical offset. + * + * Set the specified Shape extension region of @p window to @p region, + * offset by @p x_offset and @p y_offset. Future changes to region + * have no effect on the window shape. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI void +ecore_x_region_window_shape_set(Ecore_X_Region region, + Ecore_X_Window dest, + Ecore_X_Shape_Type type, + int x, + int y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return; + +#ifdef ECORE_XCB_XFIXES + xcb_xfixes_set_window_shape_region(_ecore_xcb_conn, dest, type, x, y, region); +// ecore_x_flush(); +#endif +} + +/** + * Change clip-mask in picture to the specified region. + * @param region The region. + * @param picture The picture. + * @param x_origin The X coordinate of the origin. + * @param y_origin The Y coordinate of the origin. + * + * Changes clip-mask in picture to the specified @p region + * and sets the clip origin. Input and output will be clipped to + * remain contained within the region. The clip origin is interpreted + * relative to the origin of the drawable associated with @p picture. The + * region is interpreted relative to the clip origin. Future changes + * to region have no effect on the picture clip-mask. + * @ingroup Ecore_X_Fixes_Group + */ +EAPI void +ecore_x_region_picture_clip_set(Ecore_X_Region region, + Ecore_X_Picture picture, + int x, + int y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xfixes_avail) return; + +#ifdef ECORE_XCB_XFIXES + xcb_xfixes_set_picture_clip_region(_ecore_xcb_conn, picture, region, x, y); +// ecore_x_flush(); +#endif +} + +/* local function prototypes */ +static xcb_rectangle_t * +_ecore_xcb_rect_to_xcb(Ecore_X_Rectangle *rects, + int num) +{ + xcb_rectangle_t *xrect; + int i = 0; + + if (!num) return NULL; + + xrect = malloc(sizeof(xcb_rectangle_t) * num); + if (!xrect) return NULL; + + for (i = 0; i < num; i++) + { + xrect[i].x = rects[i].x; + xrect[i].y = rects[i].y; + xrect[i].width = rects[i].width; + xrect[i].height = rects[i].height; + } + + return xrect; +} + +static Ecore_X_Rectangle * +_ecore_xcb_rect_to_ecore(xcb_rectangle_t *rects, + int num) +{ + Ecore_X_Rectangle *erect; + int i = 0; + + if (!num) return NULL; + + erect = malloc(sizeof(Ecore_X_Rectangle) * num); + if (!erect) return NULL; + + for (i = 0; i < num; i++) + { + erect[i].x = rects[i].x; + erect[i].y = rects[i].y; + erect[i].width = rects[i].width; + erect[i].height = rects[i].height; + } + + return erect; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xinerama.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xinerama.c new file mode 100644 index 0000000..37a2339 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xinerama.c @@ -0,0 +1,139 @@ +#include "ecore_xcb_private.h" +#ifdef ECORE_XCB_XINERAMA +# include +#endif + +/* local variables */ +static Eina_Bool _xinerama_avail = EINA_FALSE; +static Eina_Bool _xinerama_active = EINA_FALSE; + +void +_ecore_xcb_xinerama_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_XINERAMA + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_xinerama_id); +#endif +} + +void +_ecore_xcb_xinerama_finalize(void) +{ +#ifdef ECORE_XCB_XINERAMA + const xcb_query_extension_reply_t *ext_reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_XINERAMA + ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_xinerama_id); + if ((ext_reply) && (ext_reply->present)) + { + xcb_xinerama_query_version_cookie_t cookie; + xcb_xinerama_query_version_reply_t *reply; + + cookie = + xcb_xinerama_query_version_unchecked(_ecore_xcb_conn, + XCB_XINERAMA_MAJOR_VERSION, + XCB_XINERAMA_MINOR_VERSION); + reply = + xcb_xinerama_query_version_reply(_ecore_xcb_conn, cookie, NULL); + if (reply) + { + _xinerama_avail = EINA_TRUE; + // NB: Do we need to compare version numbers here ? + free(reply); + } + + if (_xinerama_avail) + { + xcb_xinerama_is_active_cookie_t acookie; + xcb_xinerama_is_active_reply_t *areply; + + acookie = xcb_xinerama_is_active_unchecked(_ecore_xcb_conn); + areply = + xcb_xinerama_is_active_reply(_ecore_xcb_conn, acookie, NULL); + if (areply) + { + _xinerama_active = areply->state; + free(areply); + } + } + } +#endif +} + +EAPI int +ecore_x_xinerama_screen_count_get(void) +{ + int count = 0; +#ifdef ECORE_XCB_XINERAMA + xcb_xinerama_query_screens_cookie_t cookie; + xcb_xinerama_query_screens_reply_t *reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_xinerama_avail) return 0; + +#ifdef ECORE_XCB_XINERAMA + cookie = xcb_xinerama_query_screens_unchecked(_ecore_xcb_conn); + reply = + xcb_xinerama_query_screens_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return 0; + count = reply->number; +#endif + + return count; +} + +EAPI Eina_Bool +ecore_x_xinerama_screen_geometry_get(int screen, + int *x, + int *y, + int *w, + int *h) +{ +#ifdef ECORE_XCB_XINERAMA + xcb_xinerama_query_screens_cookie_t cookie; + xcb_xinerama_query_screens_reply_t *reply; + xcb_xinerama_screen_info_t *info; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (x) *x = 0; + if (y) *y = 0; + if (w) *w = ((xcb_screen_t *)_ecore_xcb_screen)->width_in_pixels; + if (h) *h = ((xcb_screen_t *)_ecore_xcb_screen)->height_in_pixels; + + if (!_xinerama_avail) return EINA_FALSE; + +#ifdef ECORE_XCB_XINERAMA + cookie = xcb_xinerama_query_screens_unchecked(_ecore_xcb_conn); + reply = + xcb_xinerama_query_screens_reply(_ecore_xcb_conn, cookie, NULL); + if (!reply) return EINA_FALSE; + + info = xcb_xinerama_query_screens_screen_info(reply); + if (!info) + { + free(reply); + return EINA_FALSE; + } + + if (x) *x = info[screen].x_org; + if (y) *y = info[screen].y_org; + if (w) *w = info[screen].width; + if (h) *h = info[screen].height; + + free(reply); + return EINA_TRUE; +#endif + + return EINA_FALSE; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xtest.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xtest.c new file mode 100644 index 0000000..b664dc9 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_xtest.c @@ -0,0 +1,215 @@ +#include "ecore_xcb_private.h" +#ifdef ECORE_XCB_XTEST +# include +# include +#endif + +/* local variables */ +static Eina_Bool _test_avail = EINA_FALSE; + +void +_ecore_xcb_xtest_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_XTEST + xcb_prefetch_extension_data(_ecore_xcb_conn, &xcb_test_id); +#endif +} + +void +_ecore_xcb_xtest_finalize(void) +{ +#ifdef ECORE_XCB_XTEST + const xcb_query_extension_reply_t *ext_reply; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +#ifdef ECORE_XCB_XTEST + ext_reply = xcb_get_extension_data(_ecore_xcb_conn, &xcb_test_id); + if ((ext_reply) && (ext_reply->present)) + _test_avail = EINA_TRUE; +#endif +} + +EAPI Eina_Bool +#ifdef ECORE_XCB_XTEST +ecore_x_test_fake_key_down(const char *key) +#else +ecore_x_test_fake_key_down(const char *key __UNUSED__) +#endif +{ +#ifdef ECORE_XCB_XTEST + xcb_keycode_t keycode = 0; + xcb_void_cookie_t cookie; + xcb_generic_error_t *err; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_test_avail) return EINA_FALSE; + +#ifdef ECORE_XCB_XTEST + keycode = _ecore_xcb_keymap_string_to_keycode(key); + if (keycode == XCB_NO_SYMBOL) return EINA_FALSE; + + cookie = + xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS, + keycode, XCB_CURRENT_TIME, + ((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0); + err = xcb_request_check(_ecore_xcb_conn, cookie); + if (err) + { + free(err); + return EINA_FALSE; + } + return EINA_TRUE; +#endif + + return EINA_FALSE; +} + +EAPI Eina_Bool +#ifdef ECORE_XCB_XTEST +ecore_x_test_fake_key_up(const char *key) +#else +ecore_x_test_fake_key_up(const char *key __UNUSED__) +#endif +{ +#ifdef ECORE_XCB_XTEST + xcb_keycode_t keycode = 0; + xcb_void_cookie_t cookie; + xcb_generic_error_t *err; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_test_avail) return EINA_FALSE; + +#ifdef ECORE_XCB_XTEST + keycode = _ecore_xcb_keymap_string_to_keycode(key); + if (keycode == XCB_NO_SYMBOL) return EINA_FALSE; + + cookie = + xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE, + keycode, XCB_CURRENT_TIME, + ((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0); + err = xcb_request_check(_ecore_xcb_conn, cookie); + if (err) + { + free(err); + return EINA_FALSE; + } + return EINA_TRUE; +#endif + + return EINA_FALSE; +} + +EAPI Eina_Bool +#ifdef ECORE_XCB_XTEST +ecore_x_test_fake_key_press(const char *key) +#else +ecore_x_test_fake_key_press(const char *key __UNUSED__) +#endif +{ +#ifdef ECORE_XCB_XTEST + xcb_keycode_t keycode = 0; + xcb_keysym_t keysym = 0; + xcb_keycode_t shift_code = 0; + xcb_void_cookie_t cookie; + xcb_generic_error_t *err; + Eina_Bool shift = EINA_FALSE; +#endif + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + CHECK_XCB_CONN; + + if (!_test_avail) return EINA_FALSE; + +#ifdef ECORE_XCB_XTEST + keycode = _ecore_xcb_keymap_string_to_keycode(key); + keysym = _ecore_xcb_keymap_keycode_to_keysym(keycode, 0); + if (keysym == XCB_NO_SYMBOL) + { + keysym = _ecore_xcb_keymap_keycode_to_keysym(keycode, 1); + if (keysym != XCB_NO_SYMBOL) + shift = EINA_TRUE; + } + + if (shift) + { + xcb_keycode_t *keycodes; + int i = 0; + + keycodes = _ecore_xcb_keymap_keysym_to_keycode(XK_Shift_L); + while (keycodes[i] != XCB_NO_SYMBOL) + { + if (keycodes[i] != 0) + { + shift_code = keycodes[i]; + break; + } + i++; + } + } + + if (shift) + { + cookie = + xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS, + shift_code, XCB_CURRENT_TIME, + ((xcb_screen_t *)_ecore_xcb_screen)->root, + 0, 0, 0); + err = xcb_request_check(_ecore_xcb_conn, cookie); + if (err) + { + free(err); + return EINA_FALSE; + } + } + + cookie = + xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_PRESS, + keycode, XCB_CURRENT_TIME, + ((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0); + err = xcb_request_check(_ecore_xcb_conn, cookie); + if (err) + { + free(err); + return EINA_FALSE; + } + cookie = + xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE, + keycode, XCB_CURRENT_TIME, + ((xcb_screen_t *)_ecore_xcb_screen)->root, 0, 0, 0); + err = xcb_request_check(_ecore_xcb_conn, cookie); + if (err) + { + free(err); + return EINA_FALSE; + } + + if (shift) + { + cookie = + xcb_test_fake_input(_ecore_xcb_conn, XCB_KEY_RELEASE, + shift_code, XCB_CURRENT_TIME, + ((xcb_screen_t *)_ecore_xcb_screen)->root, + 0, 0, 0); + err = xcb_request_check(_ecore_xcb_conn, cookie); + if (err) + { + free(err); + return EINA_FALSE; + } + } + + return EINA_TRUE; +#endif + + return EINA_FALSE; +} diff --git a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.am b/libraries/ecore/src/lib/ecore_x/xlib/Makefile.am new file mode 100644 index 0000000..3c7364c --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/Makefile.am @@ -0,0 +1,94 @@ + +MAINTAINERCLEANFILES = Makefile.in + +if BUILD_ECORE_X_XLIB + +AM_CPPFLAGS = \ +@Xcursor_cflags@ \ +@XKB_CFLAGS@ \ +@XDAMAGE_CFLAGS@ \ +@XCOMPOSITE_CFLAGS@ \ +@XGESTURE_CFLAGS@ \ +@XDPMS_CFLAGS@ \ +@XFIXES_CFLAGS@ \ +@XI2_CFLAGS@ \ +@XINERAMA_CFLAGS@ \ +@XPRINT_CFLAGS@ \ +@XRANDR_CFLAGS@ \ +@XRENDER_CFLAGS@ \ +@XSS_CFLAGS@ \ +@XTEST_CFLAGS@ \ +@x_cflags@ \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_x \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_x \ +-I$(top_builddir)/src/lib/ecore_input \ +@EVAS_CFLAGS@ \ +@EINA_CFLAGS@ + +noinst_LTLIBRARIES = libecore_x_xlib.la + +libecore_x_xlib_la_SOURCES = \ +ecore_x.c \ +ecore_x_dnd.c \ +ecore_x_sync.c \ +ecore_x_randr.c \ +ecore_x_randr_11.c \ +ecore_x_randr_12.c \ +ecore_x_randr_12_edid.c \ +ecore_x_randr_13.c \ +ecore_x_fixes.c \ +ecore_x_damage.c \ +ecore_x_composite.c \ +ecore_x_error.c \ +ecore_x_events.c \ +ecore_x_icccm.c \ +ecore_x_netwm.c \ +ecore_x_mwm.c \ +ecore_x_e.c \ +ecore_x_selection.c \ +ecore_x_window.c \ +ecore_x_window_prop.c \ +ecore_x_window_shape.c \ +ecore_x_pixmap.c \ +ecore_x_gc.c \ +ecore_x_xinerama.c \ +ecore_x_screensaver.c \ +ecore_x_dpms.c \ +ecore_x_drawable.c \ +ecore_x_cursor.c \ +ecore_x_test.c \ +ecore_x_atoms.c \ +ecore_x_region.c \ +ecore_x_image.c \ +ecore_x_xi2.c \ +ecore_x_vsync.c \ +ecore_x_randr.h \ +ecore_x_gesture.c + +libecore_x_xlib_la_LIBADD = \ +@Xcursor_libs@ \ +@XKB_LIBS@ \ +@XDAMAGE_LIBS@ \ +@XCOMPOSITE_LIBS@ \ +@XGESTURE_LIBS@ \ +@XDPMS_LIBS@ \ +@XFIXES_LIBS@ \ +@XI2_LIBS@ \ +@XINERAMA_LIBS@ \ +@XPRINT_LIBS@ \ +@XRANDR_LIBS@ \ +@XRENDER_LIBS@ \ +@XSS_LIBS@ \ +@XTEST_LIBS@ \ +@x_libs@ \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@EINA_LIBS@ \ +@dlopen_libs@ + +endif + +EXTRA_DIST = ecore_x_private.h diff --git a/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in b/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in new file mode 100644 index 0000000..e1026e5 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/Makefile.in @@ -0,0 +1,874 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib/ecore_x/xlib +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +@BUILD_ECORE_X_XLIB_TRUE@libecore_x_xlib_la_DEPENDENCIES = $(top_builddir)/src/lib/ecore/libecore.la \ +@BUILD_ECORE_X_XLIB_TRUE@ $(top_builddir)/src/lib/ecore_input/libecore_input.la +am__libecore_x_xlib_la_SOURCES_DIST = ecore_x.c ecore_x_dnd.c \ + ecore_x_sync.c ecore_x_randr.c ecore_x_randr_11.c \ + ecore_x_randr_12.c ecore_x_randr_12_edid.c ecore_x_randr_13.c \ + ecore_x_fixes.c ecore_x_damage.c ecore_x_composite.c \ + ecore_x_error.c ecore_x_events.c ecore_x_icccm.c \ + ecore_x_netwm.c ecore_x_mwm.c ecore_x_e.c ecore_x_selection.c \ + ecore_x_window.c ecore_x_window_prop.c ecore_x_window_shape.c \ + ecore_x_pixmap.c ecore_x_gc.c ecore_x_xinerama.c \ + ecore_x_screensaver.c ecore_x_dpms.c ecore_x_drawable.c \ + ecore_x_cursor.c ecore_x_test.c ecore_x_atoms.c \ + ecore_x_region.c ecore_x_image.c ecore_x_xi2.c ecore_x_vsync.c \ + ecore_x_randr.h ecore_x_gesture.c +@BUILD_ECORE_X_XLIB_TRUE@am_libecore_x_xlib_la_OBJECTS = ecore_x.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_dnd.lo ecore_x_sync.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_randr.lo ecore_x_randr_11.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_randr_12.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_randr_12_edid.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_randr_13.lo ecore_x_fixes.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_damage.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_composite.lo ecore_x_error.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_events.lo ecore_x_icccm.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_netwm.lo ecore_x_mwm.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_e.lo ecore_x_selection.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_window.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_window_prop.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_window_shape.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_pixmap.lo ecore_x_gc.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_xinerama.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_screensaver.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_dpms.lo ecore_x_drawable.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_cursor.lo ecore_x_test.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_atoms.lo ecore_x_region.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_image.lo ecore_x_xi2.lo \ +@BUILD_ECORE_X_XLIB_TRUE@ ecore_x_vsync.lo ecore_x_gesture.lo +libecore_x_xlib_la_OBJECTS = $(am_libecore_x_xlib_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +@BUILD_ECORE_X_XLIB_TRUE@am_libecore_x_xlib_la_rpath = +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(libecore_x_xlib_la_SOURCES) +DIST_SOURCES = $(am__libecore_x_xlib_la_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +@BUILD_ECORE_X_XLIB_TRUE@AM_CPPFLAGS = \ +@BUILD_ECORE_X_XLIB_TRUE@@Xcursor_cflags@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XKB_CFLAGS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XDAMAGE_CFLAGS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XCOMPOSITE_CFLAGS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XGESTURE_CFLAGS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XDPMS_CFLAGS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XFIXES_CFLAGS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XI2_CFLAGS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XINERAMA_CFLAGS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XPRINT_CFLAGS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XRANDR_CFLAGS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XRENDER_CFLAGS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XSS_CFLAGS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XTEST_CFLAGS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@x_cflags@ \ +@BUILD_ECORE_X_XLIB_TRUE@-I$(top_srcdir)/src/lib/ecore \ +@BUILD_ECORE_X_XLIB_TRUE@-I$(top_srcdir)/src/lib/ecore_x \ +@BUILD_ECORE_X_XLIB_TRUE@-I$(top_srcdir)/src/lib/ecore_input \ +@BUILD_ECORE_X_XLIB_TRUE@-I$(top_builddir)/src/lib/ecore \ +@BUILD_ECORE_X_XLIB_TRUE@-I$(top_builddir)/src/lib/ecore_x \ +@BUILD_ECORE_X_XLIB_TRUE@-I$(top_builddir)/src/lib/ecore_input \ +@BUILD_ECORE_X_XLIB_TRUE@@EVAS_CFLAGS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@EINA_CFLAGS@ + +@BUILD_ECORE_X_XLIB_TRUE@noinst_LTLIBRARIES = libecore_x_xlib.la +@BUILD_ECORE_X_XLIB_TRUE@libecore_x_xlib_la_SOURCES = \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_dnd.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_sync.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr_11.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr_12.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr_12_edid.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr_13.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_fixes.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_damage.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_composite.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_error.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_events.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_icccm.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_netwm.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_mwm.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_e.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_selection.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_window.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_window_prop.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_window_shape.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_pixmap.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_gc.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_xinerama.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_screensaver.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_dpms.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_drawable.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_cursor.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_test.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_atoms.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_region.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_image.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_xi2.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_vsync.c \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_randr.h \ +@BUILD_ECORE_X_XLIB_TRUE@ecore_x_gesture.c + +@BUILD_ECORE_X_XLIB_TRUE@libecore_x_xlib_la_LIBADD = \ +@BUILD_ECORE_X_XLIB_TRUE@@Xcursor_libs@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XKB_LIBS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XDAMAGE_LIBS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XCOMPOSITE_LIBS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XGESTURE_LIBS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XDPMS_LIBS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XFIXES_LIBS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XI2_LIBS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XINERAMA_LIBS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XPRINT_LIBS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XRANDR_LIBS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XRENDER_LIBS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XSS_LIBS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@XTEST_LIBS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@x_libs@ \ +@BUILD_ECORE_X_XLIB_TRUE@$(top_builddir)/src/lib/ecore/libecore.la \ +@BUILD_ECORE_X_XLIB_TRUE@$(top_builddir)/src/lib/ecore_input/libecore_input.la \ +@BUILD_ECORE_X_XLIB_TRUE@@EINA_LIBS@ \ +@BUILD_ECORE_X_XLIB_TRUE@@dlopen_libs@ + +EXTRA_DIST = ecore_x_private.h +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib/ecore_x/xlib/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib/ecore_x/xlib/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libecore_x_xlib.la: $(libecore_x_xlib_la_OBJECTS) $(libecore_x_xlib_la_DEPENDENCIES) + $(AM_V_CCLD)$(LINK) $(am_libecore_x_xlib_la_rpath) $(libecore_x_xlib_la_OBJECTS) $(libecore_x_xlib_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_atoms.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_composite.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_cursor.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_damage.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_dnd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_dpms.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_drawable.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_e.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_error.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_events.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_fixes.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_gc.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_gesture.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_icccm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_image.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_mwm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_netwm.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_pixmap.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr_11.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr_12.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr_12_edid.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_randr_13.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_region.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_screensaver.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_selection.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_sync.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_test.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_vsync.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_window.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_window_prop.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_window_shape.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_xi2.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_x_xinerama.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c new file mode 100644 index 0000000..844ab04 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x.c @@ -0,0 +1,2098 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include +#include +#include + +//#define LOGRT 1 + +#ifdef LOGRT +#include +#endif /* ifdef LOGRT */ + +#include "Ecore.h" +#include "ecore_private.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include "Ecore_X_Atoms.h" +#include "Ecore_Input.h" + +static Eina_Bool _ecore_x_fd_handler(void *data, + Ecore_Fd_Handler *fd_handler); +static Eina_Bool _ecore_x_fd_handler_buf(void *data, + Ecore_Fd_Handler *fd_handler); +static int _ecore_x_key_mask_get(KeySym sym); +static int _ecore_x_event_modifier(unsigned int state); + +static Ecore_Fd_Handler *_ecore_x_fd_handler_handle = NULL; + +static const int AnyXEvent = 0; /* 0 can be used as there are no event types + * with index 0 and 1 as they are used for + * errors + */ + +static int _ecore_x_event_shape_id = 0; +static int _ecore_x_event_screensaver_id = 0; +static int _ecore_x_event_sync_id = 0; +int _ecore_xlib_log_dom = -1; + +#ifdef ECORE_XRANDR +static int _ecore_x_event_randr_id = 0; +#endif /* ifdef ECORE_XRANDR */ +#ifdef ECORE_XFIXES +static int _ecore_x_event_fixes_selection_id = 0; +#endif /* ifdef ECORE_XFIXES */ +#ifdef ECORE_XDAMAGE +static int _ecore_x_event_damage_id = 0; +#endif /* ifdef ECORE_XDAMAGE */ +#ifdef ECORE_XGESTURE +static int _ecore_x_event_gesture_id = 0; +#endif /* ifdef ECORE_XGESTURE */ +static int _ecore_x_event_handlers_num = 0; +static void (**_ecore_x_event_handlers) (XEvent * event) = NULL; + +static int _ecore_x_init_count = 0; +static int _ecore_x_grab_count = 0; + +Display *_ecore_x_disp = NULL; +double _ecore_x_double_click_time = 0.25; +Time _ecore_x_event_last_time = 0; +Window _ecore_x_event_last_win = 0; +int _ecore_x_event_last_root_x = 0; +int _ecore_x_event_last_root_y = 0; +Eina_Bool _ecore_x_xcursor = EINA_FALSE; + +Ecore_X_Window _ecore_x_private_win = 0; + +Ecore_X_Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM]; + +EAPI int ECORE_X_EVENT_ANY = 0; +EAPI int ECORE_X_EVENT_MOUSE_IN = 0; +EAPI int ECORE_X_EVENT_MOUSE_OUT = 0; +EAPI int ECORE_X_EVENT_WINDOW_FOCUS_IN = 0; +EAPI int ECORE_X_EVENT_WINDOW_FOCUS_OUT = 0; +EAPI int ECORE_X_EVENT_WINDOW_KEYMAP = 0; +EAPI int ECORE_X_EVENT_WINDOW_DAMAGE = 0; +EAPI int ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = 0; +EAPI int ECORE_X_EVENT_WINDOW_CREATE = 0; +EAPI int ECORE_X_EVENT_WINDOW_DESTROY = 0; +EAPI int ECORE_X_EVENT_WINDOW_HIDE = 0; +EAPI int ECORE_X_EVENT_WINDOW_SHOW = 0; +EAPI int ECORE_X_EVENT_WINDOW_SHOW_REQUEST = 0; +EAPI int ECORE_X_EVENT_WINDOW_REPARENT = 0; +EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE = 0; +EAPI int ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = 0; +EAPI int ECORE_X_EVENT_WINDOW_GRAVITY = 0; +EAPI int ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = 0; +EAPI int ECORE_X_EVENT_WINDOW_STACK = 0; +EAPI int ECORE_X_EVENT_WINDOW_STACK_REQUEST = 0; +EAPI int ECORE_X_EVENT_WINDOW_PROPERTY = 0; +EAPI int ECORE_X_EVENT_WINDOW_COLORMAP = 0; +EAPI int ECORE_X_EVENT_WINDOW_MAPPING = 0; +EAPI int ECORE_X_EVENT_MAPPING_CHANGE = 0; +EAPI int ECORE_X_EVENT_SELECTION_CLEAR = 0; +EAPI int ECORE_X_EVENT_SELECTION_REQUEST = 0; +EAPI int ECORE_X_EVENT_SELECTION_NOTIFY = 0; +EAPI int ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = 0; +EAPI int ECORE_X_EVENT_CLIENT_MESSAGE = 0; +EAPI int ECORE_X_EVENT_WINDOW_SHAPE = 0; +EAPI int ECORE_X_EVENT_SCREENSAVER_NOTIFY = 0; +EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_FLICK; +EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PAN; +EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION; +EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAP; +EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD; +EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_HOLD; +EAPI int ECORE_X_EVENT_GESTURE_NOTIFY_GROUP; +EAPI int ECORE_X_EVENT_SYNC_COUNTER = 0; +EAPI int ECORE_X_EVENT_SYNC_ALARM = 0; +EAPI int ECORE_X_EVENT_SCREEN_CHANGE = 0; +EAPI int ECORE_X_EVENT_DAMAGE_NOTIFY = 0; +EAPI int ECORE_X_EVENT_RANDR_CRTC_CHANGE = 0; +EAPI int ECORE_X_EVENT_RANDR_OUTPUT_CHANGE = 0; +EAPI int ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY = 0; +EAPI int ECORE_X_EVENT_WINDOW_DELETE_REQUEST = 0; +EAPI int ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = 0; +EAPI int ECORE_X_EVENT_WINDOW_STATE_REQUEST = 0; +EAPI int ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = 0; +EAPI int ECORE_X_EVENT_PING = 0; +EAPI int ECORE_X_EVENT_DESKTOP_CHANGE = 0; + +EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = 0; +EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = 0; +EAPI int ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = 0; + +EAPI int ECORE_X_EVENT_GENERIC = 0; + +int ECORE_X_MODIFIER_SHIFT = 0; +int ECORE_X_MODIFIER_CTRL = 0; +int ECORE_X_MODIFIER_ALT = 0; +int ECORE_X_MODIFIER_WIN = 0; + +EAPI int ECORE_X_LOCK_SCROLL = 0; +EAPI int ECORE_X_LOCK_NUM = 0; +EAPI int ECORE_X_LOCK_CAPS = 0; +EAPI int ECORE_X_LOCK_SHIFT = 0; + +#ifdef LOGRT +static double t0 = 0.0; +static Status (*_logrt_real_reply)(Display *disp, + void *rep, + int extra, + Bool discard) = NULL; +static void +_logrt_init(void) +{ + void *lib; + + lib = dlopen("libX11.so", RTLD_GLOBAL | RTLD_LAZY); + if (!lib) + lib = dlopen("libX11.so.6", RTLD_GLOBAL | RTLD_LAZY); + + if (!lib) + lib = dlopen("libX11.so.6.3", RTLD_GLOBAL | RTLD_LAZY); + + if (!lib) + lib = dlopen("libX11.so.6.3.0", RTLD_GLOBAL | RTLD_LAZY); + + _logrt_real_reply = dlsym(lib, "_XReply"); + t0 = ecore_time_get(); +} /* _logrt_init */ + +Status +_XReply(Display *disp, + void *rep, + int extra, + Bool discard) +{ + void *bt[128]; + int i, n; + char **sym; + + n = backtrace(bt, 128); + if (n > 0) + { + sym = backtrace_symbols(bt, n); + printf("ROUNDTRIP: %4.4f :", ecore_time_get() - t0); + if (sym) + { + for (i = n - 1; i > 0; i--) + { + char *fname = strchr(sym[i], '('); + if (fname) + { + char *tsym = alloca(strlen(fname) + 1); + char *end; + strcpy(tsym, fname + 1); + end = strchr(tsym, '+'); + if (end) + { + *end = 0; + printf("%s", tsym); + } + else + printf("???"); + } + else + printf("???"); + + if (i > 1) + printf(" > "); + } + printf("\n"); + } + } + + // fixme: logme + return _logrt_real_reply(disp, rep, extra, discard); +} /* _XReply */ + +#endif /* ifdef LOGRT */ + +void +_ecore_x_modifiers_get(void) +{ + /* everything has these... unless its like a pda... :) */ + ECORE_X_MODIFIER_SHIFT = _ecore_x_key_mask_get(XK_Shift_L); + ECORE_X_MODIFIER_CTRL = _ecore_x_key_mask_get(XK_Control_L); + + /* apple's xdarwin has no alt!!!! */ + ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Alt_L); + if (!ECORE_X_MODIFIER_ALT) + ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Meta_L); + + if (!ECORE_X_MODIFIER_ALT) + ECORE_X_MODIFIER_ALT = _ecore_x_key_mask_get(XK_Super_L); + + /* the windows key... a valid modifier :) */ + ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Super_L); + if (!ECORE_X_MODIFIER_WIN) + ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Mode_switch); + + if (!ECORE_X_MODIFIER_WIN) + ECORE_X_MODIFIER_WIN = _ecore_x_key_mask_get(XK_Meta_L); + + if (ECORE_X_MODIFIER_WIN == ECORE_X_MODIFIER_ALT) + ECORE_X_MODIFIER_WIN = 0; + + if (ECORE_X_MODIFIER_ALT == ECORE_X_MODIFIER_CTRL) + ECORE_X_MODIFIER_ALT = 0; + + ECORE_X_LOCK_SCROLL = _ecore_x_key_mask_get(XK_Scroll_Lock); + ECORE_X_LOCK_NUM = _ecore_x_key_mask_get(XK_Num_Lock); + ECORE_X_LOCK_CAPS = _ecore_x_key_mask_get(XK_Caps_Lock); + ECORE_X_LOCK_SHIFT = _ecore_x_key_mask_get(XK_Shift_Lock); +} + +/** + * @defgroup Ecore_X_Init_Group X Library Init and Shutdown Functions + * + * Functions that start and shut down the Ecore X Library. + */ + +/** + * Initialize the X display connection to the given display. + * + * @param name Display target name. If @c NULL, the default display is + * assumed. + * @return The number of times the library has been initialized without + * being shut down. 0 is returned if an error occurs. + * @ingroup Ecore_X_Init_Group + */ +EAPI int +ecore_x_init(const char *name) +{ + int shape_base = 0; + int shape_err_base = 0; +#ifdef ECORE_XSS + int screensaver_base = 0; + int screensaver_err_base = 0; +#endif /* ifdef ECORE_XSS */ + int sync_base = 0; + int sync_err_base = 0; +#ifdef ECORE_XRANDR + int randr_base = 0; + int randr_err_base = 0; +#endif /* ifdef ECORE_XRANDR */ +#ifdef ECORE_XFIXES + int fixes_base = 0; + int fixes_err_base = 0; +#endif /* ifdef ECORE_XFIXES */ +#ifdef ECORE_XDAMAGE + int damage_base = 0; + int damage_err_base = 0; +#endif /* ifdef ECORE_XDAMAGE */ +#ifdef ECORE_XGESTURE + int gesture_base = 0; + int gesture_err_base = 0; +#endif /* ifdef ECORE_XGESTURE */ + + if (++_ecore_x_init_count != 1) + return _ecore_x_init_count; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); +#ifdef LOGRT + _logrt_init(); +#endif /* ifdef LOGRT */ + + eina_init(); + _ecore_xlib_log_dom = eina_log_domain_register + ("ecore_x", ECORE_XLIB_DEFAULT_LOG_COLOR); + if(_ecore_xlib_log_dom < 0) + { + EINA_LOG_ERR( + "Impossible to create a log domain for the Ecore Xlib module."); + return --_ecore_x_init_count; + } + + if (!ecore_init()) + goto shutdown_eina; + if (!ecore_event_init()) + goto shutdown_ecore; + +#ifdef EVAS_FRAME_QUEUING + XInitThreads(); +#endif /* ifdef EVAS_FRAME_QUEUING */ + _ecore_x_disp = XOpenDisplay((char *)name); + if (!_ecore_x_disp) + goto shutdown_ecore_event; + + _ecore_x_error_handler_init(); + _ecore_x_event_handlers_num = LASTEvent; + +#define ECORE_X_EVENT_HANDLERS_GROW(ext_base, ext_num_events) \ + do { \ + if (_ecore_x_event_handlers_num < (ext_base + ext_num_events)) { \ + _ecore_x_event_handlers_num = (ext_base + ext_num_events); } \ + } while (0) + + if (XShapeQueryExtension(_ecore_x_disp, &shape_base, &shape_err_base)) + _ecore_x_event_shape_id = shape_base; + + ECORE_X_EVENT_HANDLERS_GROW(shape_base, ShapeNumberEvents); + +#ifdef ECORE_XSS + if (XScreenSaverQueryExtension(_ecore_x_disp, &screensaver_base, + &screensaver_err_base)) + _ecore_x_event_screensaver_id = screensaver_base; + + ECORE_X_EVENT_HANDLERS_GROW(screensaver_base, ScreenSaverNumberEvents); +#endif /* ifdef ECORE_XSS */ + + if (XSyncQueryExtension(_ecore_x_disp, &sync_base, &sync_err_base)) + { + int major, minor; + + _ecore_x_event_sync_id = sync_base; + if (!XSyncInitialize(_ecore_x_disp, &major, &minor)) + _ecore_x_event_sync_id = 0; + } + + ECORE_X_EVENT_HANDLERS_GROW(sync_base, XSyncNumberEvents); + +#ifdef ECORE_XRANDR + if (XRRQueryExtension(_ecore_x_disp, &randr_base, &randr_err_base)) + _ecore_x_event_randr_id = randr_base; + + ECORE_X_EVENT_HANDLERS_GROW(randr_base, RRNumberEvents); +#endif /* ifdef ECORE_XRANDR */ + +#ifdef ECORE_XFIXES + if (XFixesQueryExtension(_ecore_x_disp, &fixes_base, &fixes_err_base)) + _ecore_x_event_fixes_selection_id = fixes_base; + + ECORE_X_EVENT_HANDLERS_GROW(fixes_base, XFixesNumberEvents); +#endif /* ifdef ECORE_XFIXES */ + +#ifdef ECORE_XDAMAGE + if (XDamageQueryExtension(_ecore_x_disp, &damage_base, &damage_err_base)) + _ecore_x_event_damage_id = damage_base; + + ECORE_X_EVENT_HANDLERS_GROW(damage_base, XDamageNumberEvents); +#endif /* ifdef ECORE_XDAMAGE */ + +#ifdef ECORE_XGESTURE + if (XGestureQueryExtension(_ecore_x_disp, &gesture_base, &gesture_err_base)) + _ecore_x_event_gesture_id = gesture_base; + + ECORE_X_EVENT_HANDLERS_GROW(gesture_base, GestureNumberEvents); +#endif /* ifdef ECORE_XGESTURE */ + + _ecore_x_event_handlers = calloc(_ecore_x_event_handlers_num, sizeof(void *)); + if (!_ecore_x_event_handlers) + goto close_display; + +#ifdef ECORE_XCURSOR + _ecore_x_xcursor = XcursorSupportsARGB(_ecore_x_disp) ? EINA_TRUE : EINA_FALSE; +#endif /* ifdef ECORE_XCURSOR */ + _ecore_x_event_handlers[AnyXEvent] = _ecore_x_event_handle_any_event; + _ecore_x_event_handlers[KeyPress] = _ecore_x_event_handle_key_press; + _ecore_x_event_handlers[KeyRelease] = _ecore_x_event_handle_key_release; + _ecore_x_event_handlers[ButtonPress] = _ecore_x_event_handle_button_press; + _ecore_x_event_handlers[ButtonRelease] = + _ecore_x_event_handle_button_release; + _ecore_x_event_handlers[MotionNotify] = _ecore_x_event_handle_motion_notify; + _ecore_x_event_handlers[EnterNotify] = _ecore_x_event_handle_enter_notify; + _ecore_x_event_handlers[LeaveNotify] = _ecore_x_event_handle_leave_notify; + _ecore_x_event_handlers[FocusIn] = _ecore_x_event_handle_focus_in; + _ecore_x_event_handlers[FocusOut] = _ecore_x_event_handle_focus_out; + _ecore_x_event_handlers[KeymapNotify] = _ecore_x_event_handle_keymap_notify; + _ecore_x_event_handlers[Expose] = _ecore_x_event_handle_expose; + _ecore_x_event_handlers[GraphicsExpose] = + _ecore_x_event_handle_graphics_expose; + _ecore_x_event_handlers[VisibilityNotify] = + _ecore_x_event_handle_visibility_notify; + _ecore_x_event_handlers[CreateNotify] = _ecore_x_event_handle_create_notify; + _ecore_x_event_handlers[DestroyNotify] = + _ecore_x_event_handle_destroy_notify; + _ecore_x_event_handlers[UnmapNotify] = _ecore_x_event_handle_unmap_notify; + _ecore_x_event_handlers[MapNotify] = _ecore_x_event_handle_map_notify; + _ecore_x_event_handlers[MapRequest] = _ecore_x_event_handle_map_request; + _ecore_x_event_handlers[ReparentNotify] = + _ecore_x_event_handle_reparent_notify; + _ecore_x_event_handlers[ConfigureNotify] = + _ecore_x_event_handle_configure_notify; + _ecore_x_event_handlers[ConfigureRequest] = + _ecore_x_event_handle_configure_request; + _ecore_x_event_handlers[GravityNotify] = + _ecore_x_event_handle_gravity_notify; + _ecore_x_event_handlers[ResizeRequest] = + _ecore_x_event_handle_resize_request; + _ecore_x_event_handlers[CirculateNotify] = + _ecore_x_event_handle_circulate_notify; + _ecore_x_event_handlers[CirculateRequest] = + _ecore_x_event_handle_circulate_request; + _ecore_x_event_handlers[PropertyNotify] = + _ecore_x_event_handle_property_notify; + _ecore_x_event_handlers[SelectionClear] = + _ecore_x_event_handle_selection_clear; + _ecore_x_event_handlers[SelectionRequest] = + _ecore_x_event_handle_selection_request; + _ecore_x_event_handlers[SelectionNotify] = + _ecore_x_event_handle_selection_notify; + _ecore_x_event_handlers[ColormapNotify] = + _ecore_x_event_handle_colormap_notify; + _ecore_x_event_handlers[ClientMessage] = + _ecore_x_event_handle_client_message; + _ecore_x_event_handlers[MappingNotify] = + _ecore_x_event_handle_mapping_notify; +#ifdef GenericEvent + _ecore_x_event_handlers[GenericEvent] = _ecore_x_event_handle_generic_event; +#endif /* ifdef GenericEvent */ + + if (_ecore_x_event_shape_id) + _ecore_x_event_handlers[_ecore_x_event_shape_id] = + _ecore_x_event_handle_shape_change; + + if (_ecore_x_event_screensaver_id) + _ecore_x_event_handlers[_ecore_x_event_screensaver_id] = + _ecore_x_event_handle_screensaver_notify; + + if (_ecore_x_event_sync_id) + { + _ecore_x_event_handlers[_ecore_x_event_sync_id + XSyncCounterNotify] = + _ecore_x_event_handle_sync_counter; + _ecore_x_event_handlers[_ecore_x_event_sync_id + XSyncAlarmNotify] = + _ecore_x_event_handle_sync_alarm; + } + +#ifdef ECORE_XRANDR + if (_ecore_x_event_randr_id) + { + _ecore_x_event_handlers[_ecore_x_event_randr_id + + RRScreenChangeNotify] = + _ecore_x_event_handle_randr_change; + _ecore_x_event_handlers[_ecore_x_event_randr_id + + RRNotify] = _ecore_x_event_handle_randr_notify; + } + +#endif /* ifdef ECORE_XRANDR */ +#ifdef ECORE_XFIXES + if (_ecore_x_event_fixes_selection_id) + _ecore_x_event_handlers[_ecore_x_event_fixes_selection_id] = + _ecore_x_event_handle_fixes_selection_notify; + +#endif /* ifdef ECORE_XFIXES */ +#ifdef ECORE_XDAMAGE + if (_ecore_x_event_damage_id) + _ecore_x_event_handlers[_ecore_x_event_damage_id] = + _ecore_x_event_handle_damage_notify; + +#endif /* ifdef ECORE_XDAMAGE */ +#ifdef ECORE_XKB + // set x autorepeat detection to on. that means instead of + // press-release-press-release-press-release + // you get + // press-press-press-press-press-release + do + { + Bool works = 0; + XkbSetDetectableAutoRepeat(_ecore_x_disp, 1, &works); + } + while (0); +#endif /* ifdef ECORE_XKB */ + +#ifdef ECORE_XGESTURE + if (_ecore_x_event_gesture_id) + { + _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyFlick] = + _ecore_x_event_handle_gesture_notify_flick; + _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPan] = + _ecore_x_event_handle_gesture_notify_pan; + _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyPinchRotation] = + _ecore_x_event_handle_gesture_notify_pinchrotation; + _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTap] = + _ecore_x_event_handle_gesture_notify_tap; + _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyTapNHold] = + _ecore_x_event_handle_gesture_notify_tapnhold; + _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyHold] = + _ecore_x_event_handle_gesture_notify_hold; + _ecore_x_event_handlers[_ecore_x_event_gesture_id + GestureNotifyGroup] = + _ecore_x_event_handle_gesture_notify_group; + } + +#endif /* ifdef ECORE_XGESTURE */ + + if (!ECORE_X_EVENT_ANY) + { + ECORE_X_EVENT_ANY = ecore_event_type_new(); + ECORE_X_EVENT_MOUSE_IN = ecore_event_type_new(); + ECORE_X_EVENT_MOUSE_OUT = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_KEYMAP = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_DAMAGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_CREATE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_DESTROY = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_HIDE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_SHOW = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_SHOW_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_REPARENT = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_CONFIGURE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_GRAVITY = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_RESIZE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_STACK = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_STACK_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_PROPERTY = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_COLORMAP = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_MAPPING = ecore_event_type_new(); + ECORE_X_EVENT_MAPPING_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_SELECTION_CLEAR = ecore_event_type_new(); + ECORE_X_EVENT_SELECTION_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_SELECTION_NOTIFY = ecore_event_type_new(); + ECORE_X_EVENT_CLIENT_MESSAGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_SHAPE = ecore_event_type_new(); + ECORE_X_EVENT_SCREENSAVER_NOTIFY = ecore_event_type_new(); + ECORE_X_EVENT_GESTURE_NOTIFY_FLICK = ecore_event_type_new(); + ECORE_X_EVENT_GESTURE_NOTIFY_PAN = ecore_event_type_new(); + ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION = ecore_event_type_new(); + ECORE_X_EVENT_GESTURE_NOTIFY_TAP = ecore_event_type_new(); + ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD = ecore_event_type_new(); + ECORE_X_EVENT_GESTURE_NOTIFY_HOLD = ecore_event_type_new(); + ECORE_X_EVENT_GESTURE_NOTIFY_GROUP = ecore_event_type_new(); + ECORE_X_EVENT_SYNC_COUNTER = ecore_event_type_new(); + ECORE_X_EVENT_SYNC_ALARM = ecore_event_type_new(); + ECORE_X_EVENT_SCREEN_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_RANDR_CRTC_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_RANDR_OUTPUT_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY = ecore_event_type_new(); + ECORE_X_EVENT_DAMAGE_NOTIFY = ecore_event_type_new(); + + ECORE_X_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new(); + + ECORE_X_EVENT_DESKTOP_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_WINDOW_STATE_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_FRAME_EXTENTS_REQUEST = ecore_event_type_new(); + ECORE_X_EVENT_PING = ecore_event_type_new(); + + ECORE_X_EVENT_STARTUP_SEQUENCE_NEW = ecore_event_type_new(); + ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE = ecore_event_type_new(); + ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE = ecore_event_type_new(); + + ECORE_X_EVENT_GENERIC = ecore_event_type_new(); + } + + _ecore_x_modifiers_get(); + + _ecore_x_fd_handler_handle = + ecore_main_fd_handler_add(ConnectionNumber(_ecore_x_disp), + ECORE_FD_READ, + _ecore_x_fd_handler, _ecore_x_disp, + _ecore_x_fd_handler_buf, _ecore_x_disp); + if (!_ecore_x_fd_handler_handle) + goto free_event_handlers; + + _ecore_x_atoms_init(); + + /* Set up the ICCCM hints */ + ecore_x_icccm_init(); + + /* Set up the _NET_... hints */ + ecore_x_netwm_init(); + + /* old e hints init */ + ecore_x_e_init(); + + /* This is just to be anal about naming conventions */ + + _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_DELETE_REQUEST] = + ECORE_X_ATOM_WM_DELETE_WINDOW; + _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_TAKE_FOCUS] = + ECORE_X_ATOM_WM_TAKE_FOCUS; + _ecore_x_atoms_wm_protocols[ECORE_X_NET_WM_PROTOCOL_PING] = + ECORE_X_ATOM_NET_WM_PING; + _ecore_x_atoms_wm_protocols[ECORE_X_NET_WM_PROTOCOL_SYNC_REQUEST] = + ECORE_X_ATOM_NET_WM_SYNC_REQUEST; + + _ecore_x_selection_data_init(); + _ecore_x_dnd_init(); + _ecore_x_fixes_init(); + _ecore_x_damage_init(); + _ecore_x_composite_init(); + _ecore_x_dpms_init(); + _ecore_x_randr_init(); + _ecore_x_gesture_init(); + _ecore_x_input_init(); + _ecore_x_events_init(); + + _ecore_x_private_win = ecore_x_window_override_new(0, -77, -777, 123, 456); + + return _ecore_x_init_count; + +free_event_handlers: + free(_ecore_x_event_handlers); + _ecore_x_event_handlers = NULL; +close_display: + XCloseDisplay(_ecore_x_disp); + _ecore_x_fd_handler_handle = NULL; + _ecore_x_disp = NULL; +shutdown_ecore_event: + ecore_event_shutdown(); +shutdown_ecore: + ecore_shutdown(); +shutdown_eina: + eina_log_domain_unregister(_ecore_xlib_log_dom); + _ecore_xlib_log_dom = -1; + eina_shutdown(); + + return --_ecore_x_init_count; +} /* ecore_x_init */ + +static int +_ecore_x_shutdown(int close_display) +{ + if (--_ecore_x_init_count != 0) + return _ecore_x_init_count; + + if (!_ecore_x_disp) + return _ecore_x_init_count; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + ecore_main_fd_handler_del(_ecore_x_fd_handler_handle); + if (close_display) + XCloseDisplay(_ecore_x_disp); + else + { + close(ConnectionNumber(_ecore_x_disp)); + // FIXME: may have to clean up x display internal here +// getting segv here? hmmm. odd. disable +// XFree(_ecore_x_disp); + } + + free(_ecore_x_event_handlers); + _ecore_x_fd_handler_handle = NULL; + _ecore_x_disp = NULL; + _ecore_x_event_handlers = NULL; + _ecore_x_events_shutdown(); + _ecore_x_input_shutdown(); + _ecore_x_selection_shutdown(); + _ecore_x_dnd_shutdown(); + ecore_x_netwm_shutdown(); + + ecore_event_shutdown(); + ecore_shutdown(); + + eina_log_domain_unregister(_ecore_xlib_log_dom); + _ecore_xlib_log_dom = -1; + eina_shutdown(); + + return _ecore_x_init_count; +} /* _ecore_x_shutdown */ + +/** + * Shuts down the Ecore X library. + * + * In shutting down the library, the X display connection is terminated + * and any event handlers for it are removed. + * + * @return The number of times the library has been initialized without + * being shut down. + * @ingroup Ecore_X_Init_Group + */ +EAPI int +ecore_x_shutdown(void) +{ + return _ecore_x_shutdown(1); +} /* ecore_x_shutdown */ + +/** + * Shuts down the Ecore X library. + * + * As ecore_x_shutdown, except do not close Display, only connection. + * + * @ingroup Ecore_X_Init_Group + */ +EAPI int +ecore_x_disconnect(void) +{ + return _ecore_x_shutdown(0); +} /* ecore_x_disconnect */ + +/** + * @defgroup Ecore_X_Display_Attr_Group X Display Attributes + * + * Functions that set and retrieve X display attributes. + */ + +/** + * Retrieves the Ecore_X_Display handle used for the current X connection. + * @return The current X display. + * @ingroup Ecore_X_Display_Attr_Group + */ +EAPI Ecore_X_Display * +ecore_x_display_get(void) +{ + return (Ecore_X_Display *)_ecore_x_disp; +} /* ecore_x_display_get */ + +/** + * Retrieves the X display file descriptor. + * @return The current X display file descriptor. + * @ingroup Ecore_X_Display_Attr_Group + */ +EAPI int +ecore_x_fd_get(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return ConnectionNumber(_ecore_x_disp); +} /* ecore_x_fd_get */ + +/** + * Retrieves the Ecore_X_Screen handle used for the current X connection. + * @return The current default screen. + * @ingroup Ecore_X_Display_Attr_Group + */ +EAPI Ecore_X_Screen * +ecore_x_default_screen_get(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return (Ecore_X_Screen *)DefaultScreenOfDisplay(_ecore_x_disp); +} /* ecore_x_default_screen_get */ + +/** + * Retrieves the size of an Ecore_X_Screen. + * @param screen the handle to the screen to query. + * @param w where to return the width. May be NULL. Returns 0 on errors. + * @param h where to return the height. May be NULL. Returns 0 on errors. + * @ingroup Ecore_X_Display_Attr_Group + * @see ecore_x_default_screen_get() + * + * @since 1.1 + */ +EAPI void +ecore_x_screen_size_get(const Ecore_X_Screen *screen, + int *w, + int *h) +{ + Screen *s = (Screen *)screen; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (w) *w = 0; + if (h) *h = 0; + if (!s) return; + if (w) *w = s->width; + if (h) *h = s->height; +} + +/** + * Retrieves the number of screens. + * + * @return The count of the number of screens. + * @ingroup Ecore_X_Display_Attr_Group + * + * @since 1.1 + */ +EAPI int +ecore_x_screen_count_get(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + return ScreenCount(_ecore_x_disp); +} + +/** + * Retrieves the index number of the given screen. + * + * @return The index number of the screen. + * @ingroup Ecore_X_Display_Attr_Group + * + * @since 1.1 + */ +EAPI int +ecore_x_screen_index_get(const Ecore_X_Screen *screen) +{ + return XScreenNumberOfScreen((Screen *)screen); +} + +/** + * Retrieves the screen based on index number. + * + * @return The Ecore_X_Screen at this index. + * @ingroup Ecore_X_Display_Attr_Group + * + * @since 1.1 + */ +EAPI Ecore_X_Screen * +ecore_x_screen_get(int idx) +{ + return XScreenOfDisplay(_ecore_x_disp, idx); +} + +/** + * Sets the timeout for a double and triple clicks to be flagged. + * + * This sets the time between clicks before the double_click flag is + * set in a button down event. If 3 clicks occur within double this + * time, the triple_click flag is also set. + * + * @param t The time in seconds + * @ingroup Ecore_X_Display_Attr_Group + */ +EAPI void +ecore_x_double_click_time_set(double t) +{ + if (t < 0.0) + t = 0.0; + + _ecore_x_double_click_time = t; +} /* ecore_x_double_click_time_set */ + +/** + * Retrieves the double and triple click flag timeout. + * + * See @ref ecore_x_double_click_time_set for more information. + * + * @return The timeout for double clicks in seconds. + * @ingroup Ecore_X_Display_Attr_Group + */ +EAPI double +ecore_x_double_click_time_get(void) +{ + return _ecore_x_double_click_time; +} /* ecore_x_double_click_time_get */ + +/** + * @defgroup Ecore_X_Flush_Group X Synchronization Functions + * + * Functions that ensure that all commands that have been issued by the + * Ecore X library have been sent to the server. + */ + +/** + * Sends all X commands in the X Display buffer. + * @ingroup Ecore_X_Flush_Group + */ +EAPI void +ecore_x_flush(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFlush(_ecore_x_disp); +} /* ecore_x_flush */ + +/** + * Flushes the command buffer and waits until all requests have been + * processed by the server. + * @ingroup Ecore_X_Flush_Group + */ +EAPI void +ecore_x_sync(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSync(_ecore_x_disp, False); +} /* ecore_x_sync */ + +/** + * Kill all clients with subwindows under a given window. + * + * You can kill all clients connected to the X server by using + * @ref ecore_x_window_root_list to get a list of root windows, and + * then passing each root window to this function. + * + * @param root The window whose children will be killed. + */ +EAPI void +ecore_x_killall(Ecore_X_Window root) +{ + unsigned int j; + Window root_r; + Window parent_r; + Window *children_r = NULL; + unsigned int num_children = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XGrabServer(_ecore_x_disp); + /* Tranverse window tree starting from root, and drag each + * before the firing squad */ + while (XQueryTree(_ecore_x_disp, root, &root_r, &parent_r, + &children_r, &num_children) && (num_children > 0)) + { + for (j = 0; j < num_children; ++j) + { + XKillClient(_ecore_x_disp, children_r[j]); + } + + XFree(children_r); + } + XUngrabServer(_ecore_x_disp); + XSync(_ecore_x_disp, False); +} /* ecore_x_killall */ + +/** + * Kill a specific client + * + * You can kill a specific client owning window @p win + * + * @param win Window of the client to be killed + */ +EAPI void +ecore_x_kill(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XKillClient(_ecore_x_disp, win); +} /* ecore_x_kill */ + +/** + * Return the last event time + */ +EAPI Ecore_X_Time +ecore_x_current_time_get(void) +{ + return _ecore_x_event_last_time; +} /* ecore_x_current_time_get */ + +/** + * Return the screen DPI + * + * This is a simplistic call to get DPI. It does not account for differing + * DPI in the x amd y axes nor does it accoutn for multihead or xinerama and + * xrander where different parts of the screen may have differen DPI etc. + * + * @return the general screen DPI (dots/pixels per inch). + */ +EAPI int +ecore_x_dpi_get(void) +{ + Screen *s; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + s = DefaultScreenOfDisplay(_ecore_x_disp); + if (s->mwidth <= 0) + return 75; + + return (((s->width * 254) / s->mwidth) + 5) / 10; +} /* ecore_x_dpi_get */ + +/** + * Invoke the standard system beep to alert users + * + * @param percent The volume at which the bell rings. Must be in the range + * [-100,+100]. If percent >= 0, the final volume will be: + * base - [(base * percent) / 100] + percent + * Otherwise, it's calculated as: + * base + [(base * percent) / 100] + * where @c base is the bell's base volume as set by XChangeKeyboardControl(3). + * + * @returns EINA_TRUE on success, EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_x_bell(int percent) +{ + int ret; + + ret = XBell(_ecore_x_disp, percent); + if (ret == BadValue) + return EINA_FALSE; + + return EINA_TRUE; +} /* ecore_x_bell */ + +static Eina_Bool +_ecore_x_fd_handler(void *data, + Ecore_Fd_Handler *fd_handler __UNUSED__) +{ + Display *d; + + d = data; + while (XPending(d)) + { + XEvent ev; + + XNextEvent(d, &ev); + +#ifdef ENABLE_XIM + /* Filter event for XIM */ + if (XFilterEvent(&ev, ev.xkey.window)) + continue; + +#endif /* ifdef ENABLE_XIM */ + + if ((ev.type >= 0) && (ev.type < _ecore_x_event_handlers_num)) + { + if (_ecore_x_event_handlers[AnyXEvent]) + _ecore_x_event_handlers[AnyXEvent] (&ev); + + if (_ecore_x_event_handlers[ev.type]) + _ecore_x_event_handlers[ev.type] (&ev); + } + } + return ECORE_CALLBACK_RENEW; +} /* _ecore_x_fd_handler */ + +static Eina_Bool +_ecore_x_fd_handler_buf(void *data, + Ecore_Fd_Handler *fd_handler __UNUSED__) +{ + Display *d; + + d = data; + if (XPending(d)) + return ECORE_CALLBACK_RENEW; + + return ECORE_CALLBACK_CANCEL; +} /* _ecore_x_fd_handler_buf */ + +static int +_ecore_x_key_mask_get(KeySym sym) +{ + XModifierKeymap *mod; + KeySym sym2; + int i, j; + const int masks[8] = + { + ShiftMask, LockMask, ControlMask, + Mod1Mask, Mod2Mask, Mod3Mask, Mod4Mask, Mod5Mask + }; + + mod = XGetModifierMapping(_ecore_x_disp); + if ((mod) && (mod->max_keypermod > 0)) + for (i = 0; i < (8 * mod->max_keypermod); i++) + { + for (j = 0; j < 8; j++) + { + sym2 = XKeycodeToKeysym(_ecore_x_disp, mod->modifiermap[i], j); + if (sym2 != 0) + break; + } + if (sym2 == sym) + { + int mask; + + mask = masks[i / mod->max_keypermod]; + if (mod->modifiermap) + XFree(mod->modifiermap); + + XFree(mod); + return mask; + } + } + + if (mod) + { + if (mod->modifiermap) + XFree(mod->modifiermap); + + XFree(mod); + } + + return 0; +} /* _ecore_x_key_mask_get */ + +/*****************************************************************************/ +/*****************************************************************************/ +/*****************************************************************************/ +/* FIXME: these funcs need categorising */ +/*****************************************************************************/ + +/** + * Get a list of all the root windows on the server. + * + * @note The returned array will need to be freed after use. + * @param num_ret Pointer to integer to put number of windows returned in. + * @return An array of all the root windows. @c NULL is returned if memory + * could not be allocated for the list, or if @p num_ret is @c NULL. + */ +EAPI Ecore_X_Window * +ecore_x_window_root_list(int *num_ret) +{ + int num, i; + Ecore_X_Window *roots; +#ifdef ECORE_XPRINT + int xp_base, xp_err_base; +#endif /* ifdef ECORE_XPRINT */ + + if (!num_ret) + return NULL; + + *num_ret = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); +#ifdef ECORE_XPRINT + num = ScreenCount(_ecore_x_disp); + if (XpQueryExtension(_ecore_x_disp, &xp_base, &xp_err_base)) + { + Screen **ps = NULL; + int psnum = 0; + + ps = XpQueryScreens(_ecore_x_disp, &psnum); + if (ps) + { + int overlap, j; + + overlap = 0; + for (i = 0; i < num; i++) + { + for (j = 0; j < psnum; j++) + { + if (ScreenOfDisplay(_ecore_x_disp, i) == ps[j]) + overlap++; + } + } + roots = malloc((num - overlap) * sizeof(Window)); + if (roots) + { + int k; + + k = 0; + for (i = 0; i < num; i++) + { + int is_print; + + is_print = 0; + for (j = 0; j < psnum; j++) + { + if (ScreenOfDisplay(_ecore_x_disp, i) == ps[j]) + { + is_print = 1; + break; + } + } + if (!is_print) + { + roots[k] = RootWindow(_ecore_x_disp, i); + k++; + } + } + *num_ret = k; + } + + XFree(ps); + } + else + { + roots = malloc(num * sizeof(Window)); + if (!roots) + return NULL; + + *num_ret = num; + for (i = 0; i < num; i++) + roots[i] = RootWindow(_ecore_x_disp, i); + } + } + else + { + roots = malloc(num * sizeof(Window)); + if (!roots) + return NULL; + + *num_ret = num; + for (i = 0; i < num; i++) + roots[i] = RootWindow(_ecore_x_disp, i); + } + +#else /* ifdef ECORE_XPRINT */ + num = ScreenCount(_ecore_x_disp); + roots = malloc(num * sizeof(Window)); + if (!roots) + return NULL; + + *num_ret = num; + for (i = 0; i < num; i++) + roots[i] = RootWindow(_ecore_x_disp, i); +#endif /* ifdef ECORE_XPRINT */ + return roots; +} /* ecore_x_window_root_list */ + +EAPI Ecore_X_Window +ecore_x_window_root_first_get(void) +{ + return RootWindow(_ecore_x_disp, 0); +/* + int num; + Ecore_X_Window root, *roots = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + roots = ecore_x_window_root_list(&num); + if (!(roots)) return 0; + + if (num > 0) + root = roots[0]; + else + root = 0; + + free(roots); + return root; + */ +} /* ecore_x_window_root_first_get */ + +static void _ecore_x_window_manage_error(void *data); + +static int _ecore_x_window_manage_failed = 0; +static void +_ecore_x_window_manage_error(void *data __UNUSED__) +{ + if ((ecore_x_error_request_get() == X_ChangeWindowAttributes) && + (ecore_x_error_code_get() == BadAccess)) + _ecore_x_window_manage_failed = 1; +} /* _ecore_x_window_manage_error */ + +EAPI Eina_Bool +ecore_x_window_manage(Ecore_X_Window win) +{ + XWindowAttributes att; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (XGetWindowAttributes(_ecore_x_disp, win, &att) != True) + return EINA_FALSE; + + ecore_x_sync(); + _ecore_x_window_manage_failed = 0; + ecore_x_error_handler_set(_ecore_x_window_manage_error, NULL); + XSelectInput(_ecore_x_disp, win, + EnterWindowMask | + LeaveWindowMask | + PropertyChangeMask | + ResizeRedirectMask | + SubstructureRedirectMask | + SubstructureNotifyMask | + StructureNotifyMask | + KeyPressMask | + KeyReleaseMask | + att.your_event_mask); + ecore_x_sync(); + ecore_x_error_handler_set(NULL, NULL); + if (_ecore_x_window_manage_failed) + { + _ecore_x_window_manage_failed = 0; + return EINA_FALSE; + } + + return EINA_TRUE; +} /* ecore_x_window_manage */ + +EAPI void +ecore_x_window_container_manage(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSelectInput(_ecore_x_disp, win, + SubstructureRedirectMask | + SubstructureNotifyMask); +} /* ecore_x_window_container_manage */ + +EAPI void +ecore_x_window_client_manage(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSelectInput(_ecore_x_disp, win, + PropertyChangeMask | +// ResizeRedirectMask | + FocusChangeMask | + ColormapChangeMask | + VisibilityChangeMask | + StructureNotifyMask | + SubstructureNotifyMask + ); + XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask); +} /* ecore_x_window_client_manage */ + +EAPI void +ecore_x_window_sniff(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSelectInput(_ecore_x_disp, win, + PropertyChangeMask | + SubstructureNotifyMask); +} /* ecore_x_window_sniff */ + +EAPI void +ecore_x_window_client_sniff(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSelectInput(_ecore_x_disp, win, + PropertyChangeMask | + FocusChangeMask | + ColormapChangeMask | + VisibilityChangeMask | + StructureNotifyMask | + SubstructureNotifyMask); + XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask); +} /* ecore_x_window_client_sniff */ + +EAPI Eina_Bool +ecore_x_window_attributes_get(Ecore_X_Window win, + Ecore_X_Window_Attributes *att_ret) +{ + XWindowAttributes att; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) + return EINA_FALSE; + + memset(att_ret, 0, sizeof(Ecore_X_Window_Attributes)); + att_ret->root = att.root; + att_ret->x = att.x; + att_ret->y = att.y; + att_ret->w = att.width; + att_ret->h = att.height; + att_ret->border = att.border_width; + att_ret->depth = att.depth; + if (att.map_state != IsUnmapped) + att_ret->visible = 1; + + if (att.map_state == IsViewable) + att_ret->viewable = 1; + + if (att.override_redirect) + att_ret->override = 1; + + if (att.class == InputOnly) + att_ret->input_only = 1; + + if (att.save_under) + att_ret->save_under = 1; + + att_ret->event_mask.mine = att.your_event_mask; + att_ret->event_mask.all = att.all_event_masks; + att_ret->event_mask.no_propagate = att.do_not_propagate_mask; + att_ret->window_gravity = att.win_gravity; + att_ret->pixel_gravity = att.bit_gravity; + att_ret->colormap = att.colormap; + att_ret->visual = att.visual; + return EINA_TRUE; +} /* ecore_x_window_attributes_get */ + +EAPI void +ecore_x_window_save_set_add(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XAddToSaveSet(_ecore_x_disp, win); +} /* ecore_x_window_save_set_add */ + +EAPI void +ecore_x_window_save_set_del(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XRemoveFromSaveSet(_ecore_x_disp, win); +} /* ecore_x_window_save_set_del */ + +EAPI Ecore_X_Window * +ecore_x_window_children_get(Ecore_X_Window win, + int *num) +{ + Ecore_X_Window *windows = NULL; + Window root_ret = 0, parent_ret = 0, *children_ret = NULL; + unsigned int children_ret_num = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!XQueryTree(_ecore_x_disp, win, &root_ret, &parent_ret, &children_ret, + &children_ret_num)) + return NULL; + + if (children_ret) + { + windows = malloc(children_ret_num * sizeof(Ecore_X_Window)); + if (windows) + { + unsigned int i; + + for (i = 0; i < children_ret_num; i++) + windows[i] = children_ret[i]; + *num = children_ret_num; + } + + XFree(children_ret); + } + + return windows; +} /* ecore_x_window_children_get */ + +EAPI Eina_Bool +ecore_x_pointer_control_set(int accel_num, + int accel_denom, + int threshold) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XChangePointerControl(_ecore_x_disp, 1, 1, + accel_num, accel_denom, threshold) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_pointer_control_set */ + +EAPI Eina_Bool +ecore_x_pointer_control_get(int *accel_num, + int *accel_denom, + int *threshold) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XGetPointerControl(_ecore_x_disp, + accel_num, accel_denom, threshold) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_pointer_control_get */ + +EAPI Eina_Bool +ecore_x_pointer_mapping_set(unsigned char *map, + int nmap) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XSetPointerMapping(_ecore_x_disp, map, nmap) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_pointer_mapping_set */ + +EAPI Eina_Bool +ecore_x_pointer_mapping_get(unsigned char *map, + int nmap) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XGetPointerMapping(_ecore_x_disp, map, nmap) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_pointer_mapping_get */ + +EAPI Eina_Bool +ecore_x_pointer_grab(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (XGrabPointer(_ecore_x_disp, win, False, + ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | LeaveWindowMask | PointerMotionMask, + GrabModeAsync, GrabModeAsync, + None, None, CurrentTime) == GrabSuccess) + return EINA_TRUE; + + return EINA_FALSE; +} /* ecore_x_pointer_grab */ + +EAPI Eina_Bool +ecore_x_pointer_confine_grab(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (XGrabPointer(_ecore_x_disp, win, False, + ButtonPressMask | ButtonReleaseMask | + EnterWindowMask | LeaveWindowMask | PointerMotionMask, + GrabModeAsync, GrabModeAsync, + win, None, CurrentTime) == GrabSuccess) + return EINA_TRUE; + + return EINA_FALSE; +} /* ecore_x_pointer_confine_grab */ + +EAPI void +ecore_x_pointer_ungrab(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XUngrabPointer(_ecore_x_disp, CurrentTime); +} /* ecore_x_pointer_ungrab */ + +EAPI Eina_Bool +ecore_x_pointer_warp(Ecore_X_Window win, + int x, + int y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XWarpPointer(_ecore_x_disp, None, win, 0, 0, 0, 0, x, y) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_pointer_warp */ + +EAPI Eina_Bool +ecore_x_keyboard_grab(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (XGrabKeyboard(_ecore_x_disp, win, False, + GrabModeAsync, GrabModeAsync, + CurrentTime) == GrabSuccess) + return EINA_TRUE; + + return EINA_FALSE; +} /* ecore_x_keyboard_grab */ + +EAPI void +ecore_x_keyboard_ungrab(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XUngrabKeyboard(_ecore_x_disp, CurrentTime); +} /* ecore_x_keyboard_ungrab */ + +EAPI void +ecore_x_grab(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_grab_count++; + if (_ecore_x_grab_count == 1) + XGrabServer(_ecore_x_disp); +} /* ecore_x_grab */ + +EAPI void +ecore_x_ungrab(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_grab_count--; + if (_ecore_x_grab_count < 0) + _ecore_x_grab_count = 0; + + if (_ecore_x_grab_count == 0) + XUngrabServer(_ecore_x_disp); +} /* ecore_x_ungrab */ + +int _ecore_window_grabs_num = 0; +Window *_ecore_window_grabs = NULL; +Eina_Bool (*_ecore_window_grab_replay_func)(void *data, + int event_type, + void *event); +void *_ecore_window_grab_replay_data; + +EAPI void +ecore_x_passive_grab_replay_func_set(Eina_Bool (*func)(void *data, + int event_type, + void *event), + void *data) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_window_grab_replay_func = func; + _ecore_window_grab_replay_data = data; +} /* ecore_x_passive_grab_replay_func_set */ + +EAPI void +ecore_x_window_button_grab(Ecore_X_Window win, + int button, + Ecore_X_Event_Mask event_mask, + int mod, + int any_mod) +{ + unsigned int b; + unsigned int m; + unsigned int locks[8]; + int i, ev; + Window *t; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + b = button; + if (b == 0) + b = AnyButton; + + m = _ecore_x_event_modifier(mod); + if (any_mod) + m = AnyModifier; + + locks[0] = 0; + locks[1] = ECORE_X_LOCK_CAPS; + locks[2] = ECORE_X_LOCK_NUM; + locks[3] = ECORE_X_LOCK_SCROLL; + locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; + locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; + locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + ev = event_mask; + for (i = 0; i < 8; i++) + XGrabButton(_ecore_x_disp, b, m | locks[i], + win, False, ev, GrabModeSync, GrabModeAsync, None, None); + _ecore_window_grabs_num++; + t = realloc(_ecore_window_grabs, + _ecore_window_grabs_num * sizeof(Window)); + if (!t) return; + _ecore_window_grabs = t; + _ecore_window_grabs[_ecore_window_grabs_num - 1] = win; +} /* ecore_x_window_button_grab */ + +void +_ecore_x_sync_magic_send(int val, + Ecore_X_Window swin) +{ + XEvent xev; + + xev.xclient.type = ClientMessage; + xev.xclient.serial = 0; + xev.xclient.send_event = True; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = _ecore_x_private_win; + xev.xclient.format = 32; + xev.xclient.message_type = 27777; + xev.xclient.data.l[0] = 0x7162534; + xev.xclient.data.l[1] = 0x10000000 + val; + xev.xclient.data.l[2] = swin; + XSendEvent(_ecore_x_disp, _ecore_x_private_win, False, NoEventMask, &xev); +} /* _ecore_x_sync_magic_send */ + +void +_ecore_x_window_grab_remove(Ecore_X_Window win) +{ + int i, shuffle = 0; + Window *t; + + if (_ecore_window_grabs_num > 0) + { + for (i = 0; i < _ecore_window_grabs_num; i++) + { + if (shuffle) + _ecore_window_grabs[i - 1] = _ecore_window_grabs[i]; + + if ((!shuffle) && (_ecore_window_grabs[i] == win)) + shuffle = 1; + } + if (shuffle) + { + _ecore_window_grabs_num--; + if (_ecore_window_grabs_num <= 0) + { + free(_ecore_window_grabs); + _ecore_window_grabs = NULL; + return; + } + t = realloc(_ecore_window_grabs, + _ecore_window_grabs_num * + sizeof(Window)); + if (!t) return; + _ecore_window_grabs = t; + } + } +} /* _ecore_x_window_grab_remove */ + +EAPI void +ecore_x_window_button_ungrab(Ecore_X_Window win, + int button, + int mod, + int any_mod) +{ + unsigned int b; + unsigned int m; + unsigned int locks[8]; + int i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + b = button; + if (b == 0) + b = AnyButton; + + m = _ecore_x_event_modifier(mod); + if (any_mod) + m = AnyModifier; + + locks[0] = 0; + locks[1] = ECORE_X_LOCK_CAPS; + locks[2] = ECORE_X_LOCK_NUM; + locks[3] = ECORE_X_LOCK_SCROLL; + locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; + locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; + locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + for (i = 0; i < 8; i++) + XUngrabButton(_ecore_x_disp, b, m | locks[i], win); + _ecore_x_sync_magic_send(1, win); +} /* ecore_x_window_button_ungrab */ + +int _ecore_key_grabs_num = 0; +Window *_ecore_key_grabs = NULL; + +EAPI void +ecore_x_window_key_grab(Ecore_X_Window win, + const char *key, + int mod, + int any_mod) +{ + KeyCode keycode = 0; + KeySym keysym; + unsigned int m; + unsigned int locks[8]; + int i; + Window *t; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!strncmp(key, "Keycode-", 8)) + keycode = atoi(key + 8); + else + { + keysym = XStringToKeysym(key); + if (keysym == NoSymbol) + return; + + keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key)); + } + + if (keycode == 0) + return; + + m = _ecore_x_event_modifier(mod); + if (any_mod) + m = AnyModifier; + + locks[0] = 0; + locks[1] = ECORE_X_LOCK_CAPS; + locks[2] = ECORE_X_LOCK_NUM; + locks[3] = ECORE_X_LOCK_SCROLL; + locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; + locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; + locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + for (i = 0; i < 8; i++) + XGrabKey(_ecore_x_disp, keycode, m | locks[i], + win, False, GrabModeSync, GrabModeAsync); + _ecore_key_grabs_num++; + t = realloc(_ecore_key_grabs, + _ecore_key_grabs_num * sizeof(Window)); + if (!t) return; + _ecore_key_grabs = t; + _ecore_key_grabs[_ecore_key_grabs_num - 1] = win; +} /* ecore_x_window_key_grab */ + +void +_ecore_x_key_grab_remove(Ecore_X_Window win) +{ + int i, shuffle = 0; + Window *t; + + if (_ecore_key_grabs_num > 0) + { + for (i = 0; i < _ecore_key_grabs_num; i++) + { + if (shuffle) + _ecore_key_grabs[i - 1] = _ecore_key_grabs[i]; + + if ((!shuffle) && (_ecore_key_grabs[i] == win)) + shuffle = 1; + } + if (shuffle) + { + _ecore_key_grabs_num--; + if (_ecore_key_grabs_num <= 0) + { + free(_ecore_key_grabs); + _ecore_key_grabs = NULL; + return; + } + t = realloc(_ecore_key_grabs, + _ecore_key_grabs_num * sizeof(Window)); + if (!t) return; + _ecore_key_grabs = t; + } + } +} /* _ecore_x_key_grab_remove */ + +EAPI void +ecore_x_window_key_ungrab(Ecore_X_Window win, + const char *key, + int mod, + int any_mod) +{ + KeyCode keycode = 0; + KeySym keysym; + unsigned int m; + unsigned int locks[8]; + int i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!strncmp(key, "Keycode-", 8)) + keycode = atoi(key + 8); + else + { + keysym = XStringToKeysym(key); + if (keysym == NoSymbol) + return; + + keycode = XKeysymToKeycode(_ecore_x_disp, XStringToKeysym(key)); + } + + if (keycode == 0) + return; + + m = _ecore_x_event_modifier(mod); + if (any_mod) + m = AnyModifier; + + locks[0] = 0; + locks[1] = ECORE_X_LOCK_CAPS; + locks[2] = ECORE_X_LOCK_NUM; + locks[3] = ECORE_X_LOCK_SCROLL; + locks[4] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM; + locks[5] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_SCROLL; + locks[6] = ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + locks[7] = ECORE_X_LOCK_CAPS | ECORE_X_LOCK_NUM | ECORE_X_LOCK_SCROLL; + for (i = 0; i < 8; i++) + XUngrabKey(_ecore_x_disp, keycode, m | locks[i], win); + _ecore_x_sync_magic_send(2, win); +} /* ecore_x_window_key_ungrab */ + +/** + * Send client message with given type and format 32. + * + * @param win The window the message is sent to. + * @param type The client message type. + * @param d0 The client message data item 1 + * @param d1 The client message data item 2 + * @param d2 The client message data item 3 + * @param d3 The client message data item 4 + * @param d4 The client message data item 5 + * + * @return EINA_TRUE on success EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_x_client_message32_send(Ecore_X_Window win, + Ecore_X_Atom type, + Ecore_X_Event_Mask mask, + long d0, + long d1, + long d2, + long d3, + long d4) +{ + XEvent xev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xev.xclient.window = win; + xev.xclient.type = ClientMessage; + xev.xclient.message_type = type; + xev.xclient.format = 32; + xev.xclient.data.l[0] = d0; + xev.xclient.data.l[1] = d1; + xev.xclient.data.l[2] = d2; + xev.xclient.data.l[3] = d3; + xev.xclient.data.l[4] = d4; + + return XSendEvent(_ecore_x_disp, win, False, mask, &xev) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_client_message32_send */ + +/** + * Send client message with given type and format 8. + * + * @param win The window the message is sent to. + * @param type The client message type. + * @param data Data to be sent. + * @param len Number of data bytes, max 20. + * + * @return EINA_TRUE on success EINA_FALSE otherwise. + */ +EAPI Eina_Bool +ecore_x_client_message8_send(Ecore_X_Window win, + Ecore_X_Atom type, + const void *data, + int len) +{ + XEvent xev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xev.xclient.window = win; + xev.xclient.type = ClientMessage; + xev.xclient.message_type = type; + xev.xclient.format = 8; + if (len > 20) + len = 20; + + memcpy(xev.xclient.data.b, data, len); + memset(xev.xclient.data.b + len, 0, 20 - len); + + return XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_client_message8_send */ + +EAPI Eina_Bool +ecore_x_mouse_move_send(Ecore_X_Window win, + int x, + int y) +{ + XEvent xev; + XWindowAttributes att; + Window tw; + int rx, ry; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XGetWindowAttributes(_ecore_x_disp, win, &att); + XTranslateCoordinates(_ecore_x_disp, win, att.root, x, y, &rx, &ry, &tw); + xev.xmotion.type = MotionNotify; + xev.xmotion.window = win; + xev.xmotion.root = att.root; + xev.xmotion.subwindow = win; + xev.xmotion.time = _ecore_x_event_last_time; + xev.xmotion.x = x; + xev.xmotion.y = y; + xev.xmotion.x_root = rx; + xev.xmotion.y_root = ry; + xev.xmotion.state = 0; + xev.xmotion.is_hint = 0; + xev.xmotion.same_screen = 1; + return XSendEvent(_ecore_x_disp, win, True, PointerMotionMask, &xev) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_mouse_move_send */ + +EAPI Eina_Bool +ecore_x_mouse_down_send(Ecore_X_Window win, + int x, + int y, + int b) +{ + XEvent xev; + XWindowAttributes att; + Window tw; + int rx, ry; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XGetWindowAttributes(_ecore_x_disp, win, &att); + XTranslateCoordinates(_ecore_x_disp, win, att.root, x, y, &rx, &ry, &tw); + xev.xbutton.type = ButtonPress; + xev.xbutton.window = win; + xev.xbutton.root = att.root; + xev.xbutton.subwindow = win; + xev.xbutton.time = _ecore_x_event_last_time; + xev.xbutton.x = x; + xev.xbutton.y = y; + xev.xbutton.x_root = rx; + xev.xbutton.y_root = ry; + xev.xbutton.state = 1 << b; + xev.xbutton.button = b; + xev.xbutton.same_screen = 1; + return XSendEvent(_ecore_x_disp, win, True, ButtonPressMask, &xev) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_mouse_down_send */ + +EAPI Eina_Bool +ecore_x_mouse_up_send(Ecore_X_Window win, + int x, + int y, + int b) +{ + XEvent xev; + XWindowAttributes att; + Window tw; + int rx, ry; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XGetWindowAttributes(_ecore_x_disp, win, &att); + XTranslateCoordinates(_ecore_x_disp, win, att.root, x, y, &rx, &ry, &tw); + xev.xbutton.type = ButtonRelease; + xev.xbutton.window = win; + xev.xbutton.root = att.root; + xev.xbutton.subwindow = win; + xev.xbutton.time = _ecore_x_event_last_time; + xev.xbutton.x = x; + xev.xbutton.y = y; + xev.xbutton.x_root = rx; + xev.xbutton.y_root = ry; + xev.xbutton.state = 0; + xev.xbutton.button = b; + xev.xbutton.same_screen = 1; + return XSendEvent(_ecore_x_disp, win, True, ButtonReleaseMask, &xev) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_mouse_up_send */ + +EAPI void +ecore_x_focus_reset(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSetInputFocus(_ecore_x_disp, PointerRoot, RevertToPointerRoot, CurrentTime); +} /* ecore_x_focus_reset */ + +EAPI void +ecore_x_events_allow_all(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XAllowEvents(_ecore_x_disp, AsyncBoth, CurrentTime); +} /* ecore_x_events_allow_all */ + +EAPI void +ecore_x_pointer_last_xy_get(int *x, + int *y) +{ + if (x) + *x = _ecore_x_event_last_root_x; + + if (y) + *y = _ecore_x_event_last_root_y; +} /* ecore_x_pointer_last_xy_get */ + +EAPI void +ecore_x_pointer_xy_get(Ecore_X_Window win, + int *x, + int *y) +{ + Window rwin, cwin; + int rx, ry, wx, wy, ret; + unsigned int mask; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = XQueryPointer(_ecore_x_disp, win, &rwin, &cwin, + &rx, &ry, &wx, &wy, &mask); + if (!ret) + wx = wy = -1; + + if (x) *x = wx; + if (y) *y = wy; +} /* ecore_x_pointer_xy_get */ + +/** + * Retrieve the Visual ID from a given Visual. + * + * @param visual The Visual to get the ID for. + * + * @return The visual id. + * @since 1.1.0 + */ +EAPI unsigned int +ecore_x_visual_id_get(Ecore_X_Visual visual) +{ + return XVisualIDFromVisual(visual); +} + +/** + * Retrieve the default Visual. + * + * @param disp The Display to get the Default Visual from + * @param screen The Screen. + * + * @return The default visual. + * @since 1.1.0 + */ +EAPI Ecore_X_Visual +ecore_x_default_visual_get(Ecore_X_Display *disp, + Ecore_X_Screen *screen) +{ + return DefaultVisual(disp, ecore_x_screen_index_get(screen)); +} + +/** + * Retrieve the default Colormap. + * + * @param disp The Display to get the Default Colormap from + * @param screen The Screen. + * + * @return The default colormap. + * @since 1.1.0 + */ +EAPI Ecore_X_Colormap +ecore_x_default_colormap_get(Ecore_X_Display *disp, + Ecore_X_Screen *screen) +{ + return DefaultColormap(disp, ecore_x_screen_index_get(screen)); +} + +/** + * Retrieve the default depth. + * + * @param disp The Display to get the Default Depth from + * @param screen The Screen. + * + * @return The default depth. + * @since 1.1.0 + */ +EAPI int +ecore_x_default_depth_get(Ecore_X_Display *disp, + Ecore_X_Screen *screen) +{ + return DefaultDepth(disp, ecore_x_screen_index_get(screen)); +} + +/*****************************************************************************/ +/*****************************************************************************/ +/*****************************************************************************/ + +static int +_ecore_x_event_modifier(unsigned int state) +{ + int xmodifiers = 0; + + if (state & ECORE_EVENT_MODIFIER_SHIFT) + xmodifiers |= ECORE_X_MODIFIER_SHIFT; + + if (state & ECORE_EVENT_MODIFIER_CTRL) + xmodifiers |= ECORE_X_MODIFIER_CTRL; + + if (state & ECORE_EVENT_MODIFIER_ALT) + xmodifiers |= ECORE_X_MODIFIER_ALT; + + if (state & ECORE_EVENT_MODIFIER_WIN) + xmodifiers |= ECORE_X_MODIFIER_WIN; + + if (state & ECORE_EVENT_LOCK_SCROLL) + xmodifiers |= ECORE_X_LOCK_SCROLL; + + if (state & ECORE_EVENT_LOCK_NUM) + xmodifiers |= ECORE_X_LOCK_NUM; + + if (state & ECORE_EVENT_LOCK_CAPS) + xmodifiers |= ECORE_X_LOCK_CAPS; + + if (state & ECORE_EVENT_LOCK_SHIFT) + xmodifiers |= ECORE_X_LOCK_SHIFT; + + return xmodifiers; +} /* _ecore_x_event_modifier */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c new file mode 100644 index 0000000..fd96d5c --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_atoms.c @@ -0,0 +1,352 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#ifdef HAVE_ALLOCA_H +# include +#elif defined __GNUC__ +# define alloca __builtin_alloca +#elif defined _AIX +# define alloca __alloca +#elif defined _MSC_VER +# include +# define alloca _alloca +#else /* ifdef HAVE_ALLOCA_H */ +# include +# ifdef __cplusplus +extern "C" +# endif /* ifdef __cplusplus */ +void *alloca(size_t); +#endif /* ifdef HAVE_ALLOCA_H */ + +#include + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include "Ecore_X_Atoms.h" + +#include "ecore_x_atoms_decl.h" + +typedef struct +{ + const char *name; + Ecore_X_Atom *atom; +} Atom_Item; + +void +_ecore_x_atoms_init(void) +{ + const Atom_Item items[] = + { + { "ATOM", &ECORE_X_ATOM_ATOM }, + { "CARDINAL", &ECORE_X_ATOM_CARDINAL }, + { "COMPOUND_TEXT", &ECORE_X_ATOM_COMPOUND_TEXT }, + { "FILE_NAME", &ECORE_X_ATOM_FILE_NAME }, + { "STRING", &ECORE_X_ATOM_STRING }, + { "TEXT", &ECORE_X_ATOM_TEXT }, + { "UTF8_STRING", &ECORE_X_ATOM_UTF8_STRING }, + { "WINDOW", &ECORE_X_ATOM_WINDOW }, + { "PIXMAP", &ECORE_X_ATOM_PIXMAP }, + + { "JXSelectionWindowProperty", &ECORE_X_ATOM_SELECTION_PROP_XDND }, + { "XdndSelection", &ECORE_X_ATOM_SELECTION_XDND }, + { "XdndAware", &ECORE_X_ATOM_XDND_AWARE }, + { "XdndEnter", &ECORE_X_ATOM_XDND_ENTER }, + { "XdndTypeList", &ECORE_X_ATOM_XDND_TYPE_LIST }, + { "XdndPosition", &ECORE_X_ATOM_XDND_POSITION }, + { "XdndActionCopy", &ECORE_X_ATOM_XDND_ACTION_COPY }, + { "XdndActionMove", &ECORE_X_ATOM_XDND_ACTION_MOVE }, + { "XdndActionPrivate", &ECORE_X_ATOM_XDND_ACTION_PRIVATE }, + { "XdndActionAsk", &ECORE_X_ATOM_XDND_ACTION_ASK }, + { "XdndActionList", &ECORE_X_ATOM_XDND_ACTION_LIST }, + { "XdndActionLink", &ECORE_X_ATOM_XDND_ACTION_LINK }, + { "XdndActionDescription", &ECORE_X_ATOM_XDND_ACTION_DESCRIPTION }, + { "XdndProxy", &ECORE_X_ATOM_XDND_PROXY }, + { "XdndStatus", &ECORE_X_ATOM_XDND_STATUS }, + { "XdndLeave", &ECORE_X_ATOM_XDND_LEAVE }, + { "XdndDrop", &ECORE_X_ATOM_XDND_DROP }, + { "XdndFinished", &ECORE_X_ATOM_XDND_FINISHED }, + + { "XdndActionCopy", &ECORE_X_DND_ACTION_COPY }, + { "XdndActionMove", &ECORE_X_DND_ACTION_MOVE }, + { "XdndActionLink", &ECORE_X_DND_ACTION_LINK }, + { "XdndActionAsk", &ECORE_X_DND_ACTION_ASK }, + { "XdndActionPrivate", &ECORE_X_DND_ACTION_PRIVATE }, + + { "_E_FRAME_SIZE", &ECORE_X_ATOM_E_FRAME_SIZE }, + + { "_WIN_LAYER", &ECORE_X_ATOM_WIN_LAYER }, + + { "WM_NAME", &ECORE_X_ATOM_WM_NAME }, + { "WM_ICON_NAME", &ECORE_X_ATOM_WM_ICON_NAME }, + { "WM_NORMAL_HINTS", &ECORE_X_ATOM_WM_NORMAL_HINTS }, + { "WM_SIZE_HINTS", &ECORE_X_ATOM_WM_SIZE_HINTS }, + { "WM_HINTS", &ECORE_X_ATOM_WM_HINTS }, + { "WM_CLASS", &ECORE_X_ATOM_WM_CLASS }, + { "WM_TRANSIENT_FOR", &ECORE_X_ATOM_WM_TRANSIENT_FOR }, + { "WM_PROTOCOLS", &ECORE_X_ATOM_WM_PROTOCOLS }, + { "WM_COLORMAP_WINDOWS", &ECORE_X_ATOM_WM_COLORMAP_WINDOWS }, + { "WM_COMMAND", &ECORE_X_ATOM_WM_COMMAND }, + { "WM_CLIENT_MACHINE", &ECORE_X_ATOM_WM_CLIENT_MACHINE }, + + { "WM_STATE", &ECORE_X_ATOM_WM_STATE }, + { "WM_ICON_SIZE", &ECORE_X_ATOM_WM_ICON_SIZE }, + + { "WM_CHANGE_STATE", &ECORE_X_ATOM_WM_CHANGE_STATE }, + + { "WM_TAKE_FOCUS", &ECORE_X_ATOM_WM_TAKE_FOCUS }, + { "WM_SAVE_YOURSELF", &ECORE_X_ATOM_WM_SAVE_YOURSELF }, + { "WM_DELETE_WINDOW", &ECORE_X_ATOM_WM_DELETE_WINDOW }, + + { "WM_COLORMAP_NOTIFY", &ECORE_X_ATOM_WM_COLORMAP_NOTIFY }, + + { "SM_CLIENT_ID", &ECORE_X_ATOM_SM_CLIENT_ID }, + { "WM_CLIENT_LEADER", &ECORE_X_ATOM_WM_CLIENT_LEADER }, + { "WM_WINDOW_ROLE", &ECORE_X_ATOM_WM_WINDOW_ROLE }, + + { "_MOTIF_WM_HINTS", &ECORE_X_ATOM_MOTIF_WM_HINTS }, + + { "_NET_SUPPORTED", &ECORE_X_ATOM_NET_SUPPORTED }, + { "_NET_CLIENT_LIST", &ECORE_X_ATOM_NET_CLIENT_LIST }, + { "_NET_CLIENT_LIST_STACKING", &ECORE_X_ATOM_NET_CLIENT_LIST_STACKING }, + { "_NET_NUMBER_OF_DESKTOPS", &ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS }, + { "_NET_DESKTOP_GEOMETRY", &ECORE_X_ATOM_NET_DESKTOP_GEOMETRY }, + { "_NET_DESKTOP_VIEWPORT", &ECORE_X_ATOM_NET_DESKTOP_VIEWPORT }, + { "_NET_CURRENT_DESKTOP", &ECORE_X_ATOM_NET_CURRENT_DESKTOP }, + { "_NET_DESKTOP_NAMES", &ECORE_X_ATOM_NET_DESKTOP_NAMES }, + { "_NET_ACTIVE_WINDOW", &ECORE_X_ATOM_NET_ACTIVE_WINDOW }, + { "_NET_WORKAREA", &ECORE_X_ATOM_NET_WORKAREA }, + { "_NET_SUPPORTING_WM_CHECK", &ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK }, + { "_NET_VIRTUAL_ROOTS", &ECORE_X_ATOM_NET_VIRTUAL_ROOTS }, + { "_NET_DESKTOP_LAYOUT", &ECORE_X_ATOM_NET_DESKTOP_LAYOUT }, + { "_NET_SHOWING_DESKTOP", &ECORE_X_ATOM_NET_SHOWING_DESKTOP }, + + { "_NET_CLOSE_WINDOW", &ECORE_X_ATOM_NET_CLOSE_WINDOW }, + { "_NET_MOVERESIZE_WINDOW", &ECORE_X_ATOM_NET_MOVERESIZE_WINDOW }, + { "_NET_WM_MOVERESIZE", &ECORE_X_ATOM_NET_WM_MOVERESIZE }, + { "_NET_RESTACK_WINDOW", &ECORE_X_ATOM_NET_RESTACK_WINDOW }, + + { "_NET_REQUEST_FRAME_EXTENTS", &ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS }, + + { "_NET_WM_NAME", &ECORE_X_ATOM_NET_WM_NAME }, + { "_NET_WM_VISIBLE_NAME", &ECORE_X_ATOM_NET_WM_VISIBLE_NAME }, + { "_NET_WM_ICON_NAME", &ECORE_X_ATOM_NET_WM_ICON_NAME }, + { "_NET_WM_VISIBLE_ICON_NAME", &ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME }, + { "_NET_WM_DESKTOP", &ECORE_X_ATOM_NET_WM_DESKTOP }, + + { "_NET_WM_WINDOW_TYPE", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE }, + { "_NET_WM_WINDOW_TYPE_DESKTOP", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP }, + { "_NET_WM_WINDOW_TYPE_DOCK", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK }, + { "_NET_WM_WINDOW_TYPE_TOOLBAR", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR }, + { "_NET_WM_WINDOW_TYPE_MENU", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU }, + { "_NET_WM_WINDOW_TYPE_UTILITY", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY }, + { "_NET_WM_WINDOW_TYPE_SPLASH", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH }, + { "_NET_WM_WINDOW_TYPE_DIALOG", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG }, + { "_NET_WM_WINDOW_TYPE_NORMAL", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL }, + { "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU", + &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU }, + { "_NET_WM_WINDOW_TYPE_POPUP_MENU", + &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU }, + { "_NET_WM_WINDOW_TYPE_TOOLTIP", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP }, + { "_NET_WM_WINDOW_TYPE_NOTIFICATION", + &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION }, + { "_NET_WM_WINDOW_TYPE_COMBO", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO }, + { "_NET_WM_WINDOW_TYPE_DND", &ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND }, + + { "_NET_WM_STATE", &ECORE_X_ATOM_NET_WM_STATE }, + { "_NET_WM_STATE_MODAL", &ECORE_X_ATOM_NET_WM_STATE_MODAL }, + { "_NET_WM_STATE_STICKY", &ECORE_X_ATOM_NET_WM_STATE_STICKY }, + { "_NET_WM_STATE_MAXIMIZED_VERT", + &ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT }, + { "_NET_WM_STATE_MAXIMIZED_HORZ", + &ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ }, + { "_NET_WM_STATE_SHADED", &ECORE_X_ATOM_NET_WM_STATE_SHADED }, + { "_NET_WM_STATE_SKIP_TASKBAR", &ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR }, + { "_NET_WM_STATE_SKIP_PAGER", &ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER }, + { "_NET_WM_STATE_HIDDEN", &ECORE_X_ATOM_NET_WM_STATE_HIDDEN }, + { "_NET_WM_STATE_FULLSCREEN", &ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN }, + { "_NET_WM_STATE_ABOVE", &ECORE_X_ATOM_NET_WM_STATE_ABOVE }, + { "_NET_WM_STATE_BELOW", &ECORE_X_ATOM_NET_WM_STATE_BELOW }, + { "_NET_WM_STATE_DEMANDS_ATTENTION", + &ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION }, + + { "_NET_WM_ALLOWED_ACTIONS", &ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS }, + { "_NET_WM_ACTION_MOVE", &ECORE_X_ATOM_NET_WM_ACTION_MOVE }, + { "_NET_WM_ACTION_RESIZE", &ECORE_X_ATOM_NET_WM_ACTION_RESIZE }, + { "_NET_WM_ACTION_MINIMIZE", &ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE }, + { "_NET_WM_ACTION_SHADE", &ECORE_X_ATOM_NET_WM_ACTION_SHADE }, + { "_NET_WM_ACTION_STICK", &ECORE_X_ATOM_NET_WM_ACTION_STICK }, + { "_NET_WM_ACTION_MAXIMIZE_HORZ", + &ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ }, + { "_NET_WM_ACTION_MAXIMIZE_VERT", + &ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT }, + { "_NET_WM_ACTION_FULLSCREEN", &ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN }, + { "_NET_WM_ACTION_CHANGE_DESKTOP", + &ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP }, + { "_NET_WM_ACTION_CLOSE", &ECORE_X_ATOM_NET_WM_ACTION_CLOSE }, + { "_NET_WM_ACTION_ABOVE", &ECORE_X_ATOM_NET_WM_ACTION_ABOVE }, + { "_NET_WM_ACTION_BELOW", &ECORE_X_ATOM_NET_WM_ACTION_BELOW }, + + { "_NET_WM_STRUT", &ECORE_X_ATOM_NET_WM_STRUT }, + { "_NET_WM_STRUT_PARTIAL", &ECORE_X_ATOM_NET_WM_STRUT_PARTIAL }, + { "_NET_WM_ICON_GEOMETRY", &ECORE_X_ATOM_NET_WM_ICON_GEOMETRY }, + { "_NET_WM_ICON", &ECORE_X_ATOM_NET_WM_ICON }, + { "_NET_WM_PID", &ECORE_X_ATOM_NET_WM_PID }, + { "_NET_WM_HANDLED_ICONS", &ECORE_X_ATOM_NET_WM_HANDLED_ICONS }, + { "_NET_WM_USER_TIME", &ECORE_X_ATOM_NET_WM_USER_TIME }, + { "_NET_STARTUP_ID", &ECORE_X_ATOM_NET_STARTUP_ID }, + { "_NET_FRAME_EXTENTS", &ECORE_X_ATOM_NET_FRAME_EXTENTS }, + + { "_NET_WM_PING", &ECORE_X_ATOM_NET_WM_PING }, + { "_NET_WM_SYNC_REQUEST", &ECORE_X_ATOM_NET_WM_SYNC_REQUEST }, + { "_NET_WM_SYNC_REQUEST_COUNTER", + &ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER }, + + { "_NET_WM_WINDOW_OPACITY", &ECORE_X_ATOM_NET_WM_WINDOW_OPACITY }, + { "_NET_WM_WINDOW_SHADOW", &ECORE_X_ATOM_NET_WM_WINDOW_SHADOW }, + { "_NET_WM_WINDOW_SHADE", &ECORE_X_ATOM_NET_WM_WINDOW_SHADE }, + + { "TARGETS", &ECORE_X_ATOM_SELECTION_TARGETS }, + { "CLIPBOARD", &ECORE_X_ATOM_SELECTION_CLIPBOARD }, + { "PRIMARY", &ECORE_X_ATOM_SELECTION_PRIMARY }, + { "SECONDARY", &ECORE_X_ATOM_SELECTION_SECONDARY }, + { "_ECORE_SELECTION_PRIMARY", &ECORE_X_ATOM_SELECTION_PROP_PRIMARY }, + { "_ECORE_SELECTION_SECONDARY", &ECORE_X_ATOM_SELECTION_PROP_SECONDARY }, + { "_ECORE_SELECTION_CLIPBOARD", &ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD }, + + { "_E_VIRTUAL_KEYBOARD", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD }, + { "_E_VIRTUAL_KEYBOARD_STATE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE }, + { "_E_VIRTUAL_KEYBOARD_ON", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON }, + { "_E_VIRTUAL_KEYBOARD_OFF", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF }, + { "_E_VIRTUAL_KEYBOARD_ALPHA", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA }, + { "_E_VIRTUAL_KEYBOARD_NUMERIC", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC }, + { "_E_VIRTUAL_KEYBOARD_PIN", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN }, + { "_E_VIRTUAL_KEYBOARD_PHONE_NUMBER", + &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER }, + { "_E_VIRTUAL_KEYBOARD_HEX", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX }, + { "_E_VIRTUAL_KEYBOARD_TERMINAL", + &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL }, + { "_E_VIRTUAL_KEYBOARD_PASSWORD", + &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD }, + { "_E_VIRTUAL_KEYBOARD_IP", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP }, + { "_E_VIRTUAL_KEYBOARD_HOST", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST }, + { "_E_VIRTUAL_KEYBOARD_FILE", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE }, + { "_E_VIRTUAL_KEYBOARD_URL", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL }, + { "_E_VIRTUAL_KEYBOARD_KEYPAD", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD }, + { "_E_VIRTUAL_KEYBOARD_J2ME", &ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME }, + + { "_E_ILLUME_ZONE", &ECORE_X_ATOM_E_ILLUME_ZONE }, + { "_E_ILLUME_ZONE_LIST", &ECORE_X_ATOM_E_ILLUME_ZONE_LIST }, + { "_E_ILLUME_CONFORMANT", &ECORE_X_ATOM_E_ILLUME_CONFORMANT }, + { "_E_ILLUME_MODE", &ECORE_X_ATOM_E_ILLUME_MODE }, + { "_E_ILLUME_MODE_SINGLE", &ECORE_X_ATOM_E_ILLUME_MODE_SINGLE }, + { "_E_ILLUME_MODE_DUAL_TOP", &ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP }, + { "_E_ILLUME_MODE_DUAL_LEFT", &ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT }, + { "_E_ILLUME_FOCUS_BACK", &ECORE_X_ATOM_E_ILLUME_FOCUS_BACK }, + { "_E_ILLUME_FOCUS_FORWARD", &ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD }, + { "_E_ILLUME_FOCUS_HOME", &ECORE_X_ATOM_E_ILLUME_FOCUS_HOME }, + { "_E_ILLUME_CLOSE", &ECORE_X_ATOM_E_ILLUME_CLOSE }, + { "_E_ILLUME_HOME_NEW", &ECORE_X_ATOM_E_ILLUME_HOME_NEW }, + { "_E_ILLUME_HOME_DEL", &ECORE_X_ATOM_E_ILLUME_HOME_DEL }, + { "_E_ILLUME_DRAG", &ECORE_X_ATOM_E_ILLUME_DRAG }, + { "_E_ILLUME_DRAG_LOCKED", &ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED }, + { "_E_ILLUME_DRAG_START", &ECORE_X_ATOM_E_ILLUME_DRAG_START }, + { "_E_ILLUME_DRAG_END", &ECORE_X_ATOM_E_ILLUME_DRAG_END }, + { "_E_ILLUME_INDICATOR_GEOMETRY", + &ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY }, + { "_E_ILLUME_SOFTKEY_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY }, + { "_E_ILLUME_KEYBOARD_GEOMETRY", &ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY }, + { "_E_ILLUME_QUICKPANEL", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL }, + { "_E_ILLUME_QUICKPANEL_STATE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE }, + { "_E_ILLUME_QUICKPANEL_STATE_TOGGLE", + &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE }, + { "_E_ILLUME_QUICKPANEL_ON", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON }, + { "_E_ILLUME_QUICKPANEL_OFF", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF }, + { "_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR", + &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR }, + { "_E_ILLUME_QUICKPANEL_PRIORITY_MINOR", + &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR }, + { "_E_ILLUME_QUICKPANEL_ZONE", &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE }, + { "_E_ILLUME_QUICKPANEL_POSITION_UPDATE", + &ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE }, + + { "_E_COMP_SYNC_COUNTER", &ECORE_X_ATOM_E_COMP_SYNC_COUNTER }, + { "_E_COMP_SYNC_DRAW_DONE", &ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE }, + { "_E_COMP_SYNC_SUPPORTED", &ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED }, + { "_E_COMP_SYNC_BEGIN", &ECORE_X_ATOM_E_COMP_SYNC_BEGIN }, + { "_E_COMP_SYNC_END", &ECORE_X_ATOM_E_COMP_SYNC_END }, + { "_E_COMP_SYNC_CANCEL", &ECORE_X_ATOM_E_COMP_SYNC_CANCEL }, + + { "_E_COMP_FLUSH", &ECORE_X_ATOM_E_COMP_FLUSH }, + { "_E_COMP_DUMP", &ECORE_X_ATOM_E_COMP_DUMP }, + { "_E_COMP_PIXMAP", &ECORE_X_ATOM_E_COMP_PIXMAP }, + { "_E_VIDEO_PARENT", &ECORE_X_ATOM_E_VIDEO_PARENT }, + { "_E_VIDEO_POSITION", &ECORE_X_ATOM_E_VIDEO_POSITION } + }; + Atom *atoms; + char **names; + int i, num; + + num = sizeof(items) / sizeof(Atom_Item); + atoms = alloca(num * sizeof(Atom)); + names = alloca(num * sizeof(char *)); + for (i = 0; i < num; i++) names[i] = (char *)items[i].name; + XInternAtoms(_ecore_x_disp, names, num, False, atoms); + for (i = 0; i < num; i++) *(items[i].atom) = atoms[i]; +} /* _ecore_x_atoms_init */ + +/** + * Retrieves the atom value associated with the given name. + * @param name The given name. + * @return Associated atom value. + */ +EAPI Ecore_X_Atom +ecore_x_atom_get(const char *name) +{ + if (!_ecore_x_disp) + return 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XInternAtom(_ecore_x_disp, name, False); +} /* ecore_x_atom_get */ + +EAPI void +ecore_x_atoms_get(const char **names, + int num, + Ecore_X_Atom *atoms) +{ + Atom *atoms_int; + int i; + + if (!_ecore_x_disp) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + atoms_int = alloca(num * sizeof(Atom)); + XInternAtoms(_ecore_x_disp, (char **)names, num, False, atoms_int); + for (i = 0; i < num; i++) + atoms[i] = atoms_int[i]; +} /* ecore_x_atoms_get */ + +EAPI char * +ecore_x_atom_name_get(Ecore_X_Atom atom) +{ + char *name; + char *xname; + + if (!_ecore_x_disp) + return NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + xname = XGetAtomName(_ecore_x_disp, atom); + if (!xname) + return NULL; + + name = strdup(xname); + XFree(xname); + + return name; +} /* ecore_x_atom_name_get */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c new file mode 100644 index 0000000..43153ff --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_composite.c @@ -0,0 +1,176 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "ecore_x_private.h" +#include "Ecore_X.h" + +static Eina_Bool _composite_available = EINA_FALSE; + +void +_ecore_x_composite_init(void) +{ + _composite_available = EINA_FALSE; + +#ifdef ECORE_XCOMPOSITE + int major, minor; + + if (XCompositeQueryVersion(_ecore_x_disp, &major, &minor)) + { +# ifdef ECORE_XRENDER + if (XRenderQueryExtension(_ecore_x_disp, &major, &minor)) + { +# ifdef ECORE_XFIXES + if (XFixesQueryVersion(_ecore_x_disp, &major, &minor)) + { + _composite_available = EINA_TRUE; + } +# endif + } +# endif + } +#endif +} /* _ecore_x_composite_init */ + +EAPI Eina_Bool +ecore_x_composite_query(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return _composite_available; +} /* ecore_x_composite_query */ + +EAPI void +ecore_x_composite_redirect_window(Ecore_X_Window win, + Ecore_X_Composite_Update_Type type) +{ +#ifdef ECORE_XCOMPOSITE + int update = CompositeRedirectAutomatic; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + switch(type) + { + case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: + update = CompositeRedirectAutomatic; + break; + + case ECORE_X_COMPOSITE_UPDATE_MANUAL: + update = CompositeRedirectManual; + break; + } /* switch */ + XCompositeRedirectWindow(_ecore_x_disp, win, update); +#endif /* ifdef ECORE_XCOMPOSITE */ +} /* ecore_x_composite_redirect_window */ + +EAPI void +ecore_x_composite_redirect_subwindows(Ecore_X_Window win, + Ecore_X_Composite_Update_Type type) +{ +#ifdef ECORE_XCOMPOSITE + int update = CompositeRedirectAutomatic; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + switch(type) + { + case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: + update = CompositeRedirectAutomatic; + break; + + case ECORE_X_COMPOSITE_UPDATE_MANUAL: + update = CompositeRedirectManual; + break; + } /* switch */ + XCompositeRedirectSubwindows(_ecore_x_disp, win, update); +#endif /* ifdef ECORE_XCOMPOSITE */ +} /* ecore_x_composite_redirect_subwindows */ + +EAPI void +ecore_x_composite_unredirect_window(Ecore_X_Window win, + Ecore_X_Composite_Update_Type type) +{ +#ifdef ECORE_XCOMPOSITE + int update = CompositeRedirectAutomatic; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + switch(type) + { + case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: + update = CompositeRedirectAutomatic; + break; + + case ECORE_X_COMPOSITE_UPDATE_MANUAL: + update = CompositeRedirectManual; + break; + } /* switch */ + XCompositeUnredirectWindow(_ecore_x_disp, win, update); +#endif /* ifdef ECORE_XCOMPOSITE */ +} /* ecore_x_composite_unredirect_window */ + +EAPI void +ecore_x_composite_unredirect_subwindows(Ecore_X_Window win, + Ecore_X_Composite_Update_Type type) +{ +#ifdef ECORE_XCOMPOSITE + int update = CompositeRedirectAutomatic; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + switch(type) + { + case ECORE_X_COMPOSITE_UPDATE_AUTOMATIC: + update = CompositeRedirectAutomatic; + break; + + case ECORE_X_COMPOSITE_UPDATE_MANUAL: + update = CompositeRedirectManual; + break; + } /* switch */ + XCompositeUnredirectSubwindows(_ecore_x_disp, win, update); +#endif /* ifdef ECORE_XCOMPOSITE */ +} /* ecore_x_composite_unredirect_subwindows */ + +EAPI Ecore_X_Pixmap +ecore_x_composite_name_window_pixmap_get(Ecore_X_Window win) +{ + Ecore_X_Pixmap pixmap = None; +#ifdef ECORE_XCOMPOSITE + LOGFN(__FILE__, __LINE__, __FUNCTION__); + pixmap = XCompositeNameWindowPixmap(_ecore_x_disp, win); +#endif /* ifdef ECORE_XCOMPOSITE */ + return pixmap; +} /* ecore_x_composite_name_window_pixmap_get */ + +EAPI void +ecore_x_composite_window_events_disable(Ecore_X_Window win) +{ +#ifdef ECORE_XCOMPOSITE + ecore_x_window_shape_input_rectangle_set(win, -1, -1, 1, 1); +#endif /* ifdef ECORE_XCOMPOSITE */ +} + +EAPI void +ecore_x_composite_window_events_enable(Ecore_X_Window win) +{ +#ifdef ECORE_XCOMPOSITE + ecore_x_window_shape_input_rectangle_set(win, 0, 0, 65535, 65535); +#endif /* ifdef ECORE_XCOMPOSITE */ +} + +EAPI Ecore_X_Window +ecore_x_composite_render_window_enable(Ecore_X_Window root) +{ + Ecore_X_Window win = 0; +#ifdef ECORE_XCOMPOSITE + win = XCompositeGetOverlayWindow(_ecore_x_disp, root); + ecore_x_composite_window_events_disable(win); +#endif /* ifdef ECORE_XCOMPOSITE */ + return win; +} /* ecore_x_composite_render_window_enable */ + +EAPI void +ecore_x_composite_render_window_disable(Ecore_X_Window root) +{ +#ifdef ECORE_XCOMPOSITE + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XCompositeReleaseOverlayWindow(_ecore_x_disp, root); +#endif /* ifdef ECORE_XCOMPOSITE */ +} /* ecore_x_composite_render_window_disable */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c new file mode 100644 index 0000000..434505c --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_cursor.c @@ -0,0 +1,246 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include + +#include "ecore_x_private.h" + +EAPI Eina_Bool +ecore_x_cursor_color_supported_get(void) +{ + return _ecore_x_xcursor; +} /* ecore_x_cursor_color_supported_get */ + +EAPI Ecore_X_Cursor +ecore_x_cursor_new(Ecore_X_Window win, + int *pixels, + int w, + int h, + int hot_x, + int hot_y) +{ +#ifdef ECORE_XCURSOR + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (_ecore_x_xcursor) + { + Cursor c; + XcursorImage *xci; + + xci = XcursorImageCreate(w, h); + if (xci) + { + int i; + + xci->xhot = hot_x; + xci->yhot = hot_y; + xci->delay = 0; + for (i = 0; i < (w * h); i++) + { +// int r, g, b, a; +// +// a = (pixels[i] >> 24) & 0xff; +// r = (((pixels[i] >> 16) & 0xff) * a) / 0xff; +// g = (((pixels[i] >> 8 ) & 0xff) * a) / 0xff; +// b = (((pixels[i] ) & 0xff) * a) / 0xff; + xci->pixels[i] = pixels[i]; +// (a << 24) | (r << 16) | (g << 8) | (b); + } + c = XcursorImageLoadCursor(_ecore_x_disp, xci); + XcursorImageDestroy(xci); + return c; + } + } + else +#endif /* ifdef ECORE_XCURSOR */ + { + XColor c1, c2; + Cursor c; + Pixmap pmap, mask; + GC gc; + XGCValues gcv; + XImage *xim; + unsigned int *pix; + int fr, fg, fb, br, bg, bb; + int brightest = 0; + int darkest = 255 * 3; + int x, y; + const int dither[2][2] = + { + {0, 2}, + {3, 1} + }; + + pmap = XCreatePixmap(_ecore_x_disp, win, w, h, 1); + mask = XCreatePixmap(_ecore_x_disp, win, w, h, 1); + xim = XCreateImage(_ecore_x_disp, + DefaultVisual(_ecore_x_disp, 0), + 1, ZPixmap, 0, NULL, w, h, 32, 0); + xim->data = malloc(xim->bytes_per_line * xim->height); + + fr = 0x00; fg = 0x00; fb = 0x00; + br = 0xff; bg = 0xff; bb = 0xff; + pix = (unsigned int *)pixels; + for (y = 0; y < h; y++) + { + for (x = 0; x < w; x++) + { + int r, g, b, a; + + a = (pix[0] >> 24) & 0xff; + r = (pix[0] >> 16) & 0xff; + g = (pix[0] >> 8) & 0xff; + b = (pix[0]) & 0xff; + if (a > 0) + { + if ((r + g + b) > brightest) + { + brightest = r + g + b; + br = r; + bg = g; + bb = b; + } + + if ((r + g + b) < darkest) + { + darkest = r + g + b; + fr = r; + fg = g; + fb = b; + } + } + + pix++; + } + } + + pix = (unsigned int *)pixels; + for (y = 0; y < h; y++) + { + for (x = 0; x < w; x++) + { + int v; + int r, g, b; + int d1, d2; + + r = (pix[0] >> 16) & 0xff; + g = (pix[0] >> 8) & 0xff; + b = (pix[0]) & 0xff; + d1 = + ((r - fr) * (r - fr)) + + ((g - fg) * (g - fg)) + + ((b - fb) * (b - fb)); + d2 = + ((r - br) * (r - br)) + + ((g - bg) * (g - bg)) + + ((b - bb) * (b - bb)); + if (d1 + d2) + { + v = (((d2 * 255) / (d1 + d2)) * 5) / 256; + if (v > dither[x & 0x1][y & 0x1]) + v = 1; + else + v = 0; + } + else + v = 0; + + XPutPixel(xim, x, y, v); + pix++; + } + } + gc = XCreateGC(_ecore_x_disp, pmap, 0, &gcv); + XPutImage(_ecore_x_disp, pmap, gc, xim, 0, 0, 0, 0, w, h); + XFreeGC(_ecore_x_disp, gc); + + pix = (unsigned int *)pixels; + for (y = 0; y < h; y++) + { + for (x = 0; x < w; x++) + { + int v; + + v = (((pix[0] >> 24) & 0xff) * 5) / 256; + if (v > dither[x & 0x1][y & 0x1]) + v = 1; + else + v = 0; + + XPutPixel(xim, x, y, v); + pix++; + } + } + gc = XCreateGC(_ecore_x_disp, mask, 0, &gcv); + XPutImage(_ecore_x_disp, mask, gc, xim, 0, 0, 0, 0, w, h); + XFreeGC(_ecore_x_disp, gc); + + free(xim->data); + xim->data = NULL; + XDestroyImage(xim); + + c1.pixel = 0; + c1.red = fr << 8 | fr; + c1.green = fg << 8 | fg; + c1.blue = fb << 8 | fb; + c1.flags = DoRed | DoGreen | DoBlue; + + c2.pixel = 0; + c2.red = br << 8 | br; + c2.green = bg << 8 | bg; + c2.blue = bb << 8 | bb; + c2.flags = DoRed | DoGreen | DoBlue; + + c = XCreatePixmapCursor(_ecore_x_disp, + pmap, mask, + &c1, &c2, + hot_x, hot_y); + XFreePixmap(_ecore_x_disp, pmap); + XFreePixmap(_ecore_x_disp, mask); + return c; + } + + return 0; +} /* ecore_x_cursor_new */ + +EAPI void +ecore_x_cursor_free(Ecore_X_Cursor c) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFreeCursor(_ecore_x_disp, c); +} /* ecore_x_cursor_free */ + +/* + * Returns the cursor for the given shape. + * Note that the return value must not be freed with + * ecore_x_cursor_free()! + */ +EAPI Ecore_X_Cursor +ecore_x_cursor_shape_get(int shape) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* Shapes are defined in Ecore_X_Cursor.h */ + return XCreateFontCursor(_ecore_x_disp, shape); +} /* ecore_x_cursor_shape_get */ + +EAPI void +ecore_x_cursor_size_set(int size) +{ +#ifdef ECORE_XCURSOR + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XcursorSetDefaultSize(_ecore_x_disp, size); +#else /* ifdef ECORE_XCURSOR */ + size = 0; +#endif /* ifdef ECORE_XCURSOR */ +} /* ecore_x_cursor_size_set */ + +EAPI int +ecore_x_cursor_size_get(void) +{ +#ifdef ECORE_XCURSOR + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XcursorGetDefaultSize(_ecore_x_disp); +#else /* ifdef ECORE_XCURSOR */ + return 0; +#endif /* ifdef ECORE_XCURSOR */ +} /* ecore_x_cursor_size_get */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c new file mode 100644 index 0000000..5e44d07 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_damage.c @@ -0,0 +1,71 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "ecore_x_private.h" +#include "Ecore_X.h" + +static Eina_Bool _damage_available = EINA_FALSE; +#ifdef ECORE_XDAMAGE +static int _damage_major, _damage_minor; +#endif /* ifdef ECORE_XDAMAGE */ + +void +_ecore_x_damage_init(void) +{ +#ifdef ECORE_XDAMAGE + _damage_major = 1; + _damage_minor = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (XDamageQueryVersion(_ecore_x_disp, &_damage_major, &_damage_minor)) + _damage_available = EINA_TRUE; + else + _damage_available = EINA_FALSE; + +#else /* ifdef ECORE_XDAMAGE */ + _damage_available = EINA_FALSE; +#endif /* ifdef ECORE_XDAMAGE */ +} /* _ecore_x_damage_init */ + +EAPI Eina_Bool +ecore_x_damage_query(void) +{ + return _damage_available; +} /* ecore_x_damage_query */ + +EAPI Ecore_X_Damage +ecore_x_damage_new(Ecore_X_Drawable d, + Ecore_X_Damage_Report_Level level) +{ +#ifdef ECORE_XDAMAGE + Ecore_X_Damage damage; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + damage = XDamageCreate(_ecore_x_disp, d, level); + return damage; +#else /* ifdef ECORE_XDAMAGE */ + return 0; +#endif /* ifdef ECORE_XDAMAGE */ +} /* ecore_x_damage_new */ + +EAPI void +ecore_x_damage_free(Ecore_X_Damage damage) +{ +#ifdef ECORE_XDAMAGE + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XDamageDestroy(_ecore_x_disp, damage); +#endif /* ifdef ECORE_XDAMAGE */ +} /* ecore_x_damage_free */ + +EAPI void +ecore_x_damage_subtract(Ecore_X_Damage damage, + Ecore_X_Region repair, + Ecore_X_Region parts) +{ +#ifdef ECORE_XDAMAGE + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XDamageSubtract(_ecore_x_disp, damage, repair, parts); +#endif /* ifdef ECORE_XDAMAGE */ +} /* ecore_x_damage_subtract */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c new file mode 100644 index 0000000..7908584 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dnd.c @@ -0,0 +1,706 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include +#include + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include "Ecore_X_Atoms.h" + +EAPI int ECORE_X_EVENT_XDND_ENTER = 0; +EAPI int ECORE_X_EVENT_XDND_POSITION = 0; +EAPI int ECORE_X_EVENT_XDND_STATUS = 0; +EAPI int ECORE_X_EVENT_XDND_LEAVE = 0; +EAPI int ECORE_X_EVENT_XDND_DROP = 0; +EAPI int ECORE_X_EVENT_XDND_FINISHED = 0; + +static Ecore_X_DND_Source *_source = NULL; +static Ecore_X_DND_Target *_target = NULL; +static int _ecore_x_dnd_init_count = 0; + +typedef struct _Version_Cache_Item +{ + Ecore_X_Window win; + int ver; +} Version_Cache_Item; +static Version_Cache_Item *_version_cache = NULL; +static int _version_cache_num = 0, _version_cache_alloc = 0; +static void (*_posupdatecb)(void *, + Ecore_X_Xdnd_Position *); +static void *_posupdatedata; + +void +_ecore_x_dnd_init(void) +{ + if (!_ecore_x_dnd_init_count) + { + _source = calloc(1, sizeof(Ecore_X_DND_Source)); + if (!_source) return; + _source->version = ECORE_X_DND_VERSION; + _source->win = None; + _source->dest = None; + _source->state = ECORE_X_DND_SOURCE_IDLE; + _source->prev.window = 0; + + _target = calloc(1, sizeof(Ecore_X_DND_Target)); + if (!_target) + { + free(_source); + _source = NULL; + return; + } + _target->win = None; + _target->source = None; + _target->state = ECORE_X_DND_TARGET_IDLE; + + ECORE_X_EVENT_XDND_ENTER = ecore_event_type_new(); + ECORE_X_EVENT_XDND_POSITION = ecore_event_type_new(); + ECORE_X_EVENT_XDND_STATUS = ecore_event_type_new(); + ECORE_X_EVENT_XDND_LEAVE = ecore_event_type_new(); + ECORE_X_EVENT_XDND_DROP = ecore_event_type_new(); + ECORE_X_EVENT_XDND_FINISHED = ecore_event_type_new(); + } + + _ecore_x_dnd_init_count++; +} /* _ecore_x_dnd_init */ + +void +_ecore_x_dnd_shutdown(void) +{ + _ecore_x_dnd_init_count--; + if (_ecore_x_dnd_init_count > 0) + return; + + if (_source) + free(_source); + + _source = NULL; + + if (_target) + free(_target); + + _target = NULL; + + _ecore_x_dnd_init_count = 0; +} /* _ecore_x_dnd_shutdown */ + +static Eina_Bool +_ecore_x_dnd_converter_copy(char *target __UNUSED__, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *tprop __UNUSED__, + int *count __UNUSED__) +{ + XTextProperty text_prop; + char *mystr; + XICCEncodingStyle style = XTextStyle; + + if (!data || !size) + return EINA_FALSE; + + mystr = calloc(1, size + 1); + if (!mystr) + return EINA_FALSE; + + memcpy(mystr, data, size); + + if (XmbTextListToTextProperty(_ecore_x_disp, &mystr, 1, style, + &text_prop) == Success) + { + int bufsize = strlen((char *)text_prop.value) + 1; + *data_ret = malloc(bufsize); + if (!*data_ret) + { + free(mystr); + return EINA_FALSE; + } + memcpy(*data_ret, text_prop.value, bufsize); + *size_ret = bufsize; + XFree(text_prop.value); + free(mystr); + return EINA_TRUE; + } + else + { + free(mystr); + return EINA_FALSE; + } +} /* _ecore_x_dnd_converter_copy */ + +EAPI void +ecore_x_dnd_aware_set(Ecore_X_Window win, + Eina_Bool on) +{ + Ecore_X_Atom prop_data = ECORE_X_DND_VERSION; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (on) + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_AWARE, + XA_ATOM, 32, &prop_data, 1); + else + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_AWARE); +} /* ecore_x_dnd_aware_set */ + +EAPI int +ecore_x_dnd_version_get(Ecore_X_Window win) +{ + unsigned char *prop_data; + int num; + Version_Cache_Item *t; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + // this looks hacky - and it is, but we need a way of caching info about + // a window while dragging, because we literally query this every mouse + // move and going to and from x multiple times per move is EXPENSIVE + // and slows things down, puts lots of load on x etc. + if (_source->state == ECORE_X_DND_SOURCE_DRAGGING) + if (_version_cache) + { + int i; + + for (i = 0; i < _version_cache_num; i++) + { + if (_version_cache[i].win == win) + return _version_cache[i].ver; + } + } + + if (ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_AWARE, + XA_ATOM, 32, &prop_data, &num)) + { + int version = (int)*prop_data; + free(prop_data); + if (_source->state == ECORE_X_DND_SOURCE_DRAGGING) + { + _version_cache_num++; + if (_version_cache_num > _version_cache_alloc) + _version_cache_alloc += 16; + + t = realloc(_version_cache, + _version_cache_alloc * + sizeof(Version_Cache_Item)); + if (!t) return 0; + _version_cache = t; + _version_cache[_version_cache_num - 1].win = win; + _version_cache[_version_cache_num - 1].ver = version; + } + + return version; + } + + if (_source->state == ECORE_X_DND_SOURCE_DRAGGING) + { + _version_cache_num++; + if (_version_cache_num > _version_cache_alloc) + _version_cache_alloc += 16; + + t = realloc(_version_cache, _version_cache_alloc * + sizeof(Version_Cache_Item)); + if (!t) return 0; + _version_cache = t; + _version_cache[_version_cache_num - 1].win = win; + _version_cache[_version_cache_num - 1].ver = 0; + } + + return 0; +} /* ecore_x_dnd_version_get */ + +EAPI Eina_Bool +ecore_x_dnd_type_isset(Ecore_X_Window win, + const char *type) +{ + int num, i, ret = EINA_FALSE; + unsigned char *data; + Ecore_X_Atom *atoms, atom; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST, + XA_ATOM, 32, &data, &num)) + return ret; + + atom = ecore_x_atom_get(type); + atoms = (Ecore_X_Atom *)data; + + for (i = 0; i < num; ++i) + { + if (atom == atoms[i]) + { + ret = EINA_TRUE; + break; + } + } + + XFree(data); + return ret; +} /* ecore_x_dnd_type_isset */ + +EAPI void +ecore_x_dnd_type_set(Ecore_X_Window win, + const char *type, + Eina_Bool on) +{ + Ecore_X_Atom atom; + Ecore_X_Atom *oldset = NULL, *newset = NULL; + int i, j = 0, num = 0; + unsigned char *data = NULL; + unsigned char *old_data = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + atom = ecore_x_atom_get(type); + ecore_x_window_prop_property_get(win, ECORE_X_ATOM_XDND_TYPE_LIST, + XA_ATOM, 32, &old_data, &num); + oldset = (Ecore_X_Atom *)old_data; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (on) + { + if (ecore_x_dnd_type_isset(win, type)) + { + XFree(old_data); + return; + } + + newset = calloc(num + 1, sizeof(Ecore_X_Atom)); + if (!newset) + return; + + data = (unsigned char *)newset; + + for (i = 0; i < num; i++) + newset[i + 1] = oldset[i]; + /* prepend the new type */ + newset[0] = atom; + + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST, + XA_ATOM, 32, data, num + 1); + } + else + { + if (!ecore_x_dnd_type_isset(win, type)) + { + XFree(old_data); + return; + } + + newset = calloc(num - 1, sizeof(Ecore_X_Atom)); + if (!newset) + { + XFree(old_data); + return; + } + + data = (unsigned char *)newset; + for (i = 0; i < num; i++) + if (oldset[i] != atom) + newset[j++] = oldset[i]; + + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST, + XA_ATOM, 32, data, num - 1); + } + + XFree(oldset); + free(newset); +} /* ecore_x_dnd_type_set */ + +EAPI void +ecore_x_dnd_types_set(Ecore_X_Window win, + const char **types, + unsigned int num_types) +{ + Ecore_X_Atom *newset = NULL; + unsigned int i; + unsigned char *data = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!num_types) + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_TYPE_LIST); + else + { + newset = calloc(num_types, sizeof(Ecore_X_Atom)); + if (!newset) + return; + + data = (unsigned char *)newset; + for (i = 0; i < num_types; i++) + { + newset[i] = ecore_x_atom_get(types[i]); + ecore_x_selection_converter_atom_add(newset[i], + _ecore_x_dnd_converter_copy); + } + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_TYPE_LIST, + XA_ATOM, 32, data, num_types); + free(newset); + } +} /* ecore_x_dnd_types_set */ + +EAPI void +ecore_x_dnd_actions_set(Ecore_X_Window win, + Ecore_X_Atom *actions, + unsigned int num_actions) +{ + unsigned int i; + unsigned char *data = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!num_actions) + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_XDND_ACTION_LIST); + else + { + data = (unsigned char *)actions; + for (i = 0; i < num_actions; i++) + { + ecore_x_selection_converter_atom_add(actions[i], + _ecore_x_dnd_converter_copy); + } + ecore_x_window_prop_property_set(win, ECORE_X_ATOM_XDND_ACTION_LIST, + XA_ATOM, 32, data, num_actions); + } +} /* ecore_x_dnd_actions_set */ + +/** + * The DND position update cb is called Ecore_X sends a DND position to a + * client. + * + * It essentially mirrors some of the data sent in the position message. + * Generally this cb should be set just before position update is called. + * Please note well you need to look after your own data pointer if someone + * trashes you position update cb set. + * + * It is considered good form to clear this when the dnd event finishes. + * + * @param cb Callback to updated each time ecore_x sends a position update. + * @param data User data. + */ +EAPI void +ecore_x_dnd_callback_pos_update_set( + void (*cb)(void *, + Ecore_X_Xdnd_Position *data), + const void *data) +{ + _posupdatecb = cb; + _posupdatedata = (void *)data; /* Discard the const early */ +} + +Ecore_X_DND_Source * +_ecore_x_dnd_source_get(void) +{ + return _source; +} /* _ecore_x_dnd_source_get */ + +Ecore_X_DND_Target * +_ecore_x_dnd_target_get(void) +{ + return _target; +} /* _ecore_x_dnd_target_get */ + +EAPI Eina_Bool +ecore_x_dnd_begin(Ecore_X_Window source, + unsigned char *data, + int size) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_dnd_version_get(source)) + return EINA_FALSE; + + /* Take ownership of XdndSelection */ + if (!ecore_x_selection_xdnd_set(source, data, size)) + return EINA_FALSE; + + if (_version_cache) + { + free(_version_cache); + _version_cache = NULL; + _version_cache_num = 0; + _version_cache_alloc = 0; + } + + ecore_x_window_shadow_tree_flush(); + + _source->win = source; + ecore_x_window_ignore_set(_source->win, 1); + _source->state = ECORE_X_DND_SOURCE_DRAGGING; + _source->time = _ecore_x_event_last_time; + _source->prev.window = 0; + + /* Default Accepted Action: move */ + _source->action = ECORE_X_ATOM_XDND_ACTION_MOVE; + _source->accepted_action = None; + _source->dest = None; + + return EINA_TRUE; +} /* ecore_x_dnd_begin */ + +EAPI Eina_Bool +ecore_x_dnd_drop(void) +{ + XEvent xev; + int status = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (_source->dest) + { + xev.xany.type = ClientMessage; + xev.xany.display = _ecore_x_disp; + xev.xclient.format = 32; + xev.xclient.window = _source->dest; + + if (_source->will_accept) + { + xev.xclient.message_type = ECORE_X_ATOM_XDND_DROP; + xev.xclient.data.l[0] = _source->win; + xev.xclient.data.l[1] = 0; + xev.xclient.data.l[2] = _source->time; + XSendEvent(_ecore_x_disp, _source->dest, False, 0, &xev); + _source->state = ECORE_X_DND_SOURCE_DROPPED; + status = EINA_TRUE; + } + else + { + xev.xclient.message_type = ECORE_X_ATOM_XDND_LEAVE; + xev.xclient.data.l[0] = _source->win; + xev.xclient.data.l[1] = 0; + XSendEvent(_ecore_x_disp, _source->dest, False, 0, &xev); + _source->state = ECORE_X_DND_SOURCE_IDLE; + } + } + else + { + /* Dropping on nothing */ + ecore_x_selection_xdnd_clear(); + _source->state = ECORE_X_DND_SOURCE_IDLE; + } + + ecore_x_window_ignore_set(_source->win, 0); + + _source->prev.window = 0; + + return status; +} /* ecore_x_dnd_drop */ + +EAPI void +ecore_x_dnd_send_status(Eina_Bool will_accept, + Eina_Bool suppress, + Ecore_X_Rectangle rectangle, + Ecore_X_Atom action) +{ + XEvent xev; + + if (_target->state == ECORE_X_DND_TARGET_IDLE) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + memset(&xev, 0, sizeof(XEvent)); + + _target->will_accept = will_accept; + + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.message_type = ECORE_X_ATOM_XDND_STATUS; + xev.xclient.format = 32; + xev.xclient.window = _target->source; + + xev.xclient.data.l[0] = _target->win; + xev.xclient.data.l[1] = 0; + if (will_accept) + xev.xclient.data.l[1] |= 0x1UL; + + if (!suppress) + xev.xclient.data.l[1] |= 0x2UL; + + /* Set rectangle information */ + xev.xclient.data.l[2] = rectangle.x; + xev.xclient.data.l[2] <<= 16; + xev.xclient.data.l[2] |= rectangle.y; + xev.xclient.data.l[3] = rectangle.width; + xev.xclient.data.l[3] <<= 16; + xev.xclient.data.l[3] |= rectangle.height; + + if (will_accept) + { + xev.xclient.data.l[4] = action; + _target->accepted_action = action; + } + else + { + xev.xclient.data.l[4] = None; + _target->accepted_action = action; + } + + XSendEvent(_ecore_x_disp, _target->source, False, 0, &xev); +} /* ecore_x_dnd_send_status */ + +EAPI void +ecore_x_dnd_send_finished(void) +{ + XEvent xev; + + if (_target->state == ECORE_X_DND_TARGET_IDLE) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xev.xany.type = ClientMessage; + xev.xany.display = _ecore_x_disp; + xev.xclient.message_type = ECORE_X_ATOM_XDND_FINISHED; + xev.xclient.format = 32; + xev.xclient.window = _target->source; + + xev.xclient.data.l[0] = _target->win; + xev.xclient.data.l[1] = 0; + xev.xclient.data.l[2] = 0; + if (_target->will_accept) + { + xev.xclient.data.l[1] |= 0x1UL; + xev.xclient.data.l[2] = _target->accepted_action; + } + + XSendEvent(_ecore_x_disp, _target->source, False, 0, &xev); + + _target->state = ECORE_X_DND_TARGET_IDLE; +} /* ecore_x_dnd_send_finished */ + +EAPI void +ecore_x_dnd_source_action_set(Ecore_X_Atom action) +{ + _source->action = action; + if (_source->prev.window) + _ecore_x_dnd_drag(_source->prev.window, _source->prev.x, _source->prev.y); +} /* ecore_x_dnd_source_action_set */ + +EAPI Ecore_X_Atom +ecore_x_dnd_source_action_get(void) +{ + return _source->action; +} /* ecore_x_dnd_source_action_get */ + +void +_ecore_x_dnd_drag(Ecore_X_Window root, + int x, + int y) +{ + XEvent xev; + Ecore_X_Window win; + Ecore_X_Window *skip; + Ecore_X_Xdnd_Position pos; + int num; + + if (_source->state != ECORE_X_DND_SOURCE_DRAGGING) + return; + + /* Preinitialize XEvent struct */ + memset(&xev, 0, sizeof(XEvent)); + xev.xany.type = ClientMessage; + xev.xany.display = _ecore_x_disp; + xev.xclient.format = 32; + + /* Attempt to find a DND-capable window under the cursor */ + skip = ecore_x_window_ignore_list(&num); +// WARNING - this function is HEAVY. it goes to and from x a LOT walking the +// window tree - use the SHADOW version - makes a 1-off tree copy, then uses +// that instead. +// win = ecore_x_window_at_xy_with_skip_get(x, y, skip, num); + win = ecore_x_window_shadow_tree_at_xy_with_skip_get(root, x, y, skip, num); + +// NOTE: This now uses the shadow version to find parent windows +// while ((win) && !(ecore_x_dnd_version_get(win))) +// win = ecore_x_window_parent_get(win); + while ((win) && !(ecore_x_dnd_version_get(win))) + win = ecore_x_window_shadow_parent_get(root, win); + + /* Send XdndLeave to current destination window if we have left it */ + if ((_source->dest) && (win != _source->dest)) + { + xev.xclient.window = _source->dest; + xev.xclient.message_type = ECORE_X_ATOM_XDND_LEAVE; + xev.xclient.data.l[0] = _source->win; + xev.xclient.data.l[1] = 0; + + XSendEvent(_ecore_x_disp, _source->dest, False, 0, &xev); + _source->suppress = 0; + } + + if (win) + { + int x1, x2, y1, y2; + + _source->version = MIN(ECORE_X_DND_VERSION, + ecore_x_dnd_version_get(win)); + if (win != _source->dest) + { + int i; + unsigned char *data; + Ecore_X_Atom *types; + + ecore_x_window_prop_property_get(_source->win, + ECORE_X_ATOM_XDND_TYPE_LIST, + XA_ATOM, + 32, + &data, + &num); + types = (Ecore_X_Atom *)data; + + /* Entered new window, send XdndEnter */ + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_XDND_ENTER; + xev.xclient.data.l[0] = _source->win; + xev.xclient.data.l[1] = 0; + if (num > 3) + xev.xclient.data.l[1] |= 0x1UL; + else + xev.xclient.data.l[1] &= 0xfffffffeUL; + + xev.xclient.data.l[1] |= ((unsigned long)_source->version) << 24; + + for (i = 2; i < 5; i++) + xev.xclient.data.l[i] = 0; + for (i = 0; i < MIN(num, 3); ++i) + xev.xclient.data.l[i + 2] = types[i]; + XFree(data); + XSendEvent(_ecore_x_disp, win, False, 0, &xev); + _source->await_status = 0; + _source->will_accept = 0; + } + + /* Determine if we're still in the rectangle from the last status */ + x1 = _source->rectangle.x; + x2 = _source->rectangle.x + _source->rectangle.width; + y1 = _source->rectangle.y; + y2 = _source->rectangle.y + _source->rectangle.height; + + if ((!_source->await_status) || + (!_source->suppress) || + ((x < x1) || (x > x2) || (y < y1) || (y > y2))) + { + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_XDND_POSITION; + xev.xclient.data.l[0] = _source->win; + xev.xclient.data.l[1] = 0; /* Reserved */ + xev.xclient.data.l[2] = ((x << 16) & 0xffff0000) | (y & 0xffff); + xev.xclient.data.l[3] = _source->time; /* Version 1 */ + xev.xclient.data.l[4] = _source->action; /* Version 2, Needs to be pre-set */ + XSendEvent(_ecore_x_disp, win, False, 0, &xev); + + _source->await_status = 1; + } + } + + if (_posupdatecb) + { + pos.position.x = x; + pos.position.y = y; + pos.win = win; + pos.prev = _source->dest; + _posupdatecb(_posupdatedata, &pos); + } + + _source->prev.x = x; + _source->prev.y = y; + _source->prev.window = root; + _source->dest = win; +} /* _ecore_x_dnd_drag */ + +/* vim:set ts=8 sw=3 sts=3 expandtab cino=>5n-2f0^-2{2(0W1st0 :*/ diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c new file mode 100644 index 0000000..74d5344 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_dpms.c @@ -0,0 +1,247 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "ecore_x_private.h" + +static Eina_Bool _dpms_available = EINA_FALSE; + +void +_ecore_x_dpms_init(void) +{ +#ifdef ECORE_XDPMS + int _dpms_major, _dpms_minor; + + _dpms_major = 1; + _dpms_minor = 0; + + if (DPMSGetVersion(_ecore_x_disp, &_dpms_major, &_dpms_minor)) + _dpms_available = EINA_TRUE; + else + _dpms_available = EINA_FALSE; + +#else /* ifdef ECORE_XDPMS */ + _dpms_available = EINA_FALSE; +#endif /* ifdef ECORE_XDPMS */ +} /* _ecore_x_dpms_init */ + +/** + * @defgroup Ecore_X_DPMS_Group X DPMS Extension Functions + * + * Functions related to the X DPMS extension. + */ + +/** + * Checks if the X DPMS extension is available on the server. + * @return @c 1 if the X DPMS extension is available, @c 0 otherwise. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI Eina_Bool +ecore_x_dpms_query(void) +{ + return _dpms_available; +} /* ecore_x_dpms_query */ + +/** + * Checks if the X server is capable of DPMS. + * @return @c 1 if the X server is capable of DPMS, @c 0 otherwise. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI Eina_Bool +ecore_x_dpms_capable_get(void) +{ +#ifdef ECORE_XDPMS + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return DPMSCapable(_ecore_x_disp) ? EINA_TRUE : EINA_FALSE; +#else /* ifdef ECORE_XDPMS */ + return EINA_FALSE; +#endif /* ifdef ECORE_XDPMS */ +} /* ecore_x_dpms_capable_get */ + +/** + * Checks the DPMS state of the display. + * @return @c 1 if DPMS is enabled, @c 0 otherwise. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI Eina_Bool +ecore_x_dpms_enabled_get(void) +{ +#ifdef ECORE_XDPMS + unsigned char state; + unsigned short power_lvl; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + DPMSInfo(_ecore_x_disp, &power_lvl, &state); + return state ? EINA_TRUE : EINA_FALSE; +#else /* ifdef ECORE_XDPMS */ + return EINA_FALSE; +#endif /* ifdef ECORE_XDPMS */ +} /* ecore_x_dpms_enabled_get */ + +/** + * Sets the DPMS state of the display. + * @param enabled @c 0 to disable DPMS characteristics of the server, enable it otherwise. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI void +ecore_x_dpms_enabled_set(int enabled) +{ +#ifdef ECORE_XDPMS + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (enabled) + DPMSEnable(_ecore_x_disp); + else + DPMSDisable(_ecore_x_disp); + +#endif /* ifdef ECORE_XDPMS */ +} /* ecore_x_dpms_enabled_set */ + +/** + * Gets the timeouts. The values are in unit of seconds. + * @param standby Amount of time of inactivity before standby mode will be invoked. + * @param suspend Amount of time of inactivity before the screen is placed into suspend mode. + * @param off Amount of time of inactivity before the monitor is shut off. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI void +ecore_x_dpms_timeouts_get(unsigned int *standby, + unsigned int *suspend, + unsigned int *off) +{ +#ifdef ECORE_XDPMS + LOGFN(__FILE__, __LINE__, __FUNCTION__); + DPMSGetTimeouts(_ecore_x_disp, (unsigned short *)standby, + (unsigned short *)suspend, (unsigned short *)off); +#endif /* ifdef ECORE_XDPMS */ +} /* ecore_x_dpms_timeouts_get */ + +/** + * Sets the timeouts. The values are in unit of seconds. + * @param standby Amount of time of inactivity before standby mode will be invoked. + * @param suspend Amount of time of inactivity before the screen is placed into suspend mode. + * @param off Amount of time of inactivity before the monitor is shut off. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI Eina_Bool +ecore_x_dpms_timeouts_set(unsigned int standby, + unsigned int suspend, + unsigned int off) +{ +#ifdef ECORE_XDPMS + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return DPMSSetTimeouts(_ecore_x_disp, standby, suspend, off) ? EINA_TRUE : EINA_FALSE; +#else /* ifdef ECORE_XDPMS */ + return EINA_FALSE; +#endif /* ifdef ECORE_XDPMS */ +} /* ecore_x_dpms_timeouts_set */ + +/** + * Returns the amount of time of inactivity before standby mode is invoked. + * @return The standby timeout value. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI unsigned int +ecore_x_dpms_timeout_standby_get(void) +{ +#ifdef ECORE_XDPMS + unsigned short standby, suspend, off; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); + return standby; +#else /* ifdef ECORE_XDPMS */ + return 0; +#endif /* ifdef ECORE_XDPMS */ +} /* ecore_x_dpms_timeout_standby_get */ + +/** + * Returns the amount of time of inactivity before the second level of + * power saving is invoked. + * @return The suspend timeout value. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI unsigned int +ecore_x_dpms_timeout_suspend_get(void) +{ +#ifdef ECORE_XDPMS + unsigned short standby, suspend, off; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); + return suspend; +#else /* ifdef ECORE_XDPMS */ + return 0; +#endif /* ifdef ECORE_XDPMS */ +} /* ecore_x_dpms_timeout_suspend_get */ + +/** + * Returns the amount of time of inactivity before the third and final + * level of power saving is invoked. + * @return The off timeout value. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI unsigned int +ecore_x_dpms_timeout_off_get(void) +{ +#ifdef ECORE_XDPMS + unsigned short standby, suspend, off; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); + return off; +#else /* ifdef ECORE_XDPMS */ + return 0; +#endif /* ifdef ECORE_XDPMS */ +} /* ecore_x_dpms_timeout_off_get */ + +/** + * Sets the standby timeout (in unit of seconds). + * @param new_standby Amount of time of inactivity before standby mode will be invoked. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI void +ecore_x_dpms_timeout_standby_set(unsigned int new_timeout) +{ +#ifdef ECORE_XDPMS + unsigned short standby, suspend, off; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); + DPMSSetTimeouts(_ecore_x_disp, new_timeout, suspend, off); +#endif /* ifdef ECORE_XDPMS */ +} /* ecore_x_dpms_timeout_standby_set */ + +/** + * Sets the suspend timeout (in unit of seconds). + * @param suspend Amount of time of inactivity before the screen is placed into suspend mode. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI void +ecore_x_dpms_timeout_suspend_set(unsigned int new_timeout) +{ +#ifdef ECORE_XDPMS + unsigned short standby, suspend, off; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); + DPMSSetTimeouts(_ecore_x_disp, standby, new_timeout, off); +#endif /* ifdef ECORE_XDPMS */ +} /* ecore_x_dpms_timeout_suspend_set */ + +/** + * Sets the off timeout (in unit of seconds). + * @param off Amount of time of inactivity before the monitor is shut off. + * @ingroup Ecore_X_DPMS_Group + */ +EAPI void +ecore_x_dpms_timeout_off_set(unsigned int new_timeout) +{ +#ifdef ECORE_XDPMS + unsigned short standby, suspend, off; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + DPMSGetTimeouts(_ecore_x_disp, &standby, &suspend, &off); + DPMSSetTimeouts(_ecore_x_disp, standby, suspend, new_timeout); +#endif /* ifdef ECORE_XDPMS */ +} /* ecore_x_dpms_timeout_off_set */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c new file mode 100644 index 0000000..a64060b --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_drawable.c @@ -0,0 +1,118 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "ecore_x_private.h" + +/** + * @defgroup Ecore_X_Drawable_Group X Drawable Functions + * + * Functions that operate on drawables. + */ + +/** + * Retrieves the geometry of the given drawable. + * @param d The given drawable. + * @param x Pointer to an integer into which the X position is to be stored. + * @param y Pointer to an integer into which the Y position is to be stored. + * @param w Pointer to an integer into which the width is to be stored. + * @param h Pointer to an integer into which the height is to be stored. + * @ingroup Ecore_X_Drawable_Group + */ +EAPI void +ecore_x_drawable_geometry_get(Ecore_X_Drawable d, + int *x, + int *y, + int *w, + int *h) +{ + Window dummy_win; + int ret_x, ret_y; + unsigned int ret_w, ret_h, dummy_border, dummy_depth; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &ret_x, &ret_y, + &ret_w, &ret_h, &dummy_border, &dummy_depth)) + { + ret_x = 0; + ret_y = 0; + ret_w = 0; + ret_h = 0; + } + + if (x) + *x = ret_x; + + if (y) + *y = ret_y; + + if (w) + *w = (int)ret_w; + + if (h) + *h = (int)ret_h; +} /* ecore_x_drawable_geometry_get */ + +/** + * Retrieves the width of the border of the given drawable. + * @param d The given drawable. + * @return The border width of the given drawable. + * @ingroup Ecore_X_Drawable_Group + */ +EAPI int +ecore_x_drawable_border_width_get(Ecore_X_Drawable d) +{ + Window dummy_win; + int dummy_x, dummy_y; + unsigned int dummy_w, dummy_h, border_ret, dummy_depth; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y, + &dummy_w, &dummy_h, &border_ret, &dummy_depth)) + border_ret = 0; + + return (int)border_ret; +} /* ecore_x_drawable_border_width_get */ + +/** + * Retrieves the depth of the given drawable. + * @param d The given drawable. + * @return The depth of the given drawable. + * @ingroup Ecore_X_Drawable_Group + */ +EAPI int +ecore_x_drawable_depth_get(Ecore_X_Drawable d) +{ + Window dummy_win; + int dummy_x, dummy_y; + unsigned int dummy_w, dummy_h, dummy_border, depth_ret; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!XGetGeometry(_ecore_x_disp, d, &dummy_win, &dummy_x, &dummy_y, + &dummy_w, &dummy_h, &dummy_border, &depth_ret)) + depth_ret = 0; + + return (int)depth_ret; +} /* ecore_x_drawable_depth_get */ + +/** + * Fill the specified rectangle on a drawable. + * @param d The given drawable. + * @param gc The graphic context that controls the fill rules. + * @param x The X coordinate of the top-left corner of the rectangle. + * @param y The Y coordinate of the top-left corner of the rectangle. + * @param width The width of the rectangle. + * @param height The height of the rectangle. + */ +EAPI void +ecore_x_drawable_rectangle_fill(Ecore_X_Drawable d, + Ecore_X_GC gc, + int x, + int y, + int width, + int height) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFillRectangle(_ecore_x_disp, d, gc, x, y, width, height); +} /* ecore_x_drawable_rectangle_fill */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c new file mode 100644 index 0000000..d357c9b --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_e.c @@ -0,0 +1,1060 @@ +/* + * OLD E hints + */ + +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include "Ecore_X_Atoms.h" + +EAPI void +ecore_x_e_init(void) +{ +} /* ecore_x_e_init */ + +EAPI void +ecore_x_e_frame_size_set(Ecore_X_Window win, + int fl, + int fr, + int ft, + int fb) +{ + unsigned int frames[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + frames[0] = fl; + frames[1] = fr; + frames[2] = ft; + frames[3] = fb; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_FRAME_SIZE, frames, 4); +} /* ecore_x_e_frame_size_set */ + +EAPI void +ecore_x_e_virtual_keyboard_set(Ecore_X_Window win, + unsigned int is_keyboard) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD, + &is_keyboard, 1); +} /* ecore_x_e_virtual_keyboard_set */ + +EAPI Eina_Bool +ecore_x_e_virtual_keyboard_get(Ecore_X_Window win) +{ + unsigned int val; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD, + &val, 1)) + return EINA_FALSE; + + return val ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_e_virtual_keyboard_get */ + +static Ecore_X_Virtual_Keyboard_State +_ecore_x_e_vkbd_state_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_ON; + + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF; + + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA; + + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC; + + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN; + + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER; + + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX; + + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL; + + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD; + + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_IP; + + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST; + + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE; + + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_URL; + + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD; + + if (atom == ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME; + + return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN; +} /* _ecore_x_e_vkbd_state_get */ + +static Ecore_X_Atom +_ecore_x_e_vkbd_atom_get(Ecore_X_Virtual_Keyboard_State state) +{ + switch (state) + { + case ECORE_X_VIRTUAL_KEYBOARD_STATE_OFF: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_OFF; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_ON: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ON; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_ALPHA: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_ALPHA; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_NUMERIC: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_NUMERIC; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_PIN: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PIN; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_PHONE_NUMBER: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PHONE_NUMBER; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_HEX: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HEX; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_TERMINAL: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_TERMINAL; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_PASSWORD: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_PASSWORD; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_IP: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_IP; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_HOST: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_HOST; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_FILE: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_FILE; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_URL: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_URL; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_KEYPAD: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_KEYPAD; + + case ECORE_X_VIRTUAL_KEYBOARD_STATE_J2ME: + return ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_J2ME; + + default: break; + } /* switch */ + return 0; +} /* _ecore_x_e_vkbd_atom_get */ + +EAPI void +ecore_x_e_virtual_keyboard_state_set(Ecore_X_Window win, + Ecore_X_Virtual_Keyboard_State state) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + atom = _ecore_x_e_vkbd_atom_get(state); + ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE, + &atom, 1); +} /* ecore_x_e_virtual_keyboard_state_set */ + +EAPI Ecore_X_Virtual_Keyboard_State +ecore_x_e_virtual_keyboard_state_get(Ecore_X_Window win) +{ + Ecore_X_Atom atom; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_atom_get(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE, + &atom, 1)) + return ECORE_X_VIRTUAL_KEYBOARD_STATE_UNKNOWN; + + return _ecore_x_e_vkbd_state_get(atom); +} /* ecore_x_e_virtual_keyboard_state_get */ + +EAPI void +ecore_x_e_virtual_keyboard_state_send(Ecore_X_Window win, + Ecore_X_Virtual_Keyboard_State state) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_VIRTUAL_KEYBOARD_STATE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + _ecore_x_e_vkbd_atom_get(state), + 0, 0, 0, 0); +} /* ecore_x_e_virtual_keyboard_state_send */ + +static Ecore_X_Atom +_ecore_x_e_illume_atom_get(Ecore_X_Illume_Mode mode) +{ + switch (mode) + { + case ECORE_X_ILLUME_MODE_SINGLE: + return ECORE_X_ATOM_E_ILLUME_MODE_SINGLE; + + case ECORE_X_ILLUME_MODE_DUAL_TOP: + return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP; + + case ECORE_X_ILLUME_MODE_DUAL_LEFT: + return ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT; + + default: + break; + } /* switch */ + return ECORE_X_ILLUME_MODE_UNKNOWN; +} /* _ecore_x_e_illume_atom_get */ + +static Ecore_X_Illume_Mode +_ecore_x_e_illume_mode_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_E_ILLUME_MODE_SINGLE) + return ECORE_X_ILLUME_MODE_SINGLE; + + if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_TOP) + return ECORE_X_ILLUME_MODE_DUAL_TOP; + + if (atom == ECORE_X_ATOM_E_ILLUME_MODE_DUAL_LEFT) + return ECORE_X_ILLUME_MODE_DUAL_LEFT; + + return ECORE_X_ILLUME_MODE_UNKNOWN; +} /* _ecore_x_e_illume_mode_get */ + +EAPI void +ecore_x_e_illume_zone_set(Ecore_X_Window win, + Ecore_X_Window zone) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE, + &zone, 1); +} /* ecore_x_e_illume_zone_set */ + +EAPI Ecore_X_Window +ecore_x_e_illume_zone_get(Ecore_X_Window win) +{ + Ecore_X_Window zone; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_window_get(win, ECORE_X_ATOM_E_ILLUME_ZONE, + &zone, 1)) + return 0; + + return zone; +} /* ecore_x_e_illume_zone_get */ + +EAPI void +ecore_x_e_illume_zone_list_set(Ecore_X_Window win, + Ecore_X_Window *zones, + unsigned int n_zones) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_window_set(win, ECORE_X_ATOM_E_ILLUME_ZONE_LIST, + zones, n_zones); +} /* ecore_x_e_illume_zone_list_set */ + +EAPI void +ecore_x_e_illume_conformant_set(Ecore_X_Window win, + unsigned int is_conformant) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT, + &is_conformant, 1); +} /* ecore_x_e_illume_conformant_set */ + +EAPI Eina_Bool +ecore_x_e_illume_conformant_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_CONFORMANT, + &val, 1)) + return EINA_FALSE; + + return val ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_e_illume_conformant_get */ + +EAPI void +ecore_x_e_illume_mode_set(Ecore_X_Window win, + Ecore_X_Illume_Mode mode) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + atom = _ecore_x_e_illume_atom_get(mode); + ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_MODE, + &atom, 1); +} /* ecore_x_e_illume_mode_set */ + +EAPI Ecore_X_Illume_Mode +ecore_x_e_illume_mode_get(Ecore_X_Window win) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_atom_get(win, ECORE_X_ATOM_E_ILLUME_MODE, &atom, 1)) + return ECORE_X_ILLUME_MODE_UNKNOWN; + + return _ecore_x_e_illume_mode_get(atom); +} /* ecore_x_e_illume_mode_get */ + +EAPI void +ecore_x_e_illume_mode_send(Ecore_X_Window win, + Ecore_X_Illume_Mode mode) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_MODE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + _ecore_x_e_illume_atom_get(mode), + 0, 0, 0, 0); +} /* ecore_x_e_illume_mode_send */ + +EAPI void +ecore_x_e_illume_focus_back_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_BACK, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} /* ecore_x_e_illume_focus_back_send */ + +EAPI void +ecore_x_e_illume_focus_forward_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_FORWARD, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} /* ecore_x_e_illume_focus_forward_send */ + +EAPI void +ecore_x_e_illume_focus_home_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_FOCUS_HOME, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} /* ecore_x_e_illume_focus_home_send */ + +EAPI void +ecore_x_e_illume_close_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_CLOSE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} /* ecore_x_e_illume_close_send */ + +EAPI void +ecore_x_e_illume_home_new_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_NEW, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} /* ecore_x_e_illume_home_new_send */ + +EAPI void +ecore_x_e_illume_home_del_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_HOME_DEL, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} /* ecore_x_e_illume_home_del_send */ + +EAPI void +ecore_x_e_illume_drag_set(Ecore_X_Window win, + unsigned int drag) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG, &drag, 1); +} /* ecore_x_e_illume_drag_set */ + +EAPI Eina_Bool +ecore_x_e_illume_drag_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_DRAG, &val, 1)) + return EINA_FALSE; + + return val ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_e_illume_drag_get */ + +EAPI void +ecore_x_e_illume_drag_locked_set(Ecore_X_Window win, + unsigned int is_locked) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED, + &is_locked, 1); +} /* ecore_x_e_illume_drag_locked_set */ + +EAPI Eina_Bool +ecore_x_e_illume_drag_locked_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_DRAG_LOCKED, + &val, 1)) + return EINA_FALSE; + + return val ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_e_illume_drag_locked_get */ + +EAPI void +ecore_x_e_illume_drag_start_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_DRAG_START, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} /* ecore_x_e_illume_drag_start_send */ + +EAPI void +ecore_x_e_illume_drag_end_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_DRAG_END, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} /* ecore_x_e_illume_drag_end_send */ + +EAPI void +ecore_x_e_illume_indicator_geometry_set(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + geom[0] = x; + geom[1] = y; + geom[2] = w; + geom[3] = h; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY, + geom, 4); +} /* ecore_x_e_illume_indicator_geometry_set */ + +EAPI Eina_Bool +ecore_x_e_illume_indicator_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *w, + int *h) +{ + int ret = 0; + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = + ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_E_ILLUME_INDICATOR_GEOMETRY, + geom, 4); + if (ret != 4) + return EINA_FALSE; + + if (x) + *x = geom[0]; + + if (y) + *y = geom[1]; + + if (w) + *w = geom[2]; + + if (h) + *h = geom[3]; + + return EINA_TRUE; +} /* ecore_x_e_illume_indicator_geometry_get */ + +EAPI void +ecore_x_e_illume_softkey_geometry_set(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + geom[0] = x; + geom[1] = y; + geom[2] = w; + geom[3] = h; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY, + geom, 4); +} /* ecore_x_e_illume_softkey_geometry_set */ + +EAPI Eina_Bool +ecore_x_e_illume_softkey_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *w, + int *h) +{ + int ret = 0; + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = + ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_E_ILLUME_SOFTKEY_GEOMETRY, + geom, 4); + if (ret != 4) + return EINA_FALSE; + + if (x) + *x = geom[0]; + + if (y) + *y = geom[1]; + + if (w) + *w = geom[2]; + + if (h) + *h = geom[3]; + + return EINA_TRUE; +} /* ecore_x_e_illume_softkey_geometry_get */ + +EAPI void +ecore_x_e_illume_keyboard_geometry_set(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + geom[0] = x; + geom[1] = y; + geom[2] = w; + geom[3] = h; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY, + geom, 4); +} /* ecore_x_e_illume_keyboard_geometry_set */ + +EAPI Eina_Bool +ecore_x_e_illume_keyboard_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *w, + int *h) +{ + int ret = 0; + unsigned int geom[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = + ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_E_ILLUME_KEYBOARD_GEOMETRY, + geom, 4); + if (ret != 4) + return EINA_FALSE; + + if (x) + *x = geom[0]; + + if (y) + *y = geom[1]; + + if (w) + *w = geom[2]; + + if (h) + *h = geom[3]; + + return EINA_TRUE; +} /* ecore_x_e_illume_keyboard_geometry_get */ + +static Ecore_X_Atom +_ecore_x_e_quickpanel_atom_get(Ecore_X_Illume_Quickpanel_State state) +{ + switch (state) + { + case ECORE_X_ILLUME_QUICKPANEL_STATE_ON: + return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON; + + case ECORE_X_ILLUME_QUICKPANEL_STATE_OFF: + return ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF; + + default: + break; + } /* switch */ + return 0; +} /* _ecore_x_e_quickpanel_atom_get */ + +static Ecore_X_Illume_Quickpanel_State +_ecore_x_e_quickpanel_state_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ON) + return ECORE_X_ILLUME_QUICKPANEL_STATE_ON; + + if (atom == ECORE_X_ATOM_E_ILLUME_QUICKPANEL_OFF) + return ECORE_X_ILLUME_QUICKPANEL_STATE_OFF; + + return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN; +} /* _ecore_x_e_quickpanel_state_get */ + +EAPI void +ecore_x_e_illume_quickpanel_set(Ecore_X_Window win, + unsigned int is_quickpanel) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL, + &is_quickpanel, 1); +} /* ecore_x_e_illume_quickpanel_set */ + +EAPI Eina_Bool +ecore_x_e_illume_quickpanel_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL, + &val, 1)) + return EINA_FALSE; + + return val ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_e_illume_quickpanel_get */ + +EAPI void +ecore_x_e_illume_quickpanel_state_set(Ecore_X_Window win, + Ecore_X_Illume_Quickpanel_State state) +{ + Ecore_X_Atom atom = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + atom = _ecore_x_e_quickpanel_atom_get(state); + ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE, + &atom, 1); +} /* ecore_x_e_illume_quickpanel_state_set */ + +EAPI Ecore_X_Illume_Quickpanel_State +ecore_x_e_illume_quickpanel_state_get(Ecore_X_Window win) +{ + Ecore_X_Atom atom; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_atom_get(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE, + &atom, 1)) + return ECORE_X_ILLUME_QUICKPANEL_STATE_UNKNOWN; + + return _ecore_x_e_quickpanel_state_get(atom); +} /* ecore_x_e_illume_quickpanel_state_get */ + +EAPI void +ecore_x_e_illume_quickpanel_state_send(Ecore_X_Window win, + Ecore_X_Illume_Quickpanel_State state) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + _ecore_x_e_quickpanel_atom_get(state), + 0, 0, 0, 0); +} /* ecore_x_e_illume_quickpanel_state_send */ + +EAPI void +ecore_x_e_illume_quickpanel_state_toggle(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_STATE_TOGGLE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 0, 0, 0, 0, 0); +} /* ecore_x_e_illume_quickpanel_state_toggle */ + +EAPI void +ecore_x_e_illume_quickpanel_priority_major_set(Ecore_X_Window win, + unsigned int priority) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR, + &priority, 1); +} /* ecore_x_e_illume_quickpanel_priority_major_set */ + +EAPI int +ecore_x_e_illume_quickpanel_priority_major_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MAJOR, + &val, 1)) + return 0; + + return val; +} /* ecore_x_e_illume_quickpanel_priority_major_get */ + +EAPI void +ecore_x_e_illume_quickpanel_priority_minor_set(Ecore_X_Window win, + unsigned int priority) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR, + &priority, 1); +} /* ecore_x_e_illume_quickpanel_priority_minor_set */ + +EAPI int +ecore_x_e_illume_quickpanel_priority_minor_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_PRIORITY_MINOR, + &val, 1)) + return 0; + + return val; +} /* ecore_x_e_illume_quickpanel_priority_minor_get */ + +EAPI void +ecore_x_e_illume_quickpanel_zone_set(Ecore_X_Window win, + unsigned int zone) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE, + &zone, 1); +} /* ecore_x_e_illume_quickpanel_zone_set */ + +EAPI int +ecore_x_e_illume_quickpanel_zone_get(Ecore_X_Window win) +{ + unsigned int val = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_ZONE, + &val, 1)) + return 0; + + return val; +} /* ecore_x_e_illume_quickpanel_zone_get */ + +EAPI void +ecore_x_e_illume_quickpanel_position_update_send(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, + ECORE_X_ATOM_E_ILLUME_QUICKPANEL_POSITION_UPDATE, + ECORE_X_EVENT_MASK_WINDOW_CONFIGURE, + 1, 0, 0, 0, 0); +} /* ecore_x_e_illume_quickpanel_position_update_send */ + +EAPI void +ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, + Ecore_X_Sync_Counter counter) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (counter) + ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER, + ECORE_X_ATOM_CARDINAL, &counter, 1); + else + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_E_COMP_SYNC_COUNTER); +} /* ecore_x_e_comp_sync_counter_set */ + +EAPI Ecore_X_Sync_Counter +ecore_x_e_comp_sync_counter_get(Ecore_X_Window win) +{ + int ret = 0; + Ecore_X_Sync_Counter counter = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = + ecore_x_window_prop_xid_get(win, + ECORE_X_ATOM_E_COMP_SYNC_COUNTER, + ECORE_X_ATOM_CARDINAL, + &counter, 1); + if (ret != 1) + return 0; + + return counter; +} /* ecore_x_e_comp_sync_counter_get */ + +EAPI void +ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root, + Ecore_X_Window win) +{ + XEvent xev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE; + xev.xclient.format = 32; + xev.xclient.data.l[0] = win; + xev.xclient.data.l[1] = 0; // version + xev.xclient.data.l[2] = 0; // later + xev.xclient.data.l[3] = 0; // later + xev.xclient.data.l[4] = 0; // later + + XSendEvent(_ecore_x_disp, root, False, + SubstructureRedirectMask | SubstructureNotifyMask, + &xev); +} /* ecore_x_e_comp_sync_draw_done_send */ + +EAPI void +ecore_x_e_comp_sync_draw_size_done_send(Ecore_X_Window root, + Ecore_X_Window win, + int w, + int h) +{ + XEvent xev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_DRAW_DONE; + xev.xclient.format = 32; + xev.xclient.data.l[0] = win; + xev.xclient.data.l[1] = 1; // version + xev.xclient.data.l[2] = w; // win width at draw time + xev.xclient.data.l[3] = h; // win height at draw time + xev.xclient.data.l[4] = 0; // later + + XSendEvent(_ecore_x_disp, root, False, + SubstructureRedirectMask | SubstructureNotifyMask, + &xev); +} /* ecore_x_e_comp_sync_draw_done_send */ + +EAPI void +ecore_x_e_comp_sync_supported_set(Ecore_X_Window root, + Eina_Bool enabled) +{ + Ecore_X_Window win; + + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (enabled) + { + win = ecore_x_window_new(root, 1, 2, 3, 4); + ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, + ECORE_X_ATOM_WINDOW, &win, 1); + ecore_x_window_prop_xid_set(root, ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, + ECORE_X_ATOM_WINDOW, &win, 1); + } + else + { + int ret; + + ret = + ecore_x_window_prop_xid_get(root, + ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, + ECORE_X_ATOM_WINDOW, + &win, 1); + if ((ret == 1) && (win)) + { + ecore_x_window_prop_property_del( + root, + ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED); + ecore_x_window_free(win); + } + } +} /* ecore_x_e_comp_sync_supported_set */ + +EAPI Eina_Bool +ecore_x_e_comp_sync_supported_get(Ecore_X_Window root) +{ + Ecore_X_Window win, win2; + int ret; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + + ret = + ecore_x_window_prop_xid_get(root, + ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, + ECORE_X_ATOM_WINDOW, + &win, 1); + if ((ret == 1) && (win)) + { + ret = + ecore_x_window_prop_xid_get(win, + ECORE_X_ATOM_E_COMP_SYNC_SUPPORTED, + ECORE_X_ATOM_WINDOW, + &win2, 1); + if ((ret == 1) && (win2 == win)) + return EINA_TRUE; + } + + return EINA_FALSE; +} /* ecore_x_e_comp_sync_supported_get */ + +EAPI void +ecore_x_e_comp_sync_begin_send(Ecore_X_Window win) +{ + XEvent xev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_BEGIN; + xev.xclient.format = 32; + xev.xclient.data.l[0] = win; + xev.xclient.data.l[1] = 0; // later + xev.xclient.data.l[2] = 0; // later + xev.xclient.data.l[3] = 0; // later + xev.xclient.data.l[4] = 0; // later + + XSendEvent(_ecore_x_disp, win, False, + NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, + &xev); +} /* ecore_x_e_comp_sync_begin_send */ + +EAPI void +ecore_x_e_comp_sync_end_send(Ecore_X_Window win) +{ + XEvent xev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_END; + xev.xclient.format = 32; + xev.xclient.data.l[0] = win; + xev.xclient.data.l[1] = 0; // later + xev.xclient.data.l[2] = 0; // later + xev.xclient.data.l[3] = 0; // later + xev.xclient.data.l[4] = 0; // later + + XSendEvent(_ecore_x_disp, win, False, + NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, + &xev); +} /* ecore_x_e_comp_sync_end_send */ + +EAPI void +ecore_x_e_comp_sync_cancel_send(Ecore_X_Window win) +{ + XEvent xev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_E_COMP_SYNC_CANCEL; + xev.xclient.format = 32; + xev.xclient.data.l[0] = win; + xev.xclient.data.l[1] = 0; // later + xev.xclient.data.l[2] = 0; // later + xev.xclient.data.l[3] = 0; // later + xev.xclient.data.l[4] = 0; // later + + XSendEvent(_ecore_x_disp, win, False, + NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, + &xev); +} /* ecore_x_e_comp_sync_cancel_send */ + +EAPI void +ecore_x_e_comp_flush_send(Ecore_X_Window win) +{ + XEvent xev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_E_COMP_FLUSH; + xev.xclient.format = 32; + xev.xclient.data.l[0] = win; + xev.xclient.data.l[1] = 0; // later + xev.xclient.data.l[2] = 0; // later + xev.xclient.data.l[3] = 0; // later + xev.xclient.data.l[4] = 0; // later + + XSendEvent(_ecore_x_disp, win, False, + NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, + &xev); +} /* ecore_x_e_comp_flush_send */ + +EAPI void +ecore_x_e_comp_dump_send(Ecore_X_Window win) +{ + XEvent xev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_E_COMP_DUMP; + xev.xclient.format = 32; + xev.xclient.data.l[0] = win; + xev.xclient.data.l[1] = 0; // later + xev.xclient.data.l[2] = 0; // later + xev.xclient.data.l[3] = 0; // later + xev.xclient.data.l[4] = 0; // later + + XSendEvent(_ecore_x_disp, win, False, + NoEventMask, //SubstructureRedirectMask | SubstructureNotifyMask, + &xev); +} /* ecore_x_e_comp_dump_send */ + +EAPI void +ecore_x_e_comp_pixmap_set(Ecore_X_Window win, + Ecore_X_Pixmap pixmap) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (pixmap) + ecore_x_window_prop_xid_set(win, ECORE_X_ATOM_E_COMP_PIXMAP, + ECORE_X_ATOM_PIXMAP, &pixmap, 1); + else + ecore_x_window_prop_property_del(win, pixmap); +} /* ecore_x_e_comp_pixmap_set */ + +EAPI Ecore_X_Pixmap +ecore_x_e_comp_pixmap_get(Ecore_X_Window win) +{ + int ret = 0; + Ecore_X_Pixmap pixmap = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = + ecore_x_window_prop_xid_get(win, + ECORE_X_ATOM_E_COMP_PIXMAP, + ECORE_X_ATOM_PIXMAP, + &pixmap, 1); + if (ret != 1) + return 0; + + return pixmap; +} /* ecore_x_e_comp_pixmap_get */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c new file mode 100644 index 0000000..837ff53 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_error.c @@ -0,0 +1,111 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include + +#include "Ecore.h" +#include "ecore_private.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" + +static int _ecore_x_error_handle(Display *d, + XErrorEvent *ev); +static int _ecore_x_io_error_handle(Display *d); + +static void (*_error_func)(void *data) = NULL; +static void *_error_data = NULL; +static void (*_io_error_func)(void *data) = NULL; +static void *_io_error_data = NULL; +static int _error_request_code = 0; +static int _error_code = 0; + +/** + * Set the error handler. + * @param func The error handler function + * @param data The data to be passed to the handler function + * + * Set the X error handler function + */ +EAPI void +ecore_x_error_handler_set(void (*func)(void *data), + const void *data) +{ + _error_func = func; + _error_data = (void *)data; +} /* ecore_x_error_handler_set */ + +/** + * Set the I/O error handler. + * @param func The I/O error handler function + * @param data The data to be passed to the handler function + * + * Set the X I/O error handler function + */ +EAPI void +ecore_x_io_error_handler_set(void (*func)(void *data), + const void *data) +{ + _io_error_func = func; + _io_error_data = (void *)data; +} /* ecore_x_io_error_handler_set */ + +/** + * Get the request code that caused the error. + * @return The request code causing the X error + * + * Return the X request code that caused the last X error + */ +EAPI int +ecore_x_error_request_get(void) +{ + return _error_request_code; +} /* ecore_x_error_request_get */ + +/** + * Get the error code from the error. + * @return The error code from the X error + * + * Return the error code from the last X error + */ +EAPI int +ecore_x_error_code_get(void) +{ + return _error_code; +} /* ecore_x_error_code_get */ + +void +_ecore_x_error_handler_init(void) +{ + XSetErrorHandler((XErrorHandler)_ecore_x_error_handle); + XSetIOErrorHandler((XIOErrorHandler)_ecore_x_io_error_handle); +} /* _ecore_x_error_handler_init */ + +static int +_ecore_x_error_handle(Display *d, + XErrorEvent *ev) +{ + if (d == _ecore_x_disp) + { + _error_request_code = ev->request_code; + _error_code = ev->error_code; + if (_error_func) + _error_func(_error_data); + } + return 0; +} /* _ecore_x_error_handle */ + +static int +_ecore_x_io_error_handle(Display *d) +{ + if (d == _ecore_x_disp) + { + if (_io_error_func) + _io_error_func(_io_error_data); + else + exit(-1); + } + + return 0; +} /* _ecore_x_io_error_handle */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c new file mode 100644 index 0000000..136cd63 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_events.c @@ -0,0 +1,2486 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include +#include +#include + +#include + +#include "Ecore.h" +#include "ecore_private.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include "Ecore_X_Atoms.h" + +/** OpenBSD does not define CODESET + * FIXME ?? + */ + +#ifndef CODESET +#define CODESET "INVALID" +#endif /* ifndef CODESET */ + +typedef struct _Ecore_X_Mouse_Down_Info +{ + EINA_INLIST; + int dev; + Window last_win; + Window last_last_win; + Window last_event_win; + Window last_last_event_win; + Time last_time; + Time last_last_time; + Eina_Bool did_double : 1; + Eina_Bool did_triple : 1; +} Ecore_X_Mouse_Down_Info; + +static int _ecore_x_last_event_mouse_move = 0; +static Ecore_Event *_ecore_x_last_event_mouse_move_event = NULL; +static Eina_Inlist *_ecore_x_mouse_down_info_list = NULL; + +static void +_ecore_x_mouse_down_info_clear(void) +{ + Eina_Inlist *l = _ecore_x_mouse_down_info_list; + Ecore_X_Mouse_Down_Info *info = NULL; + while (l) + { + info = EINA_INLIST_CONTAINER_GET(l, Ecore_X_Mouse_Down_Info); + l = eina_inlist_remove(l, l); + free(info); + } + _ecore_x_mouse_down_info_list = NULL; +} + +void +_ecore_x_events_init(void) +{ + //Actually, Nothing to do. +} + +void +_ecore_x_events_shutdown(void) +{ + _ecore_x_mouse_down_info_clear(); +} + +static Ecore_X_Mouse_Down_Info * +_ecore_x_mouse_down_info_get(int dev) +{ + Eina_Inlist *l = _ecore_x_mouse_down_info_list; + Ecore_X_Mouse_Down_Info *info = NULL; + + //Return the exist info + EINA_INLIST_FOREACH(l, info) + if (info->dev == dev) return info; + + //New Device. Add it. + info = calloc(1, sizeof(Ecore_X_Mouse_Down_Info)); + if (!info) return NULL; + + info->dev = dev; + l = eina_inlist_append(l, (Eina_Inlist *)info); + _ecore_x_mouse_down_info_list = l; + return info; +} + +static void +_ecore_x_event_free_mouse_move(void *data __UNUSED__, + void *ev) +{ + Ecore_Event_Mouse_Move *e; + + e = ev; + if (_ecore_x_last_event_mouse_move) + { + _ecore_x_last_event_mouse_move_event = NULL; + _ecore_x_last_event_mouse_move = 0; + } + + free(e); +} /* _ecore_x_event_free_mouse_move */ + +EAPI void +ecore_x_event_mask_set(Ecore_X_Window w, + Ecore_X_Event_Mask mask) +{ + XWindowAttributes attr; + XSetWindowAttributes s_attr; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!w) + w = DefaultRootWindow(_ecore_x_disp); + + memset(&attr, 0, sizeof(XWindowAttributes)); + XGetWindowAttributes(_ecore_x_disp, w, &attr); + s_attr.event_mask = mask | attr.your_event_mask; + XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr); +} /* ecore_x_event_mask_set */ + +EAPI void +ecore_x_event_mask_unset(Ecore_X_Window w, + Ecore_X_Event_Mask mask) +{ + XWindowAttributes attr; + XSetWindowAttributes s_attr; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!w) + w = DefaultRootWindow(_ecore_x_disp); + + memset(&attr, 0, sizeof(XWindowAttributes)); + XGetWindowAttributes(_ecore_x_disp, w, &attr); + s_attr.event_mask = attr.your_event_mask & ~mask; + XChangeWindowAttributes(_ecore_x_disp, w, CWEventMask, &s_attr); +} /* ecore_x_event_mask_unset */ + +static void +_ecore_x_event_free_xdnd_enter(void *data __UNUSED__, + void *ev) +{ + Ecore_X_Event_Xdnd_Enter *e; + int i; + + e = ev; + for (i = 0; i < e->num_types; i++) + XFree(e->types[i]); + free(e->types); + free(e); +} /* _ecore_x_event_free_xdnd_enter */ + +static void +_ecore_x_event_free_selection_notify(void *data __UNUSED__, + void *ev) +{ + Ecore_X_Event_Selection_Notify *e; + Ecore_X_Selection_Data *sel; + + e = ev; + sel = e->data; + if (sel->free) + sel->free(sel); + + free(e->target); + free(e); +} /* _ecore_x_event_free_selection_notify */ + +static unsigned int +_ecore_x_event_modifiers(unsigned int state) +{ + unsigned int modifiers = 0; + + if (state & ECORE_X_MODIFIER_SHIFT) + modifiers |= ECORE_EVENT_MODIFIER_SHIFT; + + if (state & ECORE_X_MODIFIER_CTRL) + modifiers |= ECORE_EVENT_MODIFIER_CTRL; + + if (state & ECORE_X_MODIFIER_ALT) + modifiers |= ECORE_EVENT_MODIFIER_ALT; + + if (state & ECORE_X_MODIFIER_WIN) + modifiers |= ECORE_EVENT_MODIFIER_WIN; + + if (state & ECORE_X_LOCK_SCROLL) + modifiers |= ECORE_EVENT_LOCK_SCROLL; + + if (state & ECORE_X_LOCK_NUM) + modifiers |= ECORE_EVENT_LOCK_NUM; + + if (state & ECORE_X_LOCK_CAPS) + modifiers |= ECORE_EVENT_LOCK_CAPS; + + if (state & ECORE_X_LOCK_SHIFT) + modifiers |= ECORE_EVENT_LOCK_SHIFT; + + return modifiers; +} /* _ecore_x_event_modifiers */ + +void +_ecore_mouse_move(unsigned int timestamp, + unsigned int xmodifiers, + int x, + int y, + int x_root, + int y_root, + unsigned int event_window, + unsigned int window, + unsigned int root_win, + int same_screen, + int dev, + double radx, + double rady, + double pressure, + double angle, + double mx, + double my, + double mrx, + double mry) +{ + Ecore_Event_Mouse_Move *e; + Ecore_Event *event; + + e = malloc(sizeof(Ecore_Event_Mouse_Move)); + if (!e) + return; + + e->window = window; + e->root_window = root_win; + e->timestamp = timestamp; + e->same_screen = same_screen; + e->event_window = event_window; + + e->modifiers = _ecore_x_event_modifiers(xmodifiers); + e->x = x; + e->y = y; + e->root.x = x_root; + e->root.y = y_root; + + e->multi.device = dev; + e->multi.radius = (radx + rady) / 2; + e->multi.radius_x = radx; + e->multi.radius_y = rady; + e->multi.pressure = pressure; + e->multi.angle = angle; + e->multi.x = mx; + e->multi.y = my; + e->multi.root.x = mrx; + e->multi.root.y = mry; + + event = ecore_event_add(ECORE_EVENT_MOUSE_MOVE, + e, + _ecore_x_event_free_mouse_move, + NULL); + + _ecore_x_event_last_time = timestamp; + _ecore_x_event_last_win = window; + _ecore_x_event_last_root_x = x_root; + _ecore_x_event_last_root_y = y_root; + + _ecore_x_last_event_mouse_move_event = event; +} /* _ecore_mouse_move */ + +static void +_ecore_key_press(int event, + XKeyEvent *xevent) +{ + Ecore_Event_Key *e; + char *compose = NULL; + char *tmp = NULL; + char *keyname; + char *key; + char keyname_buffer[256]; + char compose_buffer[256]; + KeySym sym; + XComposeStatus status; + int val; + + _ecore_x_last_event_mouse_move = 0; + keyname = XKeysymToString(XKeycodeToKeysym(xevent->display, + xevent->keycode, 0)); + if (!keyname) + { + snprintf(keyname_buffer, + sizeof(keyname_buffer), + "Keycode-%i", + xevent->keycode); + keyname = keyname_buffer; + } + + sym = 0; + key = NULL; + compose = NULL; + val = XLookupString(xevent, + compose_buffer, + sizeof(compose_buffer), + &sym, + &status); + if (val > 0) + { + compose_buffer[val] = 0; + compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", + compose_buffer); + if (!compose) + ERR("Ecore_X cannot convert input key string '%s' to UTF-8. " + "Is Eina built with iconv support?", compose_buffer); + tmp = compose; + } + + key = XKeysymToString(sym); + if (!key) + key = keyname; + + e = + malloc(sizeof(Ecore_Event_Key) + strlen(key) + strlen(keyname) + + (compose ? strlen(compose) : 0) + 3); + if (!e) + goto on_error; + + e->keyname = (char *)(e + 1); + e->key = e->keyname + strlen(keyname) + 1; + e->compose = (compose) ? e->key + strlen(key) + 1 : NULL; + e->string = e->compose; + + strcpy((char *)e->keyname, keyname); + strcpy((char *)e->key, key); + if (compose) + strcpy((char *)e->compose, compose); + + e->modifiers = _ecore_x_event_modifiers(xevent->state); + + e->timestamp = xevent->time; + e->window = xevent->subwindow ? xevent->subwindow : xevent->window; + e->event_window = xevent->window; + e->same_screen = xevent->same_screen; + e->root_window = xevent->root; + + ecore_event_add(event, e, NULL, NULL); + + _ecore_x_event_last_time = e->timestamp; + +on_error: + if (tmp) + free(tmp); +} /* _ecore_key_press */ + +Ecore_Event_Mouse_Button * +_ecore_mouse_button(int event, + unsigned int timestamp, + unsigned int xmodifiers, + unsigned int buttons, + int x, + int y, + int x_root, + int y_root, + unsigned int event_window, + unsigned int window, + unsigned int root_win, + int same_screen, + int dev, + double radx, + double rady, + double pressure, + double angle, + double mx, + double my, + double mrx, + double mry) +{ + Ecore_Event_Mouse_Button *e; + + e = malloc(sizeof(Ecore_Event_Mouse_Button)); + if (!e) + return NULL; + + e->window = window; + e->root_window = root_win; + e->timestamp = timestamp; + e->same_screen = same_screen; + e->event_window = event_window; + + e->buttons = buttons; + e->modifiers = _ecore_x_event_modifiers(xmodifiers); + e->double_click = 0; + e->triple_click = 0; + e->x = x; + e->y = y; + e->root.x = x_root; + e->root.y = y_root; + + Ecore_X_Mouse_Down_Info *down_info = _ecore_x_mouse_down_info_get(dev); + + if (down_info) + { + if ((event == ECORE_EVENT_MOUSE_BUTTON_DOWN) && + down_info->did_triple) + { + down_info->last_win = 0; + down_info->last_last_win = 0; + down_info->last_event_win = 0; + down_info->last_last_event_win = 0; + down_info->last_time = 0; + down_info->last_last_time = 0; + } + if (event_window == window) + { + if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) + { + //Check Double Clicked + if (((int)(timestamp - down_info->last_time) <= + (int)(1000 * _ecore_x_double_click_time)) && + (window == down_info->last_win) && + (event_window == down_info->last_event_win)) + { + e->double_click = 1; + down_info->did_double = EINA_TRUE; + } + else + { + down_info->did_double = EINA_FALSE; + down_info->did_triple = EINA_FALSE; + } + + //Check Triple Clicked + if (((int)(timestamp - down_info->last_last_time) <= + (int)(2 * 1000 * _ecore_x_double_click_time)) && + (window == down_info->last_win) && + (window == down_info->last_last_win) && + (event_window == down_info->last_event_win) && + (event_window == down_info->last_last_event_win) + ) + { + e->triple_click = 1; + down_info->did_triple = EINA_TRUE; + } + else + { + down_info->did_triple = EINA_FALSE; + } + } + else + { + if (down_info->did_double) + e->double_click = 1; + if (down_info->did_triple) + e->triple_click = 1; + } + } + } + + /* NB: Block commented out as _ecore_x_mouse_up_count appears to have + * no use. The variable is also commented out above. This code block is + * the only place that this variable is used, and appears to serve no + * purpose. - dh + if (event == ECORE_EVENT_MOUSE_BUTTON_DOWN + && !e->double_click + && !e->triple_click) + _ecore_x_mouse_up_count = 0; + */ + + e->multi.device = dev; + e->multi.radius = (radx + rady) / 2; + e->multi.radius_x = radx; + e->multi.radius_y = rady; + e->multi.pressure = pressure; + e->multi.angle = angle; + e->multi.x = mx; + e->multi.y = my; + e->multi.root.x = mrx; + e->multi.root.y = mry; + + _ecore_x_event_last_time = e->timestamp; + _ecore_x_event_last_win = e->window; + _ecore_x_event_last_root_x = x_root; + _ecore_x_event_last_root_y = y_root; + + ecore_event_add(event, e, NULL, NULL); + + if ((down_info) && + (event == ECORE_EVENT_MOUSE_BUTTON_DOWN) && + (window == event_window) && + (!down_info->did_triple)) + { + down_info->last_last_win = down_info->last_win; + down_info->last_win = window; + down_info->last_last_event_win = down_info->last_event_win; + down_info->last_event_win = event_window; + down_info->last_last_time = down_info->last_time; + down_info->last_time = timestamp; + } + + return e; +} /* _ecore_mouse_button */ + +void +_ecore_x_event_handle_any_event(XEvent *xevent) +{ + XEvent *ev = malloc(sizeof(XEvent)); + if (!ev) return; + memcpy(ev, xevent, sizeof(XEvent)); + ecore_event_add(ECORE_X_EVENT_ANY, ev, NULL, NULL); +} /* _ecore_x_event_handle_any_event */ + +void +_ecore_x_event_handle_key_press(XEvent *xevent) +{ + _ecore_key_press(ECORE_EVENT_KEY_DOWN, (XKeyEvent *)xevent); +} /* _ecore_x_event_handle_key_press */ + +void +_ecore_x_event_handle_key_release(XEvent *xevent) +{ + _ecore_key_press(ECORE_EVENT_KEY_UP, (XKeyEvent *)xevent); +} /* _ecore_x_event_handle_key_release */ + +void +_ecore_x_event_handle_button_press(XEvent *xevent) +{ + int i; + + _ecore_x_last_event_mouse_move = 0; + if ((xevent->xbutton.button > 3) && (xevent->xbutton.button < 8)) + { + Ecore_Event_Mouse_Wheel *e; + + e = malloc(sizeof(Ecore_Event_Mouse_Wheel)); + if (!e) + return; + + e->timestamp = xevent->xbutton.time; + e->modifiers = _ecore_x_event_modifiers(xevent->xbutton.state); + switch (xevent->xbutton.button) + { + case 4: e->direction = 0; e->z = -1; break; + + case 5: e->direction = 0; e->z = 1; break; + + case 6: e->direction = 1; e->z = -1; break; + + case 7: e->direction = 1; e->z = 1; break; + + default: e->direction = 0; e->z = 0; break; + } /* switch */ + + e->x = xevent->xbutton.x; + e->y = xevent->xbutton.y; + e->root.x = xevent->xbutton.x_root; + e->root.y = xevent->xbutton.y_root; + + if (xevent->xbutton.subwindow) + e->window = xevent->xbutton.subwindow; + else + e->window = xevent->xbutton.window; + + e->event_window = xevent->xbutton.window; + e->same_screen = xevent->xbutton.same_screen; + e->root_window = xevent->xbutton.root; + + _ecore_x_event_last_time = e->timestamp; + _ecore_x_event_last_win = e->window; + _ecore_x_event_last_root_x = xevent->xbutton.x_root; + _ecore_x_event_last_root_y = xevent->xbutton.y_root; + ecore_event_add(ECORE_EVENT_MOUSE_WHEEL, e, NULL, NULL); + + for (i = 0; i < _ecore_window_grabs_num; i++) + { + if ((_ecore_window_grabs[i] == xevent->xbutton.window) || + (_ecore_window_grabs[i] == xevent->xbutton.subwindow)) + { + Eina_Bool replay = EINA_FALSE; + + if (_ecore_window_grab_replay_func) + replay = _ecore_window_grab_replay_func( + _ecore_window_grab_replay_data, + ECORE_EVENT_MOUSE_WHEEL, + e); + + if (replay) + XAllowEvents(xevent->xbutton.display, + ReplayPointer, xevent->xbutton.time); + else + XAllowEvents(xevent->xbutton.display, + AsyncPointer, xevent->xbutton.time); + + break; + } + } + } + else + { + { + _ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state, + xevent->xbutton.x, xevent->xbutton.y, + xevent->xbutton.x_root, xevent->xbutton.y_root, + xevent->xbutton.window, + (xevent->xbutton.subwindow ? xevent->xbutton. + subwindow : xevent->xbutton.window), + xevent->xbutton.root, + xevent->xbutton.same_screen, + 0, 1, 1, + 1.0, // pressure + 0.0, // angle + xevent->xbutton.x, xevent->xbutton.y, + xevent->xbutton.x_root, xevent->xbutton.y_root); + } + { + Ecore_Event_Mouse_Button *e; + int event_window; + int window; + + window = + (xevent->xbutton.subwindow ? xevent->xbutton.subwindow : xevent-> + xbutton.window); + event_window = xevent->xbutton.window; + + e = _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_DOWN, + xevent->xbutton.time, + xevent->xbutton.state, + xevent->xbutton.button, + xevent->xbutton.x, + xevent->xbutton.y, + xevent->xbutton.x_root, + xevent->xbutton.y_root, + event_window, + window, + xevent->xbutton.root, + xevent->xbutton.same_screen, + 0, + 1, + 1, + 1.0, +// pressure + 0.0, +// angle + xevent->xbutton.x, + xevent->xbutton.y, + xevent->xbutton.x_root, + xevent->xbutton.y_root); + if (e) + for (i = 0; i < _ecore_window_grabs_num; i++) + { + if ((_ecore_window_grabs[i] == xevent->xbutton.window) || + (_ecore_window_grabs[i] == xevent->xbutton.subwindow)) + { + Eina_Bool replay = EINA_FALSE; + + if (_ecore_window_grab_replay_func) + replay = _ecore_window_grab_replay_func( + _ecore_window_grab_replay_data, + ECORE_EVENT_MOUSE_BUTTON_DOWN, + e); + + if (replay) + XAllowEvents(xevent->xbutton.display, + ReplayPointer, xevent->xbutton.time); + else + XAllowEvents(xevent->xbutton.display, + AsyncPointer, xevent->xbutton.time); + + break; + } + } + } + } +} /* _ecore_x_event_handle_button_press */ + +void +_ecore_x_event_handle_button_release(XEvent *xevent) +{ + _ecore_x_last_event_mouse_move = 0; + /* filter out wheel buttons */ + if ((xevent->xbutton.button <= 3) || (xevent->xbutton.button > 7)) + { + _ecore_mouse_move(xevent->xbutton.time, xevent->xbutton.state, + xevent->xbutton.x, xevent->xbutton.y, + xevent->xbutton.x_root, xevent->xbutton.y_root, + xevent->xbutton.window, + (xevent->xbutton.subwindow ? xevent->xbutton. + subwindow : xevent->xbutton.window), + xevent->xbutton.root, + xevent->xbutton.same_screen, + 0, 1, 1, + 1.0, // pressure + 0.0, // angle + xevent->xbutton.x, xevent->xbutton.y, + xevent->xbutton.x_root, xevent->xbutton.y_root); + + _ecore_mouse_button(ECORE_EVENT_MOUSE_BUTTON_UP, + xevent->xbutton.time, xevent->xbutton.state, + xevent->xbutton.button, + xevent->xbutton.x, xevent->xbutton.y, + xevent->xbutton.x_root, xevent->xbutton.y_root, + xevent->xbutton.window, + (xevent->xbutton.subwindow ? xevent->xbutton. + subwindow : xevent->xbutton.window), + xevent->xbutton.root, + xevent->xbutton.same_screen, + 0, 1, 1, + 1.0, // pressure + 0.0, // angle + xevent->xbutton.x, xevent->xbutton.y, + xevent->xbutton.x_root, xevent->xbutton.y_root); + } +} /* _ecore_x_event_handle_button_release */ + +void +_ecore_x_event_handle_motion_notify(XEvent *xevent) +{ +/* + if (_ecore_x_last_event_mouse_move) + { + ecore_event_del(_ecore_x_last_event_mouse_move_event); + _ecore_x_last_event_mouse_move = 0; + _ecore_x_last_event_mouse_move_event = NULL; + } + */ + _ecore_mouse_move(xevent->xmotion.time, xevent->xmotion.state, + xevent->xmotion.x, xevent->xmotion.y, + xevent->xmotion.x_root, xevent->xmotion.y_root, + xevent->xmotion.window, + (xevent->xmotion.subwindow ? xevent->xmotion.subwindow : + xevent->xmotion.window), + xevent->xmotion.root, + xevent->xmotion.same_screen, + 0, 1, 1, + 1.0, // pressure + 0.0, // angle + xevent->xmotion.x, xevent->xmotion.y, + xevent->xmotion.x_root, xevent->xmotion.y_root); + + _ecore_x_last_event_mouse_move = 1; + + /* Xdnd handling */ + _ecore_x_dnd_drag(xevent->xmotion.root, + xevent->xmotion.x_root, + xevent->xmotion.y_root); +} /* _ecore_x_event_handle_motion_notify */ + +void +_ecore_x_event_handle_enter_notify(XEvent *xevent) +{ + _ecore_x_last_event_mouse_move = 0; + { + _ecore_mouse_move(xevent->xcrossing.time, xevent->xcrossing.state, + xevent->xcrossing.x, xevent->xcrossing.y, + xevent->xcrossing.x_root, xevent->xcrossing.y_root, + xevent->xcrossing.window, + (xevent->xcrossing.subwindow ? xevent->xcrossing. + subwindow : xevent->xcrossing.window), + xevent->xcrossing.root, + xevent->xcrossing.same_screen, + 0, 1, 1, + 1.0, // pressure + 0.0, // angle + xevent->xcrossing.x, xevent->xcrossing.y, + xevent->xcrossing.x_root, xevent->xcrossing.y_root); + } + { + Ecore_X_Event_Mouse_In *e; + + e = calloc(1, sizeof(Ecore_X_Event_Mouse_In)); + if (!e) + return; + + e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state); + e->x = xevent->xcrossing.x; + e->y = xevent->xcrossing.y; + e->root.x = xevent->xcrossing.x_root; + e->root.y = xevent->xcrossing.y_root; + if (xevent->xcrossing.subwindow) + e->win = xevent->xcrossing.subwindow; + else + e->win = xevent->xcrossing.window; + + e->same_screen = xevent->xcrossing.same_screen; + e->root_win = xevent->xcrossing.root; + e->event_win = xevent->xcrossing.window; + + if (xevent->xcrossing.mode == NotifyNormal) + e->mode = ECORE_X_EVENT_MODE_NORMAL; + else if (xevent->xcrossing.mode == NotifyGrab) + e->mode = ECORE_X_EVENT_MODE_GRAB; + else if (xevent->xcrossing.mode == NotifyUngrab) + e->mode = ECORE_X_EVENT_MODE_UNGRAB; + + if (xevent->xcrossing.detail == NotifyAncestor) + e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR; + else if (xevent->xcrossing.detail == NotifyVirtual) + e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL; + else if (xevent->xcrossing.detail == NotifyInferior) + e->detail = ECORE_X_EVENT_DETAIL_INFERIOR; + else if (xevent->xcrossing.detail == NotifyNonlinear) + e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR; + else if (xevent->xcrossing.detail == NotifyNonlinearVirtual) + e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL; + + e->time = xevent->xcrossing.time; + _ecore_x_event_last_time = e->time; + ecore_event_add(ECORE_X_EVENT_MOUSE_IN, e, NULL, NULL); + } +} /* _ecore_x_event_handle_enter_notify */ + +void +_ecore_x_event_handle_leave_notify(XEvent *xevent) +{ + _ecore_x_last_event_mouse_move = 0; + { + _ecore_mouse_move(xevent->xcrossing.time, xevent->xcrossing.state, + xevent->xcrossing.x, xevent->xcrossing.y, + xevent->xcrossing.x_root, xevent->xcrossing.y_root, + xevent->xcrossing.window, + (xevent->xcrossing.subwindow ? xevent->xcrossing. + subwindow : xevent->xcrossing.window), + xevent->xcrossing.root, + xevent->xcrossing.same_screen, + 0, 1, 1, + 1.0, // pressure + 0.0, // angle + xevent->xcrossing.x, xevent->xcrossing.y, + xevent->xcrossing.x_root, xevent->xcrossing.y_root); + } + { + Ecore_X_Event_Mouse_Out *e; + + e = calloc(1, sizeof(Ecore_X_Event_Mouse_Out)); + if (!e) + return; + + e->modifiers = _ecore_x_event_modifiers(xevent->xcrossing.state); + e->x = xevent->xcrossing.x; + e->y = xevent->xcrossing.y; + e->root.x = xevent->xcrossing.x_root; + e->root.y = xevent->xcrossing.y_root; + if (xevent->xcrossing.subwindow) + e->win = xevent->xcrossing.subwindow; + else + e->win = xevent->xcrossing.window; + + e->same_screen = xevent->xcrossing.same_screen; + e->root_win = xevent->xcrossing.root; + e->event_win = xevent->xcrossing.window; + + if (xevent->xcrossing.mode == NotifyNormal) + e->mode = ECORE_X_EVENT_MODE_NORMAL; + else if (xevent->xcrossing.mode == NotifyGrab) + e->mode = ECORE_X_EVENT_MODE_GRAB; + else if (xevent->xcrossing.mode == NotifyUngrab) + e->mode = ECORE_X_EVENT_MODE_UNGRAB; + + if (xevent->xcrossing.detail == NotifyAncestor) + e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR; + else if (xevent->xcrossing.detail == NotifyVirtual) + e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL; + else if (xevent->xcrossing.detail == NotifyInferior) + e->detail = ECORE_X_EVENT_DETAIL_INFERIOR; + else if (xevent->xcrossing.detail == NotifyNonlinear) + e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR; + else if (xevent->xcrossing.detail == NotifyNonlinearVirtual) + e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL; + + e->time = xevent->xcrossing.time; + _ecore_x_event_last_time = e->time; + _ecore_x_event_last_win = e->win; + _ecore_x_event_last_root_x = e->root.x; + _ecore_x_event_last_root_y = e->root.y; + ecore_event_add(ECORE_X_EVENT_MOUSE_OUT, e, NULL, NULL); + } +} /* _ecore_x_event_handle_leave_notify */ + +void +_ecore_x_event_handle_focus_in(XEvent *xevent) +{ + Ecore_X_Event_Window_Focus_In *e; + + _ecore_x_last_event_mouse_move = 0; + + e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_In)); + if (!e) + return; + + e->win = xevent->xfocus.window; + + if (xevent->xfocus.mode == NotifyNormal) + e->mode = ECORE_X_EVENT_MODE_NORMAL; + else if (xevent->xfocus.mode == NotifyWhileGrabbed) + e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED; + else if (xevent->xfocus.mode == NotifyGrab) + e->mode = ECORE_X_EVENT_MODE_GRAB; + else if (xevent->xfocus.mode == NotifyUngrab) + e->mode = ECORE_X_EVENT_MODE_UNGRAB; + + if (xevent->xfocus.detail == NotifyAncestor) + e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR; + else if (xevent->xfocus.detail == NotifyVirtual) + e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL; + else if (xevent->xfocus.detail == NotifyInferior) + e->detail = ECORE_X_EVENT_DETAIL_INFERIOR; + else if (xevent->xfocus.detail == NotifyNonlinear) + e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR; + else if (xevent->xfocus.detail == NotifyNonlinearVirtual) + e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL; + else if (xevent->xfocus.detail == NotifyPointer) + e->detail = ECORE_X_EVENT_DETAIL_POINTER; + else if (xevent->xfocus.detail == NotifyPointerRoot) + e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT; + else if (xevent->xfocus.detail == NotifyDetailNone) + e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE; + + e->time = _ecore_x_event_last_time; + _ecore_x_event_last_time = e->time; + ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL); +} /* _ecore_x_event_handle_focus_in */ + +void +_ecore_x_event_handle_focus_out(XEvent *xevent) +{ + Ecore_X_Event_Window_Focus_Out *e; + + _ecore_x_last_event_mouse_move = 0; + + e = calloc(1, sizeof(Ecore_X_Event_Window_Focus_Out)); + if (!e) + return; + + e->win = xevent->xfocus.window; + + if (xevent->xfocus.mode == NotifyNormal) + e->mode = ECORE_X_EVENT_MODE_NORMAL; + else if (xevent->xfocus.mode == NotifyWhileGrabbed) + e->mode = ECORE_X_EVENT_MODE_WHILE_GRABBED; + else if (xevent->xfocus.mode == NotifyGrab) + e->mode = ECORE_X_EVENT_MODE_GRAB; + else if (xevent->xfocus.mode == NotifyUngrab) + e->mode = ECORE_X_EVENT_MODE_UNGRAB; + + if (xevent->xfocus.detail == NotifyAncestor) + e->detail = ECORE_X_EVENT_DETAIL_ANCESTOR; + else if (xevent->xfocus.detail == NotifyVirtual) + e->detail = ECORE_X_EVENT_DETAIL_VIRTUAL; + else if (xevent->xfocus.detail == NotifyInferior) + e->detail = ECORE_X_EVENT_DETAIL_INFERIOR; + else if (xevent->xfocus.detail == NotifyNonlinear) + e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR; + else if (xevent->xfocus.detail == NotifyNonlinearVirtual) + e->detail = ECORE_X_EVENT_DETAIL_NON_LINEAR_VIRTUAL; + else if (xevent->xfocus.detail == NotifyPointer) + e->detail = ECORE_X_EVENT_DETAIL_POINTER; + else if (xevent->xfocus.detail == NotifyPointerRoot) + e->detail = ECORE_X_EVENT_DETAIL_POINTER_ROOT; + else if (xevent->xfocus.detail == NotifyDetailNone) + e->detail = ECORE_X_EVENT_DETAIL_DETAIL_NONE; + + e->time = _ecore_x_event_last_time; + _ecore_x_event_last_time = e->time; + ecore_event_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL); +} /* _ecore_x_event_handle_focus_out */ + +void +_ecore_x_event_handle_keymap_notify(XEvent *xevent __UNUSED__) +{ + _ecore_x_last_event_mouse_move = 0; + /* FIXME: handle this event type */ +} /* _ecore_x_event_handle_keymap_notify */ + +void +_ecore_x_event_handle_expose(XEvent *xevent) +{ + Ecore_X_Event_Window_Damage *e; + + _ecore_x_last_event_mouse_move = 0; + e = calloc(1, sizeof(Ecore_X_Event_Window_Damage)); + if (!e) + return; + + e->win = xevent->xexpose.window; + e->time = _ecore_x_event_last_time; + e->x = xevent->xexpose.x; + e->y = xevent->xexpose.y; + e->w = xevent->xexpose.width; + e->h = xevent->xexpose.height; + e->count = xevent->xexpose.count; + ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL); +} /* _ecore_x_event_handle_expose */ + +void +_ecore_x_event_handle_graphics_expose(XEvent *xevent) +{ + Ecore_X_Event_Window_Damage *e; + + _ecore_x_last_event_mouse_move = 0; + e = calloc(1, sizeof(Ecore_X_Event_Window_Damage)); + if (!e) + return; + + e->win = xevent->xgraphicsexpose.drawable; + e->time = _ecore_x_event_last_time; + e->x = xevent->xgraphicsexpose.x; + e->y = xevent->xgraphicsexpose.y; + e->w = xevent->xgraphicsexpose.width; + e->h = xevent->xgraphicsexpose.height; + e->count = xevent->xgraphicsexpose.count; + ecore_event_add(ECORE_X_EVENT_WINDOW_DAMAGE, e, NULL, NULL); +} /* _ecore_x_event_handle_graphics_expose */ + +void +_ecore_x_event_handle_visibility_notify(XEvent *xevent) +{ + _ecore_x_last_event_mouse_move = 0; +// if (xevent->xvisibility.state != VisibilityPartiallyObscured) + { + Ecore_X_Event_Window_Visibility_Change *e; + + e = calloc(1, sizeof(Ecore_X_Event_Window_Visibility_Change)); + if (!e) + return; + + e->win = xevent->xvisibility.window; + e->time = _ecore_x_event_last_time; + if (xevent->xvisibility.state == VisibilityFullyObscured) + e->fully_obscured = 1; + else + e->fully_obscured = 0; + + ecore_event_add(ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE, e, NULL, NULL); + } +} /* _ecore_x_event_handle_visibility_notify */ + +void +_ecore_x_event_handle_create_notify(XEvent *xevent) +{ + Ecore_X_Event_Window_Create *e; + + _ecore_x_last_event_mouse_move = 0; + e = calloc(1, sizeof(Ecore_X_Event_Window_Create)); + if (!e) + return; + + e->win = xevent->xcreatewindow.window; + e->parent = xevent->xcreatewindow.parent; + if (xevent->xcreatewindow.override_redirect) + e->override = 1; + else + e->override = 0; + + e->x = xevent->xcreatewindow.x; + e->y = xevent->xcreatewindow.y; + e->w = xevent->xcreatewindow.width; + e->h = xevent->xcreatewindow.height; + e->border = xevent->xcreatewindow.border_width; + e->time = _ecore_x_event_last_time; + ecore_event_add(ECORE_X_EVENT_WINDOW_CREATE, e, NULL, NULL); +} /* _ecore_x_event_handle_create_notify */ + +void +_ecore_x_event_handle_destroy_notify(XEvent *xevent) +{ + Ecore_X_Event_Window_Destroy *e; + + _ecore_x_last_event_mouse_move = 0; + e = calloc(1, sizeof(Ecore_X_Event_Window_Destroy)); + if (!e) + return; + + e->win = xevent->xdestroywindow.window; + e->event_win = xevent->xdestroywindow.event; + e->time = _ecore_x_event_last_time; + if (e->win == _ecore_x_event_last_win) + _ecore_x_event_last_win = 0; + + ecore_event_add(ECORE_X_EVENT_WINDOW_DESTROY, e, NULL, NULL); +} /* _ecore_x_event_handle_destroy_notify */ + +void +_ecore_x_event_handle_unmap_notify(XEvent *xevent) +{ + Ecore_X_Event_Window_Hide *e; + + _ecore_x_last_event_mouse_move = 0; + e = calloc(1, sizeof(Ecore_X_Event_Window_Hide)); + if (!e) + return; + + e->win = xevent->xunmap.window; + e->event_win = xevent->xunmap.event; + e->time = _ecore_x_event_last_time; + ecore_event_add(ECORE_X_EVENT_WINDOW_HIDE, e, NULL, NULL); +} /* _ecore_x_event_handle_unmap_notify */ + +void +_ecore_x_event_handle_map_notify(XEvent *xevent) +{ + Ecore_X_Event_Window_Show *e; + + _ecore_x_last_event_mouse_move = 0; + e = calloc(1, sizeof(Ecore_X_Event_Window_Show)); + if (!e) + return; + + e->win = xevent->xmap.window; + e->event_win = xevent->xmap.event; + e->time = _ecore_x_event_last_time; + ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW, e, NULL, NULL); +} /* _ecore_x_event_handle_map_notify */ + +void +_ecore_x_event_handle_map_request(XEvent *xevent) +{ + Ecore_X_Event_Window_Show_Request *e; + + _ecore_x_last_event_mouse_move = 0; + e = calloc(1, sizeof(Ecore_X_Event_Window_Show_Request)); + if (!e) + return; + + e->win = xevent->xmaprequest.window; + e->time = _ecore_x_event_last_time; + e->parent = xevent->xmaprequest.parent; + ecore_event_add(ECORE_X_EVENT_WINDOW_SHOW_REQUEST, e, NULL, NULL); +} /* _ecore_x_event_handle_map_request */ + +void +_ecore_x_event_handle_reparent_notify(XEvent *xevent) +{ + Ecore_X_Event_Window_Reparent *e; + + _ecore_x_last_event_mouse_move = 0; + e = calloc(1, sizeof(Ecore_X_Event_Window_Reparent)); + if (!e) + return; + + e->win = xevent->xreparent.window; + e->event_win = xevent->xreparent.event; + e->parent = xevent->xreparent.parent; + e->time = _ecore_x_event_last_time; + ecore_event_add(ECORE_X_EVENT_WINDOW_REPARENT, e, NULL, NULL); +} /* _ecore_x_event_handle_reparent_notify */ + +void +_ecore_x_event_handle_configure_notify(XEvent *xevent) +{ + Ecore_X_Event_Window_Configure *e; + + _ecore_x_last_event_mouse_move = 0; + e = calloc(1, sizeof(Ecore_X_Event_Window_Configure)); + if (!e) + return; + + e->win = xevent->xconfigure.window; + e->event_win = xevent->xconfigure.event; + e->abovewin = xevent->xconfigure.above; + e->x = xevent->xconfigure.x; + e->y = xevent->xconfigure.y; + e->w = xevent->xconfigure.width; + e->h = xevent->xconfigure.height; + e->border = xevent->xconfigure.border_width; + e->override = xevent->xconfigure.override_redirect; + e->from_wm = xevent->xconfigure.send_event; + e->time = _ecore_x_event_last_time; + ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE, e, NULL, NULL); +} /* _ecore_x_event_handle_configure_notify */ + +void +_ecore_x_event_handle_configure_request(XEvent *xevent) +{ + Ecore_X_Event_Window_Configure_Request *e; + + _ecore_x_last_event_mouse_move = 0; + e = calloc(1, sizeof(Ecore_X_Event_Window_Configure_Request)); + if (!e) + return; + + e->win = xevent->xconfigurerequest.window; + e->parent_win = xevent->xconfigurerequest.parent; + e->abovewin = xevent->xconfigurerequest.above; + e->x = xevent->xconfigurerequest.x; + e->y = xevent->xconfigurerequest.y; + e->w = xevent->xconfigurerequest.width; + e->h = xevent->xconfigurerequest.height; + e->border = xevent->xconfigurerequest.border_width; + e->value_mask = xevent->xconfigurerequest.value_mask; + e->time = _ecore_x_event_last_time; + + if (xevent->xconfigurerequest.detail == Above) + e->detail = ECORE_X_WINDOW_STACK_ABOVE; + else if (xevent->xconfigurerequest.detail == Below) + e->detail = ECORE_X_WINDOW_STACK_BELOW; + else if (xevent->xconfigurerequest.detail == TopIf) + e->detail = ECORE_X_WINDOW_STACK_TOP_IF; + else if (xevent->xconfigurerequest.detail == BottomIf) + e->detail = ECORE_X_WINDOW_STACK_BOTTOM_IF; + else if (xevent->xconfigurerequest.detail == Opposite) + e->detail = ECORE_X_WINDOW_STACK_OPPOSITE; + + ecore_event_add(ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST, e, NULL, NULL); +} /* _ecore_x_event_handle_configure_request */ + +void +_ecore_x_event_handle_gravity_notify(XEvent *xevent __UNUSED__) +{ + _ecore_x_last_event_mouse_move = 0; + /* FIXME: handle this event type */ +} /* _ecore_x_event_handle_gravity_notify */ + +void +_ecore_x_event_handle_resize_request(XEvent *xevent) +{ + Ecore_X_Event_Window_Resize_Request *e; + + _ecore_x_last_event_mouse_move = 0; + e = calloc(1, sizeof(Ecore_X_Event_Window_Resize_Request)); + if (!e) + return; + + e->win = xevent->xresizerequest.window; + e->w = xevent->xresizerequest.width; + e->h = xevent->xresizerequest.height; + e->time = _ecore_x_event_last_time; + ecore_event_add(ECORE_X_EVENT_WINDOW_RESIZE_REQUEST, e, NULL, NULL); +} /* _ecore_x_event_handle_resize_request */ + +void +_ecore_x_event_handle_circulate_notify(XEvent *xevent) +{ + Ecore_X_Event_Window_Stack *e; + + _ecore_x_last_event_mouse_move = 0; + e = calloc(1, sizeof(Ecore_X_Event_Window_Stack)); + if (!e) + return; + + e->win = xevent->xcirculate.window; + e->event_win = xevent->xcirculate.event; + if (xevent->xcirculate.place == PlaceOnTop) + e->detail = ECORE_X_WINDOW_STACK_ABOVE; + else + e->detail = ECORE_X_WINDOW_STACK_BELOW; + + e->time = _ecore_x_event_last_time; + ecore_event_add(ECORE_X_EVENT_WINDOW_STACK, e, NULL, NULL); +} /* _ecore_x_event_handle_circulate_notify */ + +void +_ecore_x_event_handle_circulate_request(XEvent *xevent) +{ + Ecore_X_Event_Window_Stack_Request *e; + + _ecore_x_last_event_mouse_move = 0; + e = calloc(1, sizeof(Ecore_X_Event_Window_Stack_Request)); + if (!e) + return; + + e->win = xevent->xcirculaterequest.window; + e->parent = xevent->xcirculaterequest.parent; + if (xevent->xcirculaterequest.place == PlaceOnTop) + e->detail = ECORE_X_WINDOW_STACK_ABOVE; + else + e->detail = ECORE_X_WINDOW_STACK_BELOW; + + e->time = _ecore_x_event_last_time; + ecore_event_add(ECORE_X_EVENT_WINDOW_STACK_REQUEST, e, NULL, NULL); +} /* _ecore_x_event_handle_circulate_request */ + +void +_ecore_x_event_handle_property_notify(XEvent *xevent) +{ + _ecore_x_last_event_mouse_move = 0; + { + Ecore_X_Event_Window_Property *e; + + e = calloc(1, sizeof(Ecore_X_Event_Window_Property)); + if (!e) + return; + + e->win = xevent->xproperty.window; + e->atom = xevent->xproperty.atom; + e->time = xevent->xproperty.time; + _ecore_x_event_last_time = e->time; + ecore_event_add(ECORE_X_EVENT_WINDOW_PROPERTY, e, NULL, NULL); + } +} /* _ecore_x_event_handle_property_notify */ + +void +_ecore_x_event_handle_selection_clear(XEvent *xevent) +{ +// Ecore_X_Selection_Intern *d; + Ecore_X_Event_Selection_Clear *e; + Ecore_X_Atom sel; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_last_event_mouse_move = 0; +/* errr..... why? paranoia. + d = _ecore_x_selection_get(xevent->xselectionclear.selection); + if (d && (xevent->xselectionclear.time > d->time)) + { + _ecore_x_selection_set(None, NULL, 0, + xevent->xselectionclear.selection); + } + */ +/* Generate event for app cleanup */ + e = malloc(sizeof(Ecore_X_Event_Selection_Clear)); + e->win = xevent->xselectionclear.window; + e->time = xevent->xselectionclear.time; + e->atom = sel = xevent->xselectionclear.selection; + if (sel == ECORE_X_ATOM_SELECTION_PRIMARY) + e->selection = ECORE_X_SELECTION_PRIMARY; + else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY) + e->selection = ECORE_X_SELECTION_SECONDARY; + else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD) + e->selection = ECORE_X_SELECTION_CLIPBOARD; + else + e->selection = ECORE_X_SELECTION_OTHER; + + ecore_event_add(ECORE_X_EVENT_SELECTION_CLEAR, e, NULL, NULL); +} /* _ecore_x_event_handle_selection_clear */ + +void +_ecore_x_event_handle_selection_request(XEvent *xevent) +{ + Ecore_X_Event_Selection_Request *e; + Ecore_X_Selection_Intern *sd; + void *data = NULL; + int len; + int typesize; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_last_event_mouse_move = 0; + /* + * Generate a selection request event. + */ + e = malloc(sizeof(Ecore_X_Event_Selection_Request)); + e->owner = xevent->xselectionrequest.owner; + e->requestor = xevent->xselectionrequest.requestor; + e->time = xevent->xselectionrequest.time; + e->selection = xevent->xselectionrequest.selection; + e->target = xevent->xselectionrequest.target; + e->property = xevent->xselectionrequest.property; + ecore_event_add(ECORE_X_EVENT_SELECTION_REQUEST, e, NULL, NULL); + + if ((sd = _ecore_x_selection_get(xevent->xselectionrequest.selection)) && + (sd->win == xevent->xselectionrequest.owner)) + { + Ecore_X_Selection_Intern *si; + + si = _ecore_x_selection_get(xevent->xselectionrequest.selection); + if (si->data) + { + Ecore_X_Atom property = None; + Ecore_X_Atom type; + + /* Set up defaults for strings first */ + type = xevent->xselectionrequest.target; + typesize = 8; + len = sd->length; + + if (!ecore_x_selection_convert(xevent->xselectionrequest.selection, + xevent->xselectionrequest.target, + &data, &len, &type, &typesize)) + /* Refuse selection, conversion to requested target failed */ + property = None; + else if (data) + { + /* FIXME: This does not properly handle large data transfers */ + ecore_x_window_prop_property_set( + xevent->xselectionrequest.requestor, + xevent->xselectionrequest. + property, + type, + typesize, + data, + len); + property = xevent->xselectionrequest.property; + free(data); + } + + ecore_x_selection_notify_send(xevent->xselectionrequest.requestor, + xevent->xselectionrequest.selection, + xevent->xselectionrequest.target, + property, + xevent->xselectionrequest.time); + } + } +} /* _ecore_x_event_handle_selection_request */ + +void +_ecore_x_event_handle_selection_notify(XEvent *xevent) +{ + Ecore_X_Event_Selection_Notify *e; + unsigned char *data = NULL; + Ecore_X_Atom selection; + int num_ret, format; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_last_event_mouse_move = 0; + selection = xevent->xselection.selection; + + if (xevent->xselection.target == ECORE_X_ATOM_SELECTION_TARGETS) + { + format = ecore_x_window_prop_property_get(xevent->xselection.requestor, + xevent->xselection.property, + XA_ATOM, 32, &data, &num_ret); + if (!format) + return; + } + else + { + format = ecore_x_window_prop_property_get(xevent->xselection.requestor, + xevent->xselection.property, + AnyPropertyType, 8, &data, + &num_ret); + if (!format) + return; + } + + e = calloc(1, sizeof(Ecore_X_Event_Selection_Notify)); + if (!e) + return; + + e->win = xevent->xselection.requestor; + e->time = xevent->xselection.time; + e->atom = selection; + e->target = _ecore_x_selection_target_get(xevent->xselection.target); + + if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) + e->selection = ECORE_X_SELECTION_PRIMARY; + else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) + e->selection = ECORE_X_SELECTION_SECONDARY; + else if (selection == ECORE_X_ATOM_SELECTION_XDND) + e->selection = ECORE_X_SELECTION_XDND; + else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) + e->selection = ECORE_X_SELECTION_CLIPBOARD; + else + e->selection = ECORE_X_SELECTION_OTHER; + + e->data = _ecore_x_selection_parse(e->target, data, num_ret, format); + + ecore_event_add(ECORE_X_EVENT_SELECTION_NOTIFY, e, + _ecore_x_event_free_selection_notify, NULL); +} /* _ecore_x_event_handle_selection_notify */ + +void +_ecore_x_event_handle_colormap_notify(XEvent *xevent) +{ + Ecore_X_Event_Window_Colormap *e; + + _ecore_x_last_event_mouse_move = 0; + e = calloc(1, sizeof(Ecore_X_Event_Window_Colormap)); + if (!e) + return; + + e->win = xevent->xcolormap.window; + e->cmap = xevent->xcolormap.colormap; + e->time = _ecore_x_event_last_time; + if (xevent->xcolormap.state == ColormapInstalled) + e->installed = EINA_TRUE; + else + e->installed = EINA_FALSE; + + ecore_event_add(ECORE_X_EVENT_WINDOW_COLORMAP, e, NULL, NULL); +} /* _ecore_x_event_handle_colormap_notify */ + +void +_ecore_x_event_handle_client_message(XEvent *xevent) +{ + _ecore_x_last_event_mouse_move = 0; + /* Special client message event handling here. need to put LOTS of if */ + /* checks here and generate synthetic events per special message known */ + /* otherwise generate generic client message event. this would handle*/ + /* netwm, ICCCM, gnomewm, old kde and mwm hint client message protocols */ + if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_PROTOCOLS) && + (xevent->xclient.format == 32) && + (xevent->xclient.data.l[0] == (long)ECORE_X_ATOM_WM_DELETE_WINDOW)) + { + Ecore_X_Event_Window_Delete_Request *e; + + e = calloc(1, sizeof(Ecore_X_Event_Window_Delete_Request)); + if (!e) + return; + + e->win = xevent->xclient.window; + e->time = _ecore_x_event_last_time; + ecore_event_add(ECORE_X_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL); + } + else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_MOVERESIZE) && + (xevent->xclient.format == 32) && +/* Ignore move and resize with keyboard */ + (xevent->xclient.data.l[2] < 9)) + { + Ecore_X_Event_Window_Move_Resize_Request *e; + + e = calloc(1, sizeof(Ecore_X_Event_Window_Move_Resize_Request)); + if (!e) + return; + + e->win = xevent->xclient.window; + e->x = xevent->xclient.data.l[0]; + e->y = xevent->xclient.data.l[1]; + e->direction = xevent->xclient.data.l[2]; + e->button = xevent->xclient.data.l[3]; + e->source = xevent->xclient.data.l[4]; + ecore_event_add(ECORE_X_EVENT_WINDOW_MOVE_RESIZE_REQUEST, e, NULL, NULL); + } + /* Xdnd Client Message Handling Begin */ + /* Message Type: XdndEnter target */ + else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_ENTER) + { + Ecore_X_Event_Xdnd_Enter *e; + Ecore_X_DND_Target *target; + + e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Enter)); + if (!e) return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + target = _ecore_x_dnd_target_get(); + target->state = ECORE_X_DND_TARGET_ENTERED; + target->source = xevent->xclient.data.l[0]; + target->win = xevent->xclient.window; + target->version = (int)(xevent->xclient.data.l[1] >> 24); + if (target->version > ECORE_X_DND_VERSION) + { + WRN("DND: Requested version %d, we only support up to %d", + target->version, ECORE_X_DND_VERSION); + free(e); + return; + } + + if (xevent->xclient.data.l[1] & 0x1UL) + { + /* source supports more than 3 types, fetch property */ + unsigned char *data; + Ecore_X_Atom *types; + int i, num_ret; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!(ecore_x_window_prop_property_get(target->source, + ECORE_X_ATOM_XDND_TYPE_LIST, + XA_ATOM, + 32, &data, &num_ret))) + { + WRN( + "DND: Could not fetch data type list from source window, aborting."); + free(e); + return; + } + + types = (Ecore_X_Atom *)data; + e->types = calloc(num_ret, sizeof(char *)); + if (e->types) + { + LOGFN(__FILE__, __LINE__, __FUNCTION__); + for (i = 0; i < num_ret; i++) + e->types[i] = XGetAtomName(_ecore_x_disp, types[i]); + } + + e->num_types = num_ret; + } + else + { + int i = 0; + + e->types = calloc(3, sizeof(char *)); + if (e->types) + { + LOGFN(__FILE__, __LINE__, __FUNCTION__); + while ((i < 3) && (xevent->xclient.data.l[i + 2])) + { + e->types[i] = XGetAtomName(_ecore_x_disp, + xevent->xclient.data.l[i + 2]); + i++; + } + } + + e->num_types = i; + } + + e->win = target->win; + e->source = target->source; + ecore_event_add(ECORE_X_EVENT_XDND_ENTER, e, + _ecore_x_event_free_xdnd_enter, NULL); + } + /* Message Type: XdndPosition target */ + else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_POSITION) + { + Ecore_X_Event_Xdnd_Position *e; + Ecore_X_DND_Target *target; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + target = _ecore_x_dnd_target_get(); + if ((target->source != (Ecore_X_Window)xevent->xclient.data.l[0]) || + (target->win != xevent->xclient.window)) + return; + + target->pos.x = xevent->xclient.data.l[2] >> 16; + target->pos.y = xevent->xclient.data.l[2] & 0xFFFFUL; + target->action = xevent->xclient.data.l[4]; /* Version 2 */ + + target->time = (target->version >= 1) ? + (Time)xevent->xclient.data.l[3] : CurrentTime; + + e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Position)); + if (!e) return; + + e->win = target->win; + e->source = target->source; + e->position.x = target->pos.x; + e->position.y = target->pos.y; + e->action = target->action; + ecore_event_add(ECORE_X_EVENT_XDND_POSITION, e, NULL, NULL); + } + /* Message Type: XdndStatus source */ + else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_STATUS) + { + Ecore_X_Event_Xdnd_Status *e; + Ecore_X_DND_Source *source; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + source = _ecore_x_dnd_source_get(); + /* Make sure source/target match */ + if ((source->win != xevent->xclient.window) || + (source->dest != (Window)xevent->xclient.data.l[0])) + return; + + source->await_status = 0; + + source->will_accept = xevent->xclient.data.l[1] & 0x1UL; + source->suppress = (xevent->xclient.data.l[1] & 0x2UL) ? 0 : 1; + + source->rectangle.x = xevent->xclient.data.l[2] >> 16; + source->rectangle.y = xevent->xclient.data.l[2] & 0xFFFFUL; + source->rectangle.width = xevent->xclient.data.l[3] >> 16; + source->rectangle.height = xevent->xclient.data.l[3] & 0xFFFFUL; + + source->accepted_action = xevent->xclient.data.l[4]; + + e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Status)); + if (!e) return; + + e->win = source->win; + e->target = source->dest; + e->will_accept = source->will_accept; + e->rectangle.x = source->rectangle.x; + e->rectangle.y = source->rectangle.y; + e->rectangle.width = source->rectangle.width; + e->rectangle.height = source->rectangle.height; + e->action = source->accepted_action; + + ecore_event_add(ECORE_X_EVENT_XDND_STATUS, e, NULL, NULL); + } + /* Message Type: XdndLeave target */ + /* Pretend the whole thing never happened, sort of */ + else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_LEAVE) + { + Ecore_X_Event_Xdnd_Leave *e; + Ecore_X_DND_Target *target; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + target = _ecore_x_dnd_target_get(); + if ((target->source != (Ecore_X_Window)xevent->xclient.data.l[0]) || + (target->win != xevent->xclient.window)) + return; + + target->state = ECORE_X_DND_TARGET_IDLE; + + e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Leave)); + if (!e) return; + + e->win = xevent->xclient.window; + e->source = (Window)xevent->xclient.data.l[0]; + ecore_event_add(ECORE_X_EVENT_XDND_LEAVE, e, NULL, NULL); + } + /* Message Type: XdndDrop target */ + else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_DROP) + { + Ecore_X_Event_Xdnd_Drop *e; + Ecore_X_DND_Target *target; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + target = _ecore_x_dnd_target_get(); + /* Match source/target */ + if ((target->source != (Window)xevent->xclient.data.l[0]) || + (target->win != xevent->xclient.window)) + return; + + target->time = (target->version >= 1) ? + (Time)xevent->xclient.data.l[2] : _ecore_x_event_last_time; + + e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Drop)); + if (!e) return; + + e->win = target->win; + e->source = target->source; + e->action = target->action; + e->position.x = target->pos.x; + e->position.y = target->pos.y; + ecore_event_add(ECORE_X_EVENT_XDND_DROP, e, NULL, NULL); + } + /* Message Type: XdndFinished source */ + else if (xevent->xclient.message_type == ECORE_X_ATOM_XDND_FINISHED) + { + Ecore_X_Event_Xdnd_Finished *e; + Ecore_X_DND_Source *source; + Eina_Bool completed = EINA_TRUE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + source = _ecore_x_dnd_source_get(); + /* Match source/target */ + if ((source->win != xevent->xclient.window) || + (source->dest != (Window)xevent->xclient.data.l[0])) + return; + + if ((source->version < 5) || (xevent->xclient.data.l[1] & 0x1UL)) + { + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* Target successfully performed drop action */ + ecore_x_selection_xdnd_clear(); + source->state = ECORE_X_DND_SOURCE_IDLE; + } + else if (source->version >= 5) + { + completed = EINA_FALSE; + source->state = ECORE_X_DND_SOURCE_CONVERTING; + + /* FIXME: Probably need to add a timer to switch back to idle + * and discard the selection data */ + } + + e = calloc(1, sizeof(Ecore_X_Event_Xdnd_Finished)); + if (!e) return; + + e->win = source->win; + e->target = source->dest; + e->completed = completed; + if (source->version >= 5) + { + source->accepted_action = xevent->xclient.data.l[2]; + e->action = source->accepted_action; + } + else + { + source->accepted_action = 0; + e->action = source->action; + } + + ecore_event_add(ECORE_X_EVENT_XDND_FINISHED, e, NULL, NULL); + } + else if (xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_STATE) + { + Ecore_X_Event_Window_State_Request *e; + + e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request)); + if (!e) return; + + e->win = xevent->xclient.window; + if (xevent->xclient.data.l[0] == 0) + e->action = ECORE_X_WINDOW_STATE_ACTION_REMOVE; + else if (xevent->xclient.data.l[0] == 1) + e->action = ECORE_X_WINDOW_STATE_ACTION_ADD; + else if (xevent->xclient.data.l[0] == 2) + e->action = ECORE_X_WINDOW_STATE_ACTION_TOGGLE; + else + { + free(e); + return; + } + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + e->state[0] = _ecore_x_netwm_state_get(xevent->xclient.data.l[1]); + if (e->state[0] == ECORE_X_WINDOW_STATE_UNKNOWN) + { +// char *name; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +// name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[1]); +// if (name) ERR("Unknown state: %s", name); +// XFree(name); + } + e->state[1] = _ecore_x_netwm_state_get(xevent->xclient.data.l[2]); + if (e->state[1] == ECORE_X_WINDOW_STATE_UNKNOWN) + { +// char *name; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + +// name = XGetAtomName(_ecore_x_disp, xevent->xclient.data.l[2]); +// if (name) ERR("Unknown state: %s", name); +// XFree(name); + } + + e->source = xevent->xclient.data.l[3]; + + ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL); + } + else if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_CHANGE_STATE) + && (xevent->xclient.format == 32) + && (xevent->xclient.data.l[0] == IconicState)) + { + Ecore_X_Event_Window_State_Request *e; + + e = calloc(1, sizeof(Ecore_X_Event_Window_State_Request)); + if (!e) + return; + + e->win = xevent->xclient.window; + e->action = ECORE_X_WINDOW_STATE_ACTION_ADD; + e->state[0] = ECORE_X_WINDOW_STATE_ICONIFIED; + + ecore_event_add(ECORE_X_EVENT_WINDOW_STATE_REQUEST, e, NULL, NULL); + } + else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_WM_DESKTOP) + && (xevent->xclient.format == 32)) + { + Ecore_X_Event_Desktop_Change *e; + + e = calloc(1, sizeof(Ecore_X_Event_Desktop_Change)); + if (!e) + return; + + e->win = xevent->xclient.window; + e->desk = xevent->xclient.data.l[0]; + e->source = xevent->xclient.data.l[1]; + + ecore_event_add(ECORE_X_EVENT_DESKTOP_CHANGE, e, NULL, NULL); + } + else if ((xevent->xclient.message_type == + ECORE_X_ATOM_NET_REQUEST_FRAME_EXTENTS)) + { + Ecore_X_Event_Frame_Extents_Request *e; + + e = calloc(1, sizeof(Ecore_X_Event_Frame_Extents_Request)); + if (!e) + return; + + e->win = xevent->xclient.window; + + ecore_event_add(ECORE_X_EVENT_FRAME_EXTENTS_REQUEST, e, NULL, NULL); + } + else if ((xevent->xclient.message_type == ECORE_X_ATOM_WM_PROTOCOLS) + && ((Ecore_X_Atom)xevent->xclient.data.l[0] == + ECORE_X_ATOM_NET_WM_PING) + && (xevent->xclient.format == 32)) + { + Ecore_X_Event_Ping *e; + Ecore_X_Window root = 0; + + e = calloc(1, sizeof(Ecore_X_Event_Ping)); + if (!e) + return; + + e->win = xevent->xclient.window; + e->time = xevent->xclient.data.l[1]; + e->event_win = xevent->xclient.data.l[2]; + + /* send a reply anyway - we are alive... eventloop at least */ + ecore_event_add(ECORE_X_EVENT_PING, e, NULL, NULL); + if (ScreenCount(_ecore_x_disp) > 1) + { + LOGFN(__FILE__, __LINE__, __FUNCTION__); + root = ecore_x_window_root_get(e->win); + } + else + root = DefaultRootWindow(_ecore_x_disp); + + if (xevent->xclient.window != root) + { + xevent->xclient.window = root; + XSendEvent(_ecore_x_disp, root, False, + SubstructureRedirectMask | SubstructureNotifyMask, + xevent); + } + } + else if ((xevent->xclient.message_type == + ECORE_X_ATOM_NET_STARTUP_INFO_BEGIN) && + (xevent->xclient.format == 8)) + _ecore_x_netwm_startup_info_begin(xevent->xclient.window, + xevent->xclient.data.b); + else if ((xevent->xclient.message_type == ECORE_X_ATOM_NET_STARTUP_INFO) && + (xevent->xclient.format == 8)) + _ecore_x_netwm_startup_info(xevent->xclient.window, + xevent->xclient.data.b); + else if ((xevent->xclient.message_type == 27777) + && (xevent->xclient.data.l[0] == 0x7162534) + && (xevent->xclient.format == 32) + && (xevent->xclient.window == _ecore_x_private_win)) + { + /* a grab sync marker */ + if (xevent->xclient.data.l[1] == 0x10000001) + _ecore_x_window_grab_remove(xevent->xclient.data.l[2]); + else if (xevent->xclient.data.l[1] == 0x10000002) + _ecore_x_key_grab_remove(xevent->xclient.data.l[2]); + } + else + { + Ecore_X_Event_Client_Message *e; + int i; + + e = calloc(1, sizeof(Ecore_X_Event_Client_Message)); + if (!e) + return; + + e->win = xevent->xclient.window; + e->message_type = xevent->xclient.message_type; + e->format = xevent->xclient.format; + for (i = 0; i < 5; i++) + e->data.l[i] = xevent->xclient.data.l[i]; + + ecore_event_add(ECORE_X_EVENT_CLIENT_MESSAGE, e, NULL, NULL); + } +} /* _ecore_x_event_handle_client_message */ + +void +_ecore_x_event_handle_mapping_notify(XEvent *xevent) +{ + Ecore_X_Event_Mapping_Change *e; + + _ecore_x_last_event_mouse_move = 0; + XRefreshKeyboardMapping((XMappingEvent *)xevent); + _ecore_x_modifiers_get(); + e = calloc(1, sizeof(Ecore_X_Event_Mapping_Change)); + if (!e) return; + switch (xevent->xmapping.request) + { + case MappingModifier: + e->type = ECORE_X_MAPPING_MODIFIER; + break; + + case MappingKeyboard: + e->type = ECORE_X_MAPPING_KEYBOARD; + break; + + case MappingPointer: + default: + e->type = ECORE_X_MAPPING_MOUSE; + break; + } + e->keycode = xevent->xmapping.first_keycode; + e->num = xevent->xmapping.count; + ecore_event_add(ECORE_X_EVENT_MAPPING_CHANGE, e, NULL, NULL); +} /* _ecore_x_event_handle_mapping_notify */ + +void +_ecore_x_event_handle_shape_change(XEvent *xevent) +{ + XShapeEvent *shape_event; + Ecore_X_Event_Window_Shape *e; + + _ecore_x_last_event_mouse_move = 0; + shape_event = (XShapeEvent *)xevent; + e = calloc(1, sizeof(Ecore_X_Event_Window_Shape)); + if (!e) + return; + + e->win = shape_event->window; + e->time = shape_event->time; + switch (shape_event->kind) + { + case ShapeBounding: + e->type = ECORE_X_SHAPE_BOUNDING; + break; + + case ShapeClip: + e->type = ECORE_X_SHAPE_CLIP; + break; + + case ShapeInput: + e->type = ECORE_X_SHAPE_INPUT; + break; + + default: + break; + } + e->x = shape_event->x; + e->y = shape_event->y; + e->w = shape_event->width; + e->h = shape_event->height; + e->shaped = shape_event->shaped; + ecore_event_add(ECORE_X_EVENT_WINDOW_SHAPE, e, NULL, NULL); +} /* _ecore_x_event_handle_shape_change */ + +void +_ecore_x_event_handle_screensaver_notify(XEvent *xevent) +{ +#ifdef ECORE_XSS + XScreenSaverNotifyEvent *screensaver_event; + Ecore_X_Event_Screensaver_Notify *e; + + _ecore_x_last_event_mouse_move = 0; + screensaver_event = (XScreenSaverNotifyEvent *)xevent; + e = calloc(1, sizeof(Ecore_X_Event_Screensaver_Notify)); + if (!e) + return; + + e->win = screensaver_event->window; + if (screensaver_event->state == ScreenSaverOn) + e->on = EINA_TRUE; + else + e->on = EINA_FALSE; + + e->time = screensaver_event->time; + ecore_event_add(ECORE_X_EVENT_SCREENSAVER_NOTIFY, e, NULL, NULL); +#else /* ifdef ECORE_XSS */ + xevent = NULL; +#endif /* ifdef ECORE_XSS */ +} /* _ecore_x_event_handle_screensaver_notify */ + +void +_ecore_x_event_handle_sync_counter(XEvent *xevent) +{ + XSyncCounterNotifyEvent *sync_counter_event; + Ecore_X_Event_Sync_Counter *e; + + _ecore_x_last_event_mouse_move = 0; + sync_counter_event = (XSyncCounterNotifyEvent *)xevent; + e = calloc(1, sizeof(Ecore_X_Event_Sync_Counter)); + if (!e) + return; + + e->time = sync_counter_event->time; + ecore_event_add(ECORE_X_EVENT_SYNC_COUNTER, e, NULL, NULL); +} /* _ecore_x_event_handle_sync_counter */ + +void +_ecore_x_event_handle_sync_alarm(XEvent *xevent) +{ + XSyncAlarmNotifyEvent *sync_alarm_event; + Ecore_X_Event_Sync_Alarm *e; + + _ecore_x_last_event_mouse_move = 0; + sync_alarm_event = (XSyncAlarmNotifyEvent *)xevent; + + e = calloc(1, sizeof(Ecore_X_Event_Sync_Alarm)); + if (!e) + return; + + e->time = sync_alarm_event->time; + e->alarm = sync_alarm_event->alarm; + ecore_event_add(ECORE_X_EVENT_SYNC_ALARM, e, NULL, NULL); +} /* _ecore_x_event_handle_sync_alarm */ + +#ifdef ECORE_XRANDR +void +_ecore_x_event_handle_randr_change(XEvent *xevent) +{ + XRRScreenChangeNotifyEvent *randr_event; + Ecore_X_Event_Screen_Change *e; + + _ecore_x_last_event_mouse_move = 0; + randr_event = (XRRScreenChangeNotifyEvent *)xevent; + if (!XRRUpdateConfiguration(xevent)) + ERR("Can't update RR config!"); + + e = calloc(1, sizeof(Ecore_X_Event_Screen_Change)); + if (!e) + return; + + e->win = randr_event->window; + e->root = randr_event->root; + e->size.width = randr_event->width; + e->size.height = randr_event->height; + e->time = randr_event->timestamp; + e->config_time = randr_event->config_timestamp; + e->size.width_mm = randr_event->mwidth; + e->size.height_mm = randr_event->mheight; + e->orientation = randr_event->rotation; + e->subpixel_order = randr_event->subpixel_order; + ecore_event_add(ECORE_X_EVENT_SCREEN_CHANGE, e, NULL, NULL); +} /* _ecore_x_event_handle_randr_change */ + +static void +_ecore_x_event_handle_randr_notify_crtc_change(const XRRNotifyEvent *xevent) +{ + const XRRCrtcChangeNotifyEvent *randr_event; + Ecore_X_Event_Randr_Crtc_Change *e; + + randr_event = (const XRRCrtcChangeNotifyEvent *)xevent; + + e = calloc(1, sizeof(Ecore_X_Event_Randr_Crtc_Change)); + if (!e) + return; + + e->win = randr_event->window; + e->crtc = randr_event->crtc; + e->mode = randr_event->mode; + e->orientation = randr_event->rotation; + e->geo.x = randr_event->x; + e->geo.y = randr_event->y; + e->geo.w = randr_event->width; + e->geo.h = randr_event->height; + ecore_event_add(ECORE_X_EVENT_RANDR_CRTC_CHANGE, e, NULL, NULL); +} /* _ecore_x_event_handle_randr_notify_crtc_change */ + +static void +_ecore_x_event_handle_randr_notify_output_change(const XRRNotifyEvent *xevent) +{ + const XRROutputChangeNotifyEvent *randr_event; + Ecore_X_Event_Randr_Output_Change *e; + + randr_event = (const XRROutputChangeNotifyEvent *)xevent; + + e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Change)); + if (!e) + return; + + e->win = randr_event->window; + e->output = randr_event->output; + e->crtc = randr_event->crtc; + e->mode = randr_event->mode; + e->orientation = randr_event->rotation; + e->connection = randr_event->connection; + e->subpixel_order = randr_event->subpixel_order; + ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_CHANGE, e, NULL, NULL); +} /* _ecore_x_event_handle_randr_notify_output_change */ + +static void +_ecore_x_event_handle_randr_notify_output_property(const XRRNotifyEvent *xevent) +{ + const XRROutputPropertyNotifyEvent *randr_event; + Ecore_X_Event_Randr_Output_Property_Notify *e; + + randr_event = (const XRROutputPropertyNotifyEvent *)xevent; + + e = calloc(1, sizeof(Ecore_X_Event_Randr_Output_Property_Notify)); + if (!e) + return; + + e->win = randr_event->window; + e->output = randr_event->output; + e->property = randr_event->property; + e->time = randr_event->timestamp; + if (randr_event->state == PropertyNewValue) + e->state = ECORE_X_RANDR_PROPERTY_CHANGE_ADD; + else + e->state = ECORE_X_RANDR_PROPERTY_CHANGE_DEL; + ecore_event_add(ECORE_X_EVENT_RANDR_OUTPUT_PROPERTY_NOTIFY, e, NULL, NULL); +} /* _ecore_x_event_handle_randr_notify_output_property */ + +void +_ecore_x_event_handle_randr_notify(XEvent *xevent) +{ + const XRRNotifyEvent *randr_event; + + _ecore_x_last_event_mouse_move = 0; + randr_event = (const XRRNotifyEvent *)xevent; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + switch (randr_event->subtype) + { + case RRNotify_CrtcChange: + _ecore_x_event_handle_randr_notify_crtc_change(randr_event); + break; + + case RRNotify_OutputChange: + _ecore_x_event_handle_randr_notify_output_change(randr_event); + break; + + case RRNotify_OutputProperty: + _ecore_x_event_handle_randr_notify_output_property(randr_event); + break; + + default: + ERR("Unknown XRandR RRNotify subtype: %d.", + randr_event->subtype); + break; + } /* switch */ +} /* _ecore_x_event_handle_randr_notify */ + +#endif /* ifdef ECORE_XRANDR */ + +#ifdef ECORE_XFIXES +void +_ecore_x_event_handle_fixes_selection_notify(XEvent *event) +{ + XFixesSelectionNotifyEvent *notify_event = + (XFixesSelectionNotifyEvent *)event; + Ecore_X_Event_Fixes_Selection_Notify *e; + Ecore_X_Atom sel; + + _ecore_x_last_event_mouse_move = 0; + /* Nothing here yet */ + + e = calloc(1, sizeof(*e)); + if (!e) + return; + + e->win = notify_event->window; + e->owner = notify_event->owner; + e->time = notify_event->timestamp; + e->selection_time = notify_event->selection_timestamp; + e->atom = sel = notify_event->selection; + if (sel == ECORE_X_ATOM_SELECTION_PRIMARY) + e->selection = ECORE_X_SELECTION_PRIMARY; + else if (sel == ECORE_X_ATOM_SELECTION_SECONDARY) + e->selection = ECORE_X_SELECTION_SECONDARY; + else if (sel == ECORE_X_ATOM_SELECTION_CLIPBOARD) + e->selection = ECORE_X_SELECTION_CLIPBOARD; + else + e->selection = ECORE_X_SELECTION_OTHER; + e->reason = notify_event->subtype; + + ecore_event_add(ECORE_X_EVENT_FIXES_SELECTION_NOTIFY, e, NULL, NULL); +} /* _ecore_x_event_handle_fixes_selection_notify */ + +#endif /* ifdef ECORE_XFIXES */ + +#ifdef ECORE_XDAMAGE +void +_ecore_x_event_handle_damage_notify(XEvent *event) +{ + XDamageNotifyEvent *damage_event; + Ecore_X_Event_Damage *e; + + _ecore_x_last_event_mouse_move = 0; + damage_event = (XDamageNotifyEvent *)event; + + e = calloc(1, sizeof(Ecore_X_Event_Damage)); + if (!e) + return; + + e->level = damage_event->level; + e->drawable = damage_event->drawable; + e->damage = damage_event->damage; + e->more = damage_event->more; + e->time = damage_event->timestamp; + e->area.x = damage_event->area.x; + e->area.y = damage_event->area.y; + e->area.width = damage_event->area.width; + e->area.height = damage_event->area.height; + e->geometry.x = damage_event->geometry.x; + e->geometry.y = damage_event->geometry.y; + e->geometry.width = damage_event->geometry.width; + e->geometry.height = damage_event->geometry.height; + + ecore_event_add(ECORE_X_EVENT_DAMAGE_NOTIFY, e, NULL, NULL); +} /* _ecore_x_event_handle_damage_notify */ + +#endif /* ifdef ECORE_XDAMAGE */ + +static void +_ecore_x_event_free_generic_event(void *data, + void *ev) +{ +#ifdef ECORE_XI2 + Ecore_X_Event_Generic *e = (Ecore_X_Event_Generic *)ev; + + if (data) + { + if (e->data) + XFreeEventData(_ecore_x_disp, (XGenericEventCookie *)data); + free(data); + } + free(e); +#else + return; + data = NULL; ev = NULL; +#endif /* ifdef ECORE_XI2 */ +} /* _ecore_x_event_free_generic_event */ + +void +_ecore_x_event_handle_generic_event(XEvent *event) +{ +#ifdef ECORE_XI2 + XGenericEvent *generic_event; + Ecore_X_Event_Generic *e; + XGenericEventCookie *data; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + generic_event = (XGenericEvent *)event; + + e = calloc(1, sizeof(Ecore_X_Event_Generic)); + if (!e) + return; + + if (XGetEventData(_ecore_x_disp, &(event->xcookie))) + { + e->cookie = event->xcookie.cookie; + e->data = event->xcookie.data; + } + else + { + e->cookie = 0; + e->data = NULL; + } + + e->extension = generic_event->extension; + e->evtype = generic_event->evtype; + + if (e->extension == _ecore_x_xi2_opcode) + _ecore_x_input_handler(event); + + data = malloc(sizeof(XGenericEventCookie)); + if (data) memcpy(data, &(event->xcookie), sizeof(XGenericEventCookie)); + ecore_event_add(ECORE_X_EVENT_GENERIC, + e, + _ecore_x_event_free_generic_event, + data); +#else + return; + event = NULL; +#endif /* ifdef ECORE_XI2 */ +} /* _ecore_x_event_handle_generic_event */ + +#ifdef ECORE_XGESTURE +void +_ecore_x_event_handle_gesture_notify_flick(XEvent *xevent) +{ + XGestureNotifyFlickEvent *xfe; + Ecore_X_Event_Gesture_Notify_Flick *e; + + _ecore_x_last_event_mouse_move = 0; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + xfe = (XGestureNotifyFlickEvent *)xevent; + e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Flick)); + if (!e) + return; + + e->win = xfe->window; + e->time = xfe->time; + e->subtype = xfe->kind; + e->num_fingers = xfe->num_finger; + e->distance = xfe->distance; + e->duration = xfe->duration; + e->direction = xfe->direction; + e->angle = XFixedToDouble(xfe->angle); + + ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_FLICK, e, NULL, NULL); +} + +void +_ecore_x_event_handle_gesture_notify_pan(XEvent *xevent) +{ + XGestureNotifyPanEvent *xpe; + Ecore_X_Event_Gesture_Notify_Pan *e; + + _ecore_x_last_event_mouse_move = 0; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + xpe = (XGestureNotifyPanEvent *)xevent; + e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Pan)); + if (!e) + return; + + e->win = xpe->window; + e->time = xpe->time; + e->subtype = xpe->kind; + e->num_fingers = xpe->num_finger; + e->dx = xpe->dx; + e->dy = xpe->dy; + e->distance = xpe->distance; + e->duration = xpe->duration; + e->direction = xpe->direction; + + ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PAN, e, NULL, NULL); +} + +void +_ecore_x_event_handle_gesture_notify_pinchrotation(XEvent *xevent) +{ + XGestureNotifyPinchRotationEvent *xpre; + Ecore_X_Event_Gesture_Notify_PinchRotation *e; + + _ecore_x_last_event_mouse_move = 0; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + xpre = (XGestureNotifyPinchRotationEvent *)xevent; + e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_PinchRotation)); + if (!e) + return; + + e->win = xpre->window; + e->time = xpre->time; + e->subtype = xpre->kind; + e->num_fingers = xpre->num_finger; + e->distance = xpre->distance; + e->cx = xpre->cx; + e->cy = xpre->cy; + e->zoom = XFixedToDouble(xpre->zoom); + e->angle = XFixedToDouble(xpre->angle); + + ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_PINCHROTATION, e, NULL, NULL); +} + +void +_ecore_x_event_handle_gesture_notify_tap(XEvent *xevent) +{ + XGestureNotifyTapEvent *xte; + Ecore_X_Event_Gesture_Notify_Tap *e; + + _ecore_x_last_event_mouse_move = 0; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + xte = (XGestureNotifyTapEvent *)xevent; + e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Tap)); + if (!e) + return; + + e->win = xte->window; + e->time = xte->time; + e->subtype = xte->kind; + e->num_fingers = xte->num_finger; + e->cx = xte->cx; + e->cy = xte->cy; + e->tap_repeat = xte->tap_repeat; + e->interval = xte->interval; + + ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAP, e, NULL, NULL); +} + +void +_ecore_x_event_handle_gesture_notify_tapnhold(XEvent *xevent) +{ + XGestureNotifyTapNHoldEvent *xthe; + Ecore_X_Event_Gesture_Notify_TapNHold *e; + + _ecore_x_last_event_mouse_move = 0; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + xthe = (XGestureNotifyTapNHoldEvent *)xevent; + e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_TapNHold)); + if (!e) + return; + + e->win = xthe->window; + e->time = xthe->time; + e->subtype = xthe->kind; + e->num_fingers = xthe->num_finger; + e->cx = xthe->cx; + e->cy = xthe->cy; + e->interval = xthe->interval; + e->hold_time = xthe->holdtime; + + ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_TAPNHOLD, e, NULL, NULL); +} + +void + _ecore_x_event_handle_gesture_notify_hold(XEvent *xevent) +{ + XGestureNotifyHoldEvent *xhe; + Ecore_X_Event_Gesture_Notify_Hold *e; + + _ecore_x_last_event_mouse_move = 0; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + xhe = (XGestureNotifyHoldEvent *)xevent; + e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Hold)); + if (!e) + return; + + e->win = xhe->window; + e->time = xhe->time; + e->subtype = xhe->kind; + e->num_fingers = xhe->num_finger; + e->cx = xhe->cx; + e->cy = xhe->cy; + e->hold_time = xhe->holdtime; + + ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_HOLD, e, NULL, NULL); +} + +void + _ecore_x_event_handle_gesture_notify_group(XEvent *xevent) +{ + XGestureNotifyGroupEvent *xge; + Ecore_X_Event_Gesture_Notify_Group *e; + + _ecore_x_last_event_mouse_move = 0; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + xge = (XGestureNotifyGroupEvent *)xevent; + e = calloc(1, sizeof(Ecore_X_Event_Gesture_Notify_Group)); + if (!e) + return; + + e->win = xge->window; + e->time = xge->time; + e->subtype = xge->kind; + e->num_groups = xge->num_group; + e->group_id = xge->groupid; + + ecore_event_add(ECORE_X_EVENT_GESTURE_NOTIFY_GROUP, e, NULL, NULL); +} +#endif /* ifdef ECORE_XGESTURE */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c new file mode 100644 index 0000000..e81af13 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_fixes.c @@ -0,0 +1,364 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include + +#include "ecore_x_private.h" +#include "Ecore_X.h" + +static int _fixes_available; +#ifdef ECORE_XFIXES +static int _fixes_major, _fixes_minor; +#endif /* ifdef ECORE_XFIXES */ + +void +_ecore_x_fixes_init(void) +{ +#ifdef ECORE_XFIXES + _fixes_major = 3; + _fixes_minor = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (XFixesQueryVersion(_ecore_x_disp, &_fixes_major, &_fixes_minor)) + { + _fixes_available = 1; + + ECORE_X_EVENT_FIXES_SELECTION_NOTIFY = ecore_event_type_new(); + } + else + _fixes_available = 0; + +#else /* ifdef ECORE_XFIXES */ + _fixes_available = 0; +#endif /* ifdef ECORE_XFIXES */ +} /* _ecore_x_fixes_init */ + +#ifdef ECORE_XFIXES +/* I don't know what to call this function. */ +static XRectangle * +_ecore_x_rectangle_ecore_to_x(Ecore_X_Rectangle *rects, + int num) +{ + XRectangle *xrect; + int i; + + if (num == 0) + return NULL; + + xrect = malloc(sizeof(XRectangle) * num); + if (!xrect) + return NULL; + + for (i = 0; i < num; i++) + { + xrect[i].x = rects[i].x; + xrect[i].y = rects[i].y; + xrect[i].width = rects[i].width; + xrect[i].height = rects[i].height; + } + return xrect; +} /* _ecore_x_rectangle_ecore_to_x */ + +static Ecore_X_Rectangle * +_ecore_x_rectangle_x_to_ecore(XRectangle *xrect, + int num) +{ + Ecore_X_Rectangle *rects; + int i; + + if (num == 0) + return NULL; + + rects = malloc(sizeof(Ecore_X_Rectangle) * num); + if (!rects) + return NULL; + + for (i = 0; i < num; i++) + { + rects[i].x = xrect[i].x; + rects[i].y = xrect[i].y; + rects[i].width = xrect[i].width; + rects[i].height = xrect[i].height; + } + return rects; +} /* _ecore_x_rectangle_x_to_ecore */ + +#endif /* ifdef ECORE_XFIXES */ + +EAPI Eina_Bool +ecore_x_fixes_selection_notification_request(Ecore_X_Atom selection) +{ +#ifdef ECORE_XFIXES + if (_fixes_available) + { + XFixesSelectSelectionInput (_ecore_x_disp, + DefaultRootWindow(_ecore_x_disp), + selection, + XFixesSetSelectionOwnerNotifyMask | + XFixesSelectionWindowDestroyNotifyMask | + XFixesSelectionClientCloseNotifyMask); + return EINA_TRUE; + } +#endif + return EINA_FALSE; +} + +EAPI Ecore_X_Region +ecore_x_region_new(Ecore_X_Rectangle *rects, + int num) +{ +#ifdef ECORE_XFIXES + Ecore_X_Region region; + XRectangle *xrect; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xrect = _ecore_x_rectangle_ecore_to_x(rects, num); + region = XFixesCreateRegion(_ecore_x_disp, xrect, num); + free(xrect); + return region; +#else /* ifdef ECORE_XFIXES */ + return 0; +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_new */ + +EAPI Ecore_X_Region +ecore_x_region_new_from_bitmap(Ecore_X_Pixmap bitmap) +{ +#ifdef ECORE_XFIXES + Ecore_X_Region region; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + region = XFixesCreateRegionFromBitmap(_ecore_x_disp, bitmap); + return region; +#else /* ifdef ECORE_XFIXES */ + return 0; +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_new_from_bitmap */ + +EAPI Ecore_X_Region +ecore_x_region_new_from_window(Ecore_X_Window win, + Ecore_X_Region_Type type) +{ +#ifdef ECORE_XFIXES + Ecore_X_Region region; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + region = XFixesCreateRegionFromWindow(_ecore_x_disp, win, type); + return region; +#else /* ifdef ECORE_XFIXES */ + return 0; +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_new_from_window */ + +EAPI Ecore_X_Region +ecore_x_region_new_from_gc(Ecore_X_GC gc) +{ +#ifdef ECORE_XFIXES + Ecore_X_Region region; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + region = XFixesCreateRegionFromGC(_ecore_x_disp, gc); + return region; +#else /* ifdef ECORE_XFIXES */ + return 0; +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_new_from_gc */ + +EAPI Ecore_X_Region +ecore_x_region_new_from_picture(Ecore_X_Picture picture) +{ +#ifdef ECORE_XFIXES + Ecore_X_Region region; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + region = XFixesCreateRegionFromPicture(_ecore_x_disp, picture); + return region; +#else /* ifdef ECORE_XFIXES */ + return 0; +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_new_from_picture */ + +EAPI void +ecore_x_region_free(Ecore_X_Region region) +{ +#ifdef ECORE_XFIXES + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFixesDestroyRegion(_ecore_x_disp, region); +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_free */ + +EAPI void +ecore_x_region_set(Ecore_X_Region region, + Ecore_X_Rectangle *rects, + int num) +{ +#ifdef ECORE_XFIXES + XRectangle *xrect = _ecore_x_rectangle_ecore_to_x(rects, num); + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFixesSetRegion(_ecore_x_disp, region, xrect, num); +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_set */ + +EAPI void +ecore_x_region_copy(Ecore_X_Region dest, + Ecore_X_Region source) +{ +#ifdef ECORE_XFIXES + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFixesCopyRegion(_ecore_x_disp, dest, source); +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_copy */ + +EAPI void +ecore_x_region_combine(Ecore_X_Region dest, + Ecore_X_Region source1, + Ecore_X_Region source2) +{ +#ifdef ECORE_XFIXES + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFixesUnionRegion(_ecore_x_disp, dest, source1, source2); +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_combine */ + +EAPI void +ecore_x_region_intersect(Ecore_X_Region dest, + Ecore_X_Region source1, + Ecore_X_Region source2) +{ +#ifdef ECORE_XFIXES + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFixesIntersectRegion(_ecore_x_disp, dest, source1, source2); +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_intersect */ + +EAPI void +ecore_x_region_subtract(Ecore_X_Region dest, + Ecore_X_Region source1, + Ecore_X_Region source2) +{ +#ifdef ECORE_XFIXES + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFixesSubtractRegion(_ecore_x_disp, dest, source1, source2); +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_subtract */ + +EAPI void +ecore_x_region_invert(Ecore_X_Region dest, + Ecore_X_Rectangle *bounds, + Ecore_X_Region source) +{ +#ifdef ECORE_XFIXES + XRectangle *xbound; + int num = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + while (bounds + num) num++; + xbound = _ecore_x_rectangle_ecore_to_x(bounds, num); + + XFixesInvertRegion(_ecore_x_disp, dest, xbound, source); +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_invert */ + +EAPI void +ecore_x_region_translate(Ecore_X_Region region, + int dx, + int dy) +{ +#ifdef ECORE_XFIXES + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFixesTranslateRegion(_ecore_x_disp, region, dx, dy); +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_translate */ + +EAPI void +ecore_x_region_extents(Ecore_X_Region dest, + Ecore_X_Region source) +{ +#ifdef ECORE_XFIXES + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFixesRegionExtents(_ecore_x_disp, dest, source); +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_extents */ + +EAPI Ecore_X_Rectangle * +ecore_x_region_fetch(Ecore_X_Region region, + int *num, + Ecore_X_Rectangle *bounds){ +#ifdef ECORE_XFIXES + Ecore_X_Rectangle *rects; + XRectangle *xrect, xbound; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xrect = XFixesFetchRegionAndBounds(_ecore_x_disp, region, num, &xbound); + rects = _ecore_x_rectangle_x_to_ecore(xrect, *num); + (*bounds).x = xbound.x; + (*bounds).y = xbound.y; + (*bounds).width = xbound.width; + (*bounds).height = xbound.height; + return rects; +#else /* ifdef ECORE_XFIXES */ + return NULL; +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_fetch */ + +EAPI void +ecore_x_region_expand(Ecore_X_Region dest, + Ecore_X_Region source, + unsigned int left, + unsigned int right, + unsigned int top, + unsigned int bottom) +{ +#ifdef ECORE_XFIXES + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFixesExpandRegion(_ecore_x_disp, dest, source, left, right, top, bottom); +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_expand */ + +EAPI void +ecore_x_region_gc_clip_set(Ecore_X_Region region, + Ecore_X_GC gc, + int x_origin, + int y_origin) +{ +#ifdef ECORE_XFIXES + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFixesSetGCClipRegion(_ecore_x_disp, gc, x_origin, y_origin, region); +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_gc_clip_set */ + +EAPI void +ecore_x_region_window_shape_set(Ecore_X_Region region, + Ecore_X_Window win, + Ecore_X_Shape_Type type, + int x_offset, + int y_offset) +{ +#ifdef ECORE_XFIXES + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFixesSetWindowShapeRegion(_ecore_x_disp, + win, + type, + x_offset, + y_offset, + region); +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_window_shape_set */ + +EAPI void +ecore_x_region_picture_clip_set(Ecore_X_Region region, + Ecore_X_Picture picture, + int x_origin, + int y_origin) +{ +#ifdef ECORE_XFIXES + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFixesSetPictureClipRegion(_ecore_x_disp, + picture, + x_origin, + y_origin, + region); +#endif /* ifdef ECORE_XFIXES */ +} /* ecore_x_region_picture_clip_set */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c new file mode 100644 index 0000000..10b807b --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gc.c @@ -0,0 +1,171 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" + +/** + * Creates a new default graphics context associated with the given + * drawable. + * @param draw Drawable to create graphics context with. If @c 0 is + * given instead, the default root window is used. + * @param value_mask Bitmask values. + * @param value_list List of values. The order of values must be the + * same than the corresponding bitmaks. + * @return The new default graphics context. + */ +EAPI Ecore_X_GC +ecore_x_gc_new(Ecore_X_Drawable draw, + Ecore_X_GC_Value_Mask value_mask, + const unsigned int *value_list) +{ + XGCValues gcv; + int mask; + int idx; + int i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!draw) + draw = DefaultRootWindow(_ecore_x_disp); + + memset(&gcv, 0, sizeof (gcv)); + + for (i = 0, idx = 0, mask = 1; i <= 22; i++, mask <<= 1) + { + switch (mask & value_mask) + { + case ECORE_X_GC_VALUE_MASK_FUNCTION: + gcv.function = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_PLANE_MASK: + gcv.plane_mask = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_FOREGROUND: + gcv.foreground = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_BACKGROUND: + gcv.background = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_LINE_WIDTH: + gcv.line_width = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_LINE_STYLE: + gcv.line_style = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_CAP_STYLE: + gcv.cap_style = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_JOIN_STYLE: + gcv.join_style = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_FILL_STYLE: + gcv.fill_style = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_FILL_RULE: + gcv.fill_rule = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_TILE: + gcv.tile = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_STIPPLE: + gcv.stipple = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_X: + gcv.ts_x_origin = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_TILE_STIPPLE_ORIGIN_Y: + gcv.ts_y_origin = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_FONT: + gcv.font = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_SUBWINDOW_MODE: + gcv.subwindow_mode = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_GRAPHICS_EXPOSURES: + gcv.graphics_exposures = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_X: + gcv.clip_x_origin = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_CLIP_ORIGIN_Y: + gcv.clip_y_origin = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_CLIP_MASK: + gcv.clip_mask = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_DASH_OFFSET: + gcv.dash_offset = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_DASH_LIST: + gcv.dashes = value_list[idx]; + idx++; + break; + + case ECORE_X_GC_VALUE_MASK_ARC_MODE: + gcv.arc_mode = value_list[idx]; + idx++; + break; + } /* switch */ + } + + return XCreateGC(_ecore_x_disp, draw, value_mask, &gcv); +} /* ecore_x_gc_new */ + +/** + * Deletes and frees the given graphics context. + * @param gc The given graphics context. + */ +EAPI void +ecore_x_gc_free(Ecore_X_GC gc) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFreeGC(_ecore_x_disp, gc); +} /* ecore_x_gc_free */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c new file mode 100644 index 0000000..e1dc75c --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_gesture.c @@ -0,0 +1,136 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "ecore_x_private.h" + +static Eina_Bool _gesture_available = EINA_FALSE; + +#ifdef ECORE_XGESTURE +static int _gesture_major, _gesture_minor, _gesture_patch; +int _gesture_version; +#endif /* ifdef ECORE_XGESTURE */ + +void +_ecore_x_gesture_init(void) +{ +#ifdef ECORE_XGESTURE + _gesture_major = 0; + _gesture_minor = 0; + _gesture_patch = 0; + _gesture_version = 0; + + if (XGestureQueryVersion(_ecore_x_disp, &_gesture_major, &_gesture_minor, &_gesture_patch)) + { + _gesture_version = (_gesture_major << 16) | _gesture_minor; + _gesture_available = EINA_TRUE; + } + else + _gesture_available = EINA_FALSE; +#else /* ifdef ECORE_XGESTURE */ + _gesture_available = EINA_FALSE; +#endif /* ifdef ECORE_XGESTURE */ +} + +/* + * @brief query whether gesture is available or not + * @return EINA_TRUE, if extension is available, else EINA_FALSE + */ +EAPI Eina_Bool +ecore_x_gesture_supported(void) +{ + return _gesture_available; +} + +EAPI Eina_Bool +ecore_x_gesture_events_select(Ecore_X_Window win, + Ecore_X_Gesture_Event_Mask mask) +{ +#ifdef ECORE_XGESTURE + if (!_gesture_available) + return EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XGestureSelectEvents(_ecore_x_disp, win, mask); + + return EINA_TRUE; +#else /* ifdef ECORE_XGESTURE */ + return EINA_FALSE; + win = 0; + mask = 0; +#endif /* ifdef ECORE_XGESTURE */ +} + +EAPI Ecore_X_Gesture_Event_Mask +ecore_x_gesture_events_selected_get(Ecore_X_Window win) +{ +#ifdef ECORE_XGESTURE + Ecore_X_Gesture_Event_Mask mask; + + if (!_gesture_available) + return ECORE_X_GESTURE_EVENT_MASK_NONE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (GestureSuccess != XGestureGetSelectedEvents(_ecore_x_disp, win, &mask)) + { + mask = ECORE_X_GESTURE_EVENT_MASK_NONE; + return mask; + } + + return mask; +#else /* ifdef ECORE_XGESTURE */ + return ECORE_X_GESTURE_EVENT_MASK_NONE; + win = 0; +#endif /* ifdef ECORE_XGESTURE */ +} + +EAPI Eina_Bool +ecore_x_gesture_event_grab(Ecore_X_Window win, + Ecore_X_Gesture_Event_Type type, + int num_fingers) +{ +#ifdef ECORE_XGESTURE + if (!_gesture_available) + return EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (GestureGrabSuccess != XGestureGrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime)) + { + return EINA_FALSE; + } + + return EINA_TRUE; +#else /* ifdef ECORE_XGESTURE */ + return EINA_FALSE; + win = 0; + type = 0; + num_fingers = 0; +#endif /* ifdef ECORE_XGESTURE */ +} + +EAPI Eina_Bool +ecore_x_gesture_event_ungrab(Ecore_X_Window win, + Ecore_X_Gesture_Event_Type type, + int num_fingers) +{ +#ifdef ECORE_XGESTURE + Ecore_X_Gesture_Event_Mask mask; + + if (!_gesture_available) + return EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (GestureUngrabSuccess != XGestureUngrabEvent(_ecore_x_disp, win, type, num_fingers, CurrentTime)) + { + return EINA_FALSE; + } + + return EINA_TRUE; +#else /* ifdef ECORE_XGESTURE */ + return EINA_FALSE; + win = 0; + type = 0; + num_fingers = 0; +#endif /* ifdef ECORE_XGESTURE */ +} + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c new file mode 100644 index 0000000..3899651 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_icccm.c @@ -0,0 +1,1214 @@ +/* + * Various ICCCM related functions. + * + * This is ALL the code involving anything ICCCM related. for both WM and + * client. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include +#include + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include "Ecore_X_Atoms.h" + +EAPI void +ecore_x_icccm_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); +} /* ecore_x_icccm_init */ + +EAPI void +ecore_x_icccm_state_set(Ecore_X_Window win, + Ecore_X_Window_State_Hint state) +{ + unsigned long c[2]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) + c[0] = WithdrawnState; + else if (state == ECORE_X_WINDOW_STATE_HINT_NORMAL) + c[0] = NormalState; + else if (state == ECORE_X_WINDOW_STATE_HINT_ICONIC) + c[0] = IconicState; + + c[1] = None; + XChangeProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE, + ECORE_X_ATOM_WM_STATE, 32, PropModeReplace, + (unsigned char *)c, 2); +} /* ecore_x_icccm_state_set */ + +EAPI Ecore_X_Window_State_Hint +ecore_x_icccm_state_get(Ecore_X_Window win) +{ + unsigned char *prop_ret = NULL; + Atom type_ret; + unsigned long bytes_after, num_ret; + int format_ret; + Ecore_X_Window_State_Hint hint; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + hint = ECORE_X_WINDOW_STATE_HINT_NONE; + XGetWindowProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_STATE, + 0, 0x7fffffff, False, ECORE_X_ATOM_WM_STATE, + &type_ret, &format_ret, &num_ret, &bytes_after, + &prop_ret); + if ((prop_ret) && (num_ret == 2)) + { + if (prop_ret[0] == WithdrawnState) + hint = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; + else if (prop_ret[0] == NormalState) + hint = ECORE_X_WINDOW_STATE_HINT_NORMAL; + else if (prop_ret[0] == IconicState) + hint = ECORE_X_WINDOW_STATE_HINT_ICONIC; + } + + if (prop_ret) + XFree(prop_ret); + + return hint; +} /* ecore_x_icccm_state_get */ + +EAPI void +ecore_x_icccm_delete_window_send(Ecore_X_Window win, + Ecore_X_Time t) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, + ECORE_X_EVENT_MASK_NONE, + ECORE_X_ATOM_WM_DELETE_WINDOW, + t, 0, 0, 0); +} /* ecore_x_icccm_delete_window_send */ + +EAPI void +ecore_x_icccm_take_focus_send(Ecore_X_Window win, + Ecore_X_Time t) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, + ECORE_X_EVENT_MASK_NONE, + ECORE_X_ATOM_WM_TAKE_FOCUS, + t, 0, 0, 0); +} /* ecore_x_icccm_take_focus_send */ + +EAPI void +ecore_x_icccm_save_yourself_send(Ecore_X_Window win, + Ecore_X_Time t) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_client_message32_send(win, ECORE_X_ATOM_WM_PROTOCOLS, + ECORE_X_EVENT_MASK_NONE, + ECORE_X_ATOM_WM_SAVE_YOURSELF, + t, 0, 0, 0); +} /* ecore_x_icccm_save_yourself_send */ + +EAPI void +ecore_x_icccm_move_resize_send(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + XEvent ev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ev.type = ConfigureNotify; + ev.xconfigure.display = _ecore_x_disp; + ev.xconfigure.event = win; + ev.xconfigure.window = win; + ev.xconfigure.x = x; + ev.xconfigure.y = y; + ev.xconfigure.width = w; + ev.xconfigure.height = h; + ev.xconfigure.border_width = 0; + ev.xconfigure.above = None; + ev.xconfigure.override_redirect = False; + XSendEvent(_ecore_x_disp, win, False, StructureNotifyMask, &ev); +} /* ecore_x_icccm_move_resize_send */ + +EAPI void +ecore_x_icccm_hints_set(Ecore_X_Window win, + Eina_Bool accepts_focus, + Ecore_X_Window_State_Hint initial_state, + Ecore_X_Pixmap icon_pixmap, + Ecore_X_Pixmap icon_mask, + Ecore_X_Window icon_window, + Ecore_X_Window window_group, + Eina_Bool is_urgent) +{ + XWMHints *hints; + + hints = XAllocWMHints(); + if (!hints) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + hints->flags = InputHint | StateHint; + hints->input = accepts_focus; + if (initial_state == ECORE_X_WINDOW_STATE_HINT_WITHDRAWN) + hints->initial_state = WithdrawnState; + else if (initial_state == ECORE_X_WINDOW_STATE_HINT_NORMAL) + hints->initial_state = NormalState; + else if (initial_state == ECORE_X_WINDOW_STATE_HINT_ICONIC) + hints->initial_state = IconicState; + + if (icon_pixmap != 0) + { + hints->icon_pixmap = icon_pixmap; + hints->flags |= IconPixmapHint; + } + + if (icon_mask != 0) + { + hints->icon_mask = icon_mask; + hints->flags |= IconMaskHint; + } + + if (icon_window != 0) + { + hints->icon_window = icon_window; + hints->flags |= IconWindowHint; + } + + if (window_group != 0) + { + hints->window_group = window_group; + hints->flags |= WindowGroupHint; + } + + if (is_urgent) + hints->flags |= XUrgencyHint; + + XSetWMHints(_ecore_x_disp, win, hints); + XFree(hints); +} /* ecore_x_icccm_hints_set */ + +EAPI Eina_Bool +ecore_x_icccm_hints_get(Ecore_X_Window win, + Eina_Bool *accepts_focus, + Ecore_X_Window_State_Hint *initial_state, + Ecore_X_Pixmap *icon_pixmap, + Ecore_X_Pixmap *icon_mask, + Ecore_X_Window *icon_window, + Ecore_X_Window *window_group, + Eina_Bool *is_urgent) +{ + XWMHints *hints; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (accepts_focus) + *accepts_focus = EINA_TRUE; + + if (initial_state) + *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL; + + if (icon_pixmap) + *icon_pixmap = 0; + + if (icon_mask) + *icon_mask = 0; + + if (icon_window) + *icon_window = 0; + + if (window_group) + *window_group = 0; + + if (is_urgent) + *is_urgent = EINA_FALSE; + + hints = XGetWMHints(_ecore_x_disp, win); + if (hints) + { + if ((hints->flags & InputHint) && (accepts_focus)) + { + if (hints->input) + *accepts_focus = EINA_TRUE; + else + *accepts_focus = EINA_FALSE; + } + + if ((hints->flags & StateHint) && (initial_state)) + { + if (hints->initial_state == WithdrawnState) + *initial_state = ECORE_X_WINDOW_STATE_HINT_WITHDRAWN; + else if (hints->initial_state == NormalState) + *initial_state = ECORE_X_WINDOW_STATE_HINT_NORMAL; + else if (hints->initial_state == IconicState) + *initial_state = ECORE_X_WINDOW_STATE_HINT_ICONIC; + } + + if ((hints->flags & IconPixmapHint) && (icon_pixmap)) + *icon_pixmap = hints->icon_pixmap; + + if ((hints->flags & IconMaskHint) && (icon_mask)) + *icon_mask = hints->icon_mask; + + if ((hints->flags & IconWindowHint) && (icon_window)) + *icon_window = hints->icon_window; + + if ((hints->flags & WindowGroupHint) && (window_group)) + *window_group = hints->window_group; + + if ((hints->flags & XUrgencyHint) && (is_urgent)) + *is_urgent = EINA_TRUE; + + XFree(hints); + return EINA_TRUE; + } + + return EINA_FALSE; +} /* ecore_x_icccm_hints_get */ + +EAPI void +ecore_x_icccm_size_pos_hints_set(Ecore_X_Window win, + Eina_Bool request_pos, + Ecore_X_Gravity gravity, + int min_w, + int min_h, + int max_w, + int max_h, + int base_w, + int base_h, + int step_x, + int step_y, + double min_aspect, + double max_aspect) +{ + XSizeHints hint; + long mask; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask)) + memset(&hint, 0, sizeof(XSizeHints)); + + hint.flags = 0; + if (request_pos) + hint.flags |= USPosition; + + if (gravity != ECORE_X_GRAVITY_NW) + { + hint.flags |= PWinGravity; + hint.win_gravity = gravity; + } + + if ((min_w > 0) || (min_h > 0)) + { + hint.flags |= PMinSize; + hint.min_width = min_w; + hint.min_height = min_h; + } + + if ((max_w > 0) || (max_h > 0)) + { + hint.flags |= PMaxSize; + hint.max_width = max_w; + hint.max_height = max_h; + } + + if ((base_w > 0) || (base_h > 0)) + { + hint.flags |= PBaseSize; + hint.base_width = base_w; + hint.base_height = base_h; + } + + if ((step_x > 1) || (step_y > 1)) + { + hint.flags |= PResizeInc; + hint.width_inc = step_x; + hint.height_inc = step_y; + } + + if ((min_aspect > 0.0) || (max_aspect > 0.0)) + { + hint.flags |= PAspect; + hint.min_aspect.x = min_aspect * 10000; + hint.min_aspect.y = 10000; + hint.max_aspect.x = max_aspect * 10000; + hint.max_aspect.y = 10000; + } + + XSetWMNormalHints(_ecore_x_disp, win, &hint); +} /* ecore_x_icccm_size_pos_hints_set */ + +EAPI Eina_Bool +ecore_x_icccm_size_pos_hints_get(Ecore_X_Window win, + Eina_Bool *request_pos, + Ecore_X_Gravity *gravity, + int *min_w, + int *min_h, + int *max_w, + int *max_h, + int *base_w, + int *base_h, + int *step_x, + int *step_y, + double *min_aspect, + double *max_aspect) +{ + XSizeHints hint; + long mask; + + int minw = 0, minh = 0; + int maxw = 32767, maxh = 32767; + int basew = -1, baseh = -1; + int stepx = -1, stepy = -1; + double mina = 0.0, maxa = 0.0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!XGetWMNormalHints(_ecore_x_disp, win, &hint, &mask)) + return EINA_FALSE; + + if ((hint.flags & USPosition) || ((hint.flags & PPosition))) + { + if (request_pos) + *request_pos = EINA_TRUE; + } + else if (request_pos) + *request_pos = EINA_FALSE; + + if (hint.flags & PWinGravity) + { + if (gravity) + *gravity = hint.win_gravity; + } + else if (gravity) + *gravity = ECORE_X_GRAVITY_NW; + + if (hint.flags & PMinSize) + { + minw = hint.min_width; + minh = hint.min_height; + } + + if (hint.flags & PMaxSize) + { + maxw = hint.max_width; + maxh = hint.max_height; + if (maxw < minw) + maxw = minw; + + if (maxh < minh) + maxh = minh; + } + + if (hint.flags & PBaseSize) + { + basew = hint.base_width; + baseh = hint.base_height; + if (basew > minw) + minw = basew; + + if (baseh > minh) + minh = baseh; + } + + if (hint.flags & PResizeInc) + { + stepx = hint.width_inc; + stepy = hint.height_inc; + if (stepx < 1) + stepx = 1; + + if (stepy < 1) + stepy = 1; + } + + if (hint.flags & PAspect) + { + if (hint.min_aspect.y > 0) + mina = ((double)hint.min_aspect.x) / ((double)hint.min_aspect.y); + + if (hint.max_aspect.y > 0) + maxa = ((double)hint.max_aspect.x) / ((double)hint.max_aspect.y); + } + + if (min_w) + *min_w = minw; + + if (min_h) + *min_h = minh; + + if (max_w) + *max_w = maxw; + + if (max_h) + *max_h = maxh; + + if (base_w) + *base_w = basew; + + if (base_h) + *base_h = baseh; + + if (step_x) + *step_x = stepx; + + if (step_y) + *step_y = stepy; + + if (min_aspect) + *min_aspect = mina; + + if (max_aspect) + *max_aspect = maxa; + + return EINA_TRUE; +} /* ecore_x_icccm_size_pos_hints_get */ + +EAPI void +ecore_x_icccm_title_set(Ecore_X_Window win, + const char *t) +{ + char *list[1]; + XTextProperty xprop; + int ret; + + if (!t) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xprop.value = NULL; +#ifdef X_HAVE_UTF8_STRING + list[0] = strdup(t); + ret = + Xutf8TextListToTextProperty(_ecore_x_disp, list, 1, XUTF8StringStyle, + &xprop); +#else /* ifdef X_HAVE_UTF8_STRING */ + list[0] = strdup(t); + ret = + XmbTextListToTextProperty(_ecore_x_disp, list, 1, XStdICCTextStyle, + &xprop); +#endif /* ifdef X_HAVE_UTF8_STRING */ + if (ret >= Success) + { + XSetWMName(_ecore_x_disp, win, &xprop); + if (xprop.value) + XFree(xprop.value); + } + else if (XStringListToTextProperty(list, 1, &xprop) >= Success) + { + XSetWMName(_ecore_x_disp, win, &xprop); + if (xprop.value) + XFree(xprop.value); + } + + free(list[0]); +} /* ecore_x_icccm_title_set */ + +EAPI char * +ecore_x_icccm_title_get(Ecore_X_Window win) +{ + XTextProperty xprop; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xprop.value = NULL; + if (XGetWMName(_ecore_x_disp, win, &xprop) >= Success) + { + if (xprop.value) + { + char **list = NULL; + char *t = NULL; + int num = 0; + int ret; + + if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING) + t = strdup((char *)xprop.value); + else + { + /* convert to utf8 */ +#ifdef X_HAVE_UTF8_STRING + ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop, + &list, &num); +#else /* ifdef X_HAVE_UTF8_STRING */ + ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop, + &list, &num); +#endif /* ifdef X_HAVE_UTF8_STRING */ + + if ((ret == XLocaleNotSupported) || + (ret == XNoMemory) || (ret == XConverterNotFound)) + t = strdup((char *)xprop.value); + else if ((ret >= Success) && (num > 0)) + t = strdup(list[0]); + + if (list) + XFreeStringList(list); + } + + if (xprop.value) + XFree(xprop.value); + + return t; + } + } + + return NULL; +} /* ecore_x_icccm_title_get */ + +/** + * Set protocol atoms explicitly + * @param win The Window + * @param protos An array of protocol atoms + * @param num the number of members of the array + */ +EAPI void +ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win, + Ecore_X_Atom *protos, + int num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (num > 0) + XSetWMProtocols(_ecore_x_disp, win, (Atom *)(protos), num); + else + XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_PROTOCOLS); +} /* ecore_x_icccm_protocol_atoms_set */ + +/** + * Set or unset a wm protocol property. + * @param win The Window + * @param protocol The protocol to enable/disable + * @param on On/Off + */ +EAPI void +ecore_x_icccm_protocol_set(Ecore_X_Window win, + Ecore_X_WM_Protocol protocol, + Eina_Bool on) +{ + Atom *protos = NULL; + Atom proto; + int protos_count = 0; + int already_set = 0; + int i; + + /* Check for invalid values */ + if (protocol >= ECORE_X_WM_PROTOCOL_NUM) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + proto = _ecore_x_atoms_wm_protocols[protocol]; + + if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count)) + { + protos = NULL; + protos_count = 0; + } + + for (i = 0; i < protos_count; i++) + { + if (protos[i] == proto) + { + already_set = 1; + break; + } + } + + if (on) + { + Atom *new_protos = NULL; + + if (already_set) + goto leave; + + new_protos = malloc((protos_count + 1) * sizeof(Atom)); + if (!new_protos) + goto leave; + + for (i = 0; i < protos_count; i++) + new_protos[i] = protos[i]; + new_protos[protos_count] = proto; + XSetWMProtocols(_ecore_x_disp, win, new_protos, protos_count + 1); + free(new_protos); + } + else + { + if (!already_set) + goto leave; + + for (i = 0; i < protos_count; i++) + { + if (protos[i] == proto) + { + int j; + + for (j = i + 1; j < protos_count; j++) + protos[j - 1] = protos[j]; + if (protos_count > 1) + XSetWMProtocols(_ecore_x_disp, win, protos, + protos_count - 1); + else + XDeleteProperty(_ecore_x_disp, win, + ECORE_X_ATOM_WM_PROTOCOLS); + + goto leave; + } + } + } + +leave: + if (protos) + XFree(protos); +} /* ecore_x_icccm_protocol_set */ + +/** + * Determines whether a protocol is set for a window. + * @param win The Window + * @param protocol The protocol to query + * @return 1 if the protocol is set, else 0. + */ +EAPI Eina_Bool +ecore_x_icccm_protocol_isset(Ecore_X_Window win, + Ecore_X_WM_Protocol protocol) +{ + Atom proto, *protos = NULL; + int i, protos_count = 0; + Eina_Bool ret = EINA_FALSE; + + /* check for invalid values */ + if (protocol >= ECORE_X_WM_PROTOCOL_NUM) + return EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + proto = _ecore_x_atoms_wm_protocols[protocol]; + + if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count)) + return EINA_FALSE; + + for (i = 0; i < protos_count; i++) + if (protos[i] == proto) + { + ret = EINA_TRUE; + break; + } + + if (protos) + XFree(protos); + + return ret; +} /* ecore_x_icccm_protocol_isset */ + +/** + * Set a window name & class. + * @param win The window + * @param n The name string + * @param c The class string + * + * Set a window name * class + */ +EAPI void +ecore_x_icccm_name_class_set(Ecore_X_Window win, + const char *n, + const char *c) +{ + XClassHint *xch; + + xch = XAllocClassHint(); + if (!xch) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xch->res_name = (char *)n; + xch->res_class = (char *)c; + XSetClassHint(_ecore_x_disp, win, xch); + XFree(xch); +} /* ecore_x_icccm_name_class_set */ + +/** + * Get a window name & class. + * @param win The window + * @param n The name string + * @param c The class string + * + * Get a window name * class + */ +EAPI void +ecore_x_icccm_name_class_get(Ecore_X_Window win, + char **n, + char **c) +{ + XClassHint xch; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (n) + *n = NULL; + + if (c) + *c = NULL; + + xch.res_name = NULL; + xch.res_class = NULL; + if (XGetClassHint(_ecore_x_disp, win, &xch)) + { + if (n) + if (xch.res_name) + *n = strdup(xch.res_name); + + if (c) + if (xch.res_class) + *c = strdup(xch.res_class); + + XFree(xch.res_name); + XFree(xch.res_class); + } +} /* ecore_x_icccm_name_class_get */ + +/** + * Get a window client machine string. + * @param win The window + * @return The windows client machine string + * + * Return the client machine of a window. String must be free'd when done with. + */ +EAPI char * +ecore_x_icccm_client_machine_get(Ecore_X_Window win) +{ + char *name; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + name = ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_CLIENT_MACHINE); + return name; +} /* ecore_x_icccm_client_machine_get */ + +/** + * Sets the WM_COMMAND property for @a win. + * + * @param win The window. + * @param argc Number of arguments. + * @param argv Arguments. + */ +EAPI void +ecore_x_icccm_command_set(Ecore_X_Window win, + int argc, + char **argv) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSetCommand(_ecore_x_disp, win, argv, argc); +} /* ecore_x_icccm_command_set */ + +/** + * Get the WM_COMMAND property for @a win. + * + * Return the command of a window. String must be free'd when done with. + * + * @param win The window. + * @param argc Number of arguments. + * @param argv Arguments. + */ +EAPI void +ecore_x_icccm_command_get(Ecore_X_Window win, + int *argc, + char ***argv) +{ + int i, c; + char **v; + + if (argc) + *argc = 0; + + if (argv) + *argv = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!XGetCommand(_ecore_x_disp, win, &v, &c)) + return; + + if (c < 1) + { + if (v) + XFreeStringList(v); + + return; + } + + if (argc) + *argc = c; + + if (argv) + { + (*argv) = malloc(c * sizeof(char *)); + if (!*argv) + { + XFreeStringList(v); + if (argc) + *argc = 0; + + return; + } + + for (i = 0; i < c; i++) + { + if (v[i]) + (*argv)[i] = strdup(v[i]); + else + (*argv)[i] = strdup(""); + } + } + + XFreeStringList(v); +} /* ecore_x_icccm_command_get */ + +/** + * Set a window icon name. + * @param win The window + * @param t The icon name string + * + * Set a window icon name + */ +EAPI void +ecore_x_icccm_icon_name_set(Ecore_X_Window win, + const char *t) +{ + char *list[1]; + XTextProperty xprop; + int ret; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xprop.value = NULL; +#ifdef X_HAVE_UTF8_STRING + list[0] = strdup(t); + ret = Xutf8TextListToTextProperty(_ecore_x_disp, list, 1, + XUTF8StringStyle, &xprop); +#else /* ifdef X_HAVE_UTF8_STRING */ + list[0] = strdup(t); + ret = XmbTextListToTextProperty(_ecore_x_disp, list, 1, + XStdICCTextStyle, &xprop); +#endif /* ifdef X_HAVE_UTF8_STRING */ + if (ret >= Success) + { + XSetWMIconName(_ecore_x_disp, win, &xprop); + if (xprop.value) + XFree(xprop.value); + } + else if (XStringListToTextProperty(list, 1, &xprop) >= Success) + { + XSetWMIconName(_ecore_x_disp, win, &xprop); + if (xprop.value) + XFree(xprop.value); + } + + free(list[0]); +} /* ecore_x_icccm_icon_name_set */ + +/** + * Get a window icon name. + * @param win The window + * @return The windows icon name string + * + * Return the icon name of a window. String must be free'd when done with. + */ +EAPI char * +ecore_x_icccm_icon_name_get(Ecore_X_Window win) +{ + XTextProperty xprop; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xprop.value = NULL; + if (XGetWMIconName(_ecore_x_disp, win, &xprop) >= Success) + { + if (xprop.value) + { + char **list = NULL; + char *t = NULL; + int num = 0; + int ret; + + if (xprop.encoding == ECORE_X_ATOM_UTF8_STRING) + t = strdup((char *)xprop.value); + else + { + /* convert to utf8 */ +#ifdef X_HAVE_UTF8_STRING + ret = Xutf8TextPropertyToTextList(_ecore_x_disp, &xprop, + &list, &num); +#else /* ifdef X_HAVE_UTF8_STRING */ + ret = XmbTextPropertyToTextList(_ecore_x_disp, &xprop, + &list, &num); +#endif /* ifdef X_HAVE_UTF8_STRING */ + + if ((ret == XLocaleNotSupported) || + (ret == XNoMemory) || (ret == XConverterNotFound)) + t = strdup((char *)xprop.value); + else if (ret >= Success) + { + if ((num >= 1) && (list)) + t = strdup(list[0]); + + if (list) + XFreeStringList(list); + } + } + + if (xprop.value) + XFree(xprop.value); + + return t; + } + } + + return NULL; +} /* ecore_x_icccm_icon_name_get */ + +/** + * Add a subwindow to the list of windows that need a different colormap installed. + * @param win The toplevel window + * @param subwin The subwindow to be added to the colormap windows list + */ +EAPI void +ecore_x_icccm_colormap_window_set(Ecore_X_Window win, + Ecore_X_Window subwin) +{ + int num = 0, i; + unsigned char *old_data = NULL; + unsigned char *data = NULL; + Window *oldset = NULL; + Window *newset = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_property_get(win, + ECORE_X_ATOM_WM_COLORMAP_WINDOWS, + XA_WINDOW, 32, &old_data, &num)) + { + newset = calloc(1, sizeof(Window)); + if (!newset) + return; + + newset[0] = subwin; + num = 1; + data = (unsigned char *)newset; + } + else + { + newset = calloc(num + 1, sizeof(Window)); + oldset = (Window *)old_data; + if (!newset) + return; + + for (i = 0; i < num; ++i) + { + if (oldset[i] == subwin) + { + if (old_data) + XFree(old_data); + + old_data = NULL; + free(newset); + return; + } + + newset[i] = oldset[i]; + } + + newset[num++] = subwin; + if (old_data) + XFree(old_data); + + data = (unsigned char *)newset; + } + + ecore_x_window_prop_property_set(win, + ECORE_X_ATOM_WM_COLORMAP_WINDOWS, + XA_WINDOW, 32, data, num); + free(newset); +} /* ecore_x_icccm_colormap_window_set */ + +/** + * Remove a window from the list of colormap windows. + * @param win The toplevel window + * @param subwin The window to be removed from the colormap window list. + */ +EAPI void +ecore_x_icccm_colormap_window_unset(Ecore_X_Window win, + Ecore_X_Window subwin) +{ + int num = 0, i, j, k = 0; + unsigned char *old_data = NULL; + unsigned char *data = NULL; + Window *oldset = NULL; + Window *newset = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_prop_property_get(win, + ECORE_X_ATOM_WM_COLORMAP_WINDOWS, + XA_WINDOW, 32, &old_data, &num)) + return; + + oldset = (Window *)old_data; + for (i = 0; i < num; i++) + { + if (oldset[i] == subwin) + { + if (num == 1) + { + XDeleteProperty(_ecore_x_disp, + win, ECORE_X_ATOM_WM_COLORMAP_WINDOWS); + if (old_data) + XFree(old_data); + + old_data = NULL; + return; + } + else + { + newset = calloc(num - 1, sizeof(Window)); + data = (unsigned char *)newset; + for (j = 0; j < num; ++j) + if (oldset[j] != subwin) + newset[k++] = oldset[j]; + + ecore_x_window_prop_property_set( + win, + ECORE_X_ATOM_WM_COLORMAP_WINDOWS, + XA_WINDOW, + 32, + data, + k); + if (old_data) + XFree(old_data); + + old_data = NULL; + free(newset); + return; + } + } + } + + if (old_data) + XFree(old_data); +} /* ecore_x_icccm_colormap_window_unset */ + +/** + * Specify that a window is transient for another top-level window and should be handled accordingly. + * @param win the transient window + * @param forwin the toplevel window + */ +EAPI void +ecore_x_icccm_transient_for_set(Ecore_X_Window win, + Ecore_X_Window forwin) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSetTransientForHint(_ecore_x_disp, win, forwin); +} /* ecore_x_icccm_transient_for_set */ + +/** + * Remove the transient_for setting from a window. + * @param The window + */ +EAPI void +ecore_x_icccm_transient_for_unset(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XDeleteProperty(_ecore_x_disp, win, ECORE_X_ATOM_WM_TRANSIENT_FOR); +} /* ecore_x_icccm_transient_for_unset */ + +/** + * Get the window this window is transient for, if any. + * @param win The window to check + * @return The window ID of the top-level window, or 0 if the property does not exist. + */ +EAPI Ecore_X_Window +ecore_x_icccm_transient_for_get(Ecore_X_Window win) +{ + Window forwin; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (XGetTransientForHint(_ecore_x_disp, win, &forwin)) + return (Ecore_X_Window)forwin; + else + return 0; +} /* ecore_x_icccm_transient_for_get */ + +/** + * Set the window role hint. + * @param win The window + * @param role The role string + */ +EAPI void +ecore_x_icccm_window_role_set(Ecore_X_Window win, + const char *role) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_WINDOW_ROLE, + (char *)role); +} /* ecore_x_icccm_window_role_set */ + +/** + * Get the window role. + * @param win The window + * @return The window's role string. + */ +EAPI char * +ecore_x_icccm_window_role_get(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return ecore_x_window_prop_string_get(win, ECORE_X_ATOM_WM_WINDOW_ROLE); +} /* ecore_x_icccm_window_role_get */ + +/** + * Set the window's client leader. + * @param win The window + * @param l The client leader window + * + * All non-transient top-level windows created by an app other than + * the main window must have this property set to the app's main window. + */ +EAPI void +ecore_x_icccm_client_leader_set(Ecore_X_Window win, + Ecore_X_Window l) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_window_set(win, ECORE_X_ATOM_WM_CLIENT_LEADER, + &l, 1); +} /* ecore_x_icccm_client_leader_set */ + +/** + * Get the window's client leader. + * @param win The window + * @return The window's client leader window, or 0 if unset */ +EAPI Ecore_X_Window +ecore_x_icccm_client_leader_get(Ecore_X_Window win) +{ + Ecore_X_Window l; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (ecore_x_window_prop_window_get(win, ECORE_X_ATOM_WM_CLIENT_LEADER, + &l, 1) > 0) + return l; + + return 0; +} /* ecore_x_icccm_client_leader_get */ + +EAPI void +ecore_x_icccm_iconic_request_send(Ecore_X_Window win, + Ecore_X_Window root) +{ + XEvent xev; + + if (!win) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + + xev.xclient.type = ClientMessage; + xev.xclient.serial = 0; + xev.xclient.send_event = True; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.format = 32; + xev.xclient.message_type = ECORE_X_ATOM_WM_CHANGE_STATE; + xev.xclient.data.l[0] = IconicState; + + XSendEvent(_ecore_x_disp, root, False, + SubstructureNotifyMask | SubstructureRedirectMask, &xev); +} /* ecore_x_icccm_iconic_request_send */ + +/* FIXME: there are older E hints, gnome hints and mwm hints and new netwm */ +/* hints. each should go in their own file/section so we know which */ +/* is which. also older kde hints too. we should try support as much */ +/* as makese sense to support */ diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_image.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_image.c new file mode 100644 index 0000000..2de5319 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_image.c @@ -0,0 +1,598 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "ecore_x_private.h" +#include "Ecore_X.h" + +#include +#include +#include +#include +#include + +static int _ecore_x_image_shm_can = -1; +static int _ecore_x_image_err = 0; + +static int +_ecore_x_image_error_handler(Display *d __UNUSED__, + XErrorEvent *ev __UNUSED__) +{ + _ecore_x_image_err = 1; + return 0; +} /* _ecore_x_image_error_handler */ + +static void +_ecore_x_image_shm_check(void) +{ + XErrorHandler ph; + XShmSegmentInfo shminfo; + XImage *xim; + + if (_ecore_x_image_shm_can != -1) + return; + + XSync(_ecore_x_disp, False); + _ecore_x_image_err = 0; + + xim = XShmCreateImage(_ecore_x_disp, + DefaultVisual(_ecore_x_disp, + DefaultScreen(_ecore_x_disp)), + DefaultDepth(_ecore_x_disp, + DefaultScreen(_ecore_x_disp)), + ZPixmap, NULL, + &shminfo, 1, 1); + if (!xim) + { + _ecore_x_image_shm_can = 0; + return; + } + + shminfo.shmid = shmget(IPC_PRIVATE, xim->bytes_per_line * xim->height, + IPC_CREAT | 0666); + if (shminfo.shmid == -1) + { + XDestroyImage(xim); + _ecore_x_image_shm_can = 0; + return; + } + + shminfo.readOnly = False; + shminfo.shmaddr = shmat(shminfo.shmid, 0, 0); + xim->data = shminfo.shmaddr; + + if (xim->data == (char *)-1) + { + XDestroyImage(xim); + _ecore_x_image_shm_can = 0; + return; + } + + ph = XSetErrorHandler((XErrorHandler)_ecore_x_image_error_handler); + XShmAttach(_ecore_x_disp, &shminfo); + XShmGetImage(_ecore_x_disp, DefaultRootWindow(_ecore_x_disp), + xim, 0, 0, 0xffffffff); + XSync(_ecore_x_disp, False); + XSetErrorHandler((XErrorHandler)ph); + if (_ecore_x_image_err) + { + XShmDetach(_ecore_x_disp, &shminfo); + XDestroyImage(xim); + shmdt(shminfo.shmaddr); + shmctl(shminfo.shmid, IPC_RMID, 0); + _ecore_x_image_shm_can = 0; + return; + } + + XShmDetach(_ecore_x_disp, &shminfo); + XDestroyImage(xim); + shmdt(shminfo.shmaddr); + shmctl(shminfo.shmid, IPC_RMID, 0); + + _ecore_x_image_shm_can = 1; +} /* _ecore_x_image_shm_check */ + +struct _Ecore_X_Image +{ + XShmSegmentInfo shminfo; + Ecore_X_Visual vis; + XImage *xim; + int depth; + int w, h; + int bpl, bpp, rows; + unsigned char *data; + Eina_Bool shm : 1; +}; + +EAPI Ecore_X_Image * +ecore_x_image_new(int w, + int h, + Ecore_X_Visual vis, + int depth) +{ + Ecore_X_Image *im; + + im = calloc(1, sizeof(Ecore_X_Image)); + if (!im) + return NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + im->w = w; + im->h = h; + im->vis = vis; + im->depth = depth; + _ecore_x_image_shm_check(); + im->shm = _ecore_x_image_shm_can; + return im; +} /* ecore_x_image_new */ + +EAPI void +ecore_x_image_free(Ecore_X_Image *im) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (im->shm) + { + if (im->xim) + { + XShmDetach(_ecore_x_disp, &(im->shminfo)); + XDestroyImage(im->xim); + shmdt(im->shminfo.shmaddr); + shmctl(im->shminfo.shmid, IPC_RMID, 0); + } + } + else if (im->xim) + { + free(im->xim->data); + im->xim->data = NULL; + XDestroyImage(im->xim); + } + + free(im); +} /* ecore_x_image_free */ + +static void +_ecore_x_image_shm_create(Ecore_X_Image *im) +{ + im->xim = XShmCreateImage(_ecore_x_disp, im->vis, im->depth, + ZPixmap, NULL, &(im->shminfo), + im->w, im->h); + if (!im->xim) + return; + + im->shminfo.shmid = shmget(IPC_PRIVATE, + im->xim->bytes_per_line * im->xim->height, + IPC_CREAT | 0666); + if (im->shminfo.shmid == -1) + { + XDestroyImage(im->xim); + return; + } + + im->shminfo.readOnly = False; + im->shminfo.shmaddr = shmat(im->shminfo.shmid, 0, 0); + im->xim->data = im->shminfo.shmaddr; + if ((im->xim->data == (char *)-1) || + (!im->xim->data)) + { + shmdt(im->shminfo.shmaddr); + shmctl(im->shminfo.shmid, IPC_RMID, 0); + XDestroyImage(im->xim); + return; + } + + XShmAttach(_ecore_x_disp, &im->shminfo); + + im->data = (unsigned char *)im->xim->data; + + im->bpl = im->xim->bytes_per_line; + im->rows = im->xim->height; + if (im->xim->bits_per_pixel <= 8) + im->bpp = 1; + else if (im->xim->bits_per_pixel <= 16) + im->bpp = 2; + else + im->bpp = 4; +} /* _ecore_x_image_shm_create */ + +EAPI Eina_Bool +ecore_x_image_get(Ecore_X_Image *im, + Ecore_X_Drawable draw, + int x, + int y, + int sx, + int sy, + int w, + int h) +{ + Eina_Bool ret = EINA_TRUE; + XErrorHandler ph; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (im->shm) + { + if (!im->xim) + _ecore_x_image_shm_create(im); + + if (!im->xim) + return 0; + + _ecore_x_image_err = 0; + // optimised path + ph = XSetErrorHandler((XErrorHandler)_ecore_x_image_error_handler); + if ((sx == 0) && (w == im->w)) + { + im->xim->data = (char *) + im->data + (im->xim->bytes_per_line * sy) + (sx * im->bpp); + im->xim->width = w; + im->xim->height = h; + XGrabServer(_ecore_x_disp); + if (!XShmGetImage(_ecore_x_disp, draw, im->xim, x, y, 0xffffffff)) + ret = EINA_FALSE; + XUngrabServer(_ecore_x_disp); + ecore_x_sync(); + } + // unavoidable thanks to mit-shm get api - tmp shm buf + copy into it + else + { + Ecore_X_Image *tim; + unsigned char *spixels, *sp, *pixels, *p; + int bpp, bpl, rows, sbpp, sbpl, srows; + int r; + + tim = ecore_x_image_new(w, h, im->vis, im->depth); + if (tim) + { + ret = ecore_x_image_get(tim, draw, x, y, 0, 0, w, h); + if (ret) + { + spixels = ecore_x_image_data_get(tim, + &sbpl, + &srows, + &sbpp); + pixels = ecore_x_image_data_get(im, &bpl, &rows, &bpp); + if ((pixels) && (spixels)) + { + p = pixels + (sy * bpl) + (sx * bpp); + sp = spixels; + for (r = srows; r > 0; r--) + { + memcpy(p, sp, sbpl); + p += bpl; + sp += sbpl; + } + } + } + + ecore_x_image_free(tim); + } + } + + XSetErrorHandler((XErrorHandler)ph); + if (_ecore_x_image_err) + ret = EINA_FALSE; + } + else + { + printf("currently unimplemented ecore_x_image_get without shm\n"); + ret = EINA_FALSE; + } + + return ret; +} /* ecore_x_image_get */ + +EAPI void +ecore_x_image_put(Ecore_X_Image *im, + Ecore_X_Drawable draw, + Ecore_X_GC gc, + int x, + int y, + int sx, + int sy, + int w, + int h) +{ + Ecore_X_GC tgc = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!gc) + { + XGCValues gcv; + memset(&gcv, 0, sizeof(gcv)); + gcv.subwindow_mode = IncludeInferiors; + tgc = XCreateGC(_ecore_x_disp, draw, GCSubwindowMode, &gcv); + gc = tgc; + } + if (!im->xim) _ecore_x_image_shm_create(im); + if (im->xim) + XShmPutImage(_ecore_x_disp, draw, gc, im->xim, sx, sy, x, y, w, h, False); + if (tgc) ecore_x_gc_free(tgc); +} /* ecore_x_image_put */ + +EAPI void * +ecore_x_image_data_get(Ecore_X_Image *im, + int *bpl, + int *rows, + int *bpp) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!im->xim) _ecore_x_image_shm_create(im); + if (!im->xim) return NULL; + if (bpl) *bpl = im->bpl; + if (rows) *rows = im->rows; + if (bpp) *bpp = im->bpp; + return im->data; +} /* ecore_x_image_data_get */ + +EAPI Eina_Bool +ecore_x_image_is_argb32_get(Ecore_X_Image *im) +{ + Visual *vis = im->vis; + if (!im->xim) _ecore_x_image_shm_create(im); + if (((vis->class == TrueColor) || + (vis->class == DirectColor)) && + (im->depth >= 24) && + (vis->red_mask == 0xff0000) && + (vis->green_mask == 0x00ff00) && + (vis->blue_mask == 0x0000ff)) + { +#ifdef WORDS_BIGENDIAN + if (im->xim->bitmap_bit_order == LSBFirst) return EINA_TRUE; +#else + if (im->xim->bitmap_bit_order == MSBFirst) return EINA_TRUE; +#endif + } + return EINA_FALSE; +} + +EAPI Eina_Bool +ecore_x_image_to_argb_convert(void *src, + int sbpp, + int sbpl, + Ecore_X_Colormap c, + Ecore_X_Visual v, + int x, + int y, + int w, + int h, + unsigned int *dst, + int dbpl, + int dx, + int dy) +{ + Visual *vis = v; + XColor *cols = NULL; + int n = 0, nret = 0, i, row; + unsigned int pal[256], r, g, b; + enum + { + rgbnone = 0, + rgb565, + bgr565, + rgbx555, + argbx888, + abgrx888, + rgba888x, + bgra888x, + argbx666 + }; + int mode = 0; + + sbpp *= 8; + + n = vis->map_entries; + if ((n <= 256) && + ((vis->class == PseudoColor) || + (vis->class == StaticColor) || + (vis->class == GrayScale) || + (vis->class == StaticGray))) + { + if (!c) + c = DefaultColormap(_ecore_x_disp, + DefaultScreen(_ecore_x_disp)); + cols = alloca(n * sizeof(XColor)); + for (i = 0; i < n; i++) + { + cols[i].pixel = i; + cols[i].flags = DoRed | DoGreen | DoBlue; + cols[i].red = 0; + cols[i].green = 0; + cols[i].blue = 0; + } + XQueryColors(_ecore_x_disp, c, cols, n); + for (i = 0; i < n; i++) + { + pal[i] = 0xff000000 | + ((cols[i].red >> 8) << 16) | + ((cols[i].green >> 8) << 8) | + ((cols[i].blue >> 8)); + } + nret = n; + } + else if ((vis->class == TrueColor) || + (vis->class == DirectColor)) + { + if ((vis->red_mask == 0x00ff0000) && + (vis->green_mask == 0x0000ff00) && + (vis->blue_mask == 0x000000ff)) + mode = argbx888; + else if ((vis->red_mask == 0x000000ff) && + (vis->green_mask == 0x0000ff00) && + (vis->blue_mask == 0x00ff0000)) + mode = abgrx888; + else if ((vis->red_mask == 0xff000000) && + (vis->green_mask == 0x00ff0000) && + (vis->blue_mask == 0x0000ff00)) + mode = rgba888x; + else if ((vis->red_mask == 0x0000ff00) && + (vis->green_mask == 0x00ff0000) && + (vis->blue_mask == 0xff000000)) + mode = bgra888x; + else if ((vis->red_mask == 0x0003f000) && + (vis->green_mask == 0x00000fc0) && + (vis->blue_mask == 0x0000003f)) + mode = argbx666; + else if ((vis->red_mask == 0x0000f800) && + (vis->green_mask == 0x000007e0) && + (vis->blue_mask == 0x0000001f)) + mode = rgb565; + else if ((vis->red_mask == 0x0000001f) && + (vis->green_mask == 0x000007e0) && + (vis->blue_mask == 0x0000f800)) + mode = bgr565; + else if ((vis->red_mask == 0x00007c00) && + (vis->green_mask == 0x000003e0) && + (vis->blue_mask == 0x0000001f)) + mode = rgbx555; + else + return EINA_FALSE; + } + for (row = 0; row < h; row++) + { + unsigned char *s8; + unsigned short *s16; + unsigned int *s32; + unsigned int *dp, *de; + + dp = ((unsigned int *)(((unsigned char *)dst) + + ((dy + row) * dbpl))) + dx; + de = dp + w; + switch (sbpp) + { + case 8: + s8 = ((unsigned char *)(((unsigned char *)src) + ((y + row) * sbpl))) + x; + if (nret > 0) + { + while (dp < de) + { + *dp = pal[*s8]; + s8++; dp++; + } + } + else + return EINA_FALSE; + break; + + case 16: + s16 = ((unsigned short *)(((unsigned char *)src) + ((y + row) * sbpl))) + x; + switch (mode) + { + case rgb565: + while (dp < de) + { + r = (*s16 & 0xf800) << 8; + g = (*s16 & 0x07e0) << 5; + b = (*s16 & 0x001f) << 3; + r |= (r >> 5) & 0xff0000; + g |= (g >> 6) & 0x00ff00; + b |= (b >> 5); + *dp = 0xff000000 | r | g | b; + s16++; dp++; + } + break; + + case bgr565: + while (dp < de) + { + r = (*s16 & 0x001f) << 19; + g = (*s16 & 0x07e0) << 5; + b = (*s16 & 0xf800) >> 8; + r |= (r >> 5) & 0xff0000; + g |= (g >> 6) & 0x00ff00; + b |= (b >> 5); + *dp = 0xff000000 | r | g | b; + s16++; dp++; + } + break; + + case rgbx555: + while (dp < de) + { + r = (*s16 & 0x7c00) << 9; + g = (*s16 & 0x03e0) << 6; + b = (*s16 & 0x001f) << 3; + r |= (r >> 5) & 0xff0000; + g |= (g >> 5) & 0x00ff00; + b |= (b >> 5); + *dp = 0xff000000 | r | g | b; + s16++; dp++; + } + break; + + default: + return EINA_FALSE; + break; + } + break; + + case 24: + case 32: + s32 = ((unsigned int *)(((unsigned char *)src) + ((y + row) * sbpl))) + x; + switch (mode) + { + case argbx888: + while (dp < de) + { + *dp = 0xff000000 | *s32; + s32++; dp++; + } + break; + + case abgrx888: + while (dp < de) + { + r = *s32 & 0x000000ff; + g = *s32 & 0x0000ff00; + b = *s32 & 0x00ff0000; + *dp = 0xff000000 | (r << 16) | (g) | (b >> 16); + s32++; dp++; + } + break; + + case rgba888x: + while (dp < de) + { + *dp = 0xff000000 | (*s32 >> 8); + s32++; dp++; + } + break; + + case bgra888x: + while (dp < de) + { + r = *s32 & 0x0000ff00; + g = *s32 & 0x00ff0000; + b = *s32 & 0xff000000; + *dp = 0xff000000 | (r << 8) | (g >> 8) | (b >> 24); + s32++; dp++; + } + break; + + case argbx666: + while (dp < de) + { + r = (*s32 & 0x3f000) << 6; + g = (*s32 & 0x00fc0) << 4; + b = (*s32 & 0x0003f) << 2; + r |= (r >> 6) & 0xff0000; + g |= (g >> 6) & 0x00ff00; + b |= (b >> 6); + *dp = 0xff000000 | r | g | b; + s32++; dp++; + } + break; + + default: + return EINA_FALSE; + break; + } + break; + break; + + default: + return EINA_FALSE; + break; + } + } + return EINA_TRUE; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c new file mode 100644 index 0000000..7459a8b --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_mwm.c @@ -0,0 +1,106 @@ +/* + * Various MWM related functions. + * + * This is ALL the code involving anything MWM related. for both WM and + * client. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include "Ecore_X_Atoms.h" + +#define ECORE_X_MWM_HINTS_FUNCTIONS (1 << 0) +#define ECORE_X_MWM_HINTS_DECORATIONS (1 << 1) +#define ECORE_X_MWM_HINTS_INPUT_MODE (1 << 2) +#define ECORE_X_MWM_HINTS_STATUS (1 << 3) + +typedef struct _mwmhints +{ + CARD32 flags; + CARD32 functions; + CARD32 decorations; + INT32 inputmode; + CARD32 status; +} +MWMHints; + +EAPI Eina_Bool +ecore_x_mwm_hints_get(Ecore_X_Window win, + Ecore_X_MWM_Hint_Func *fhint, + Ecore_X_MWM_Hint_Decor *dhint, + Ecore_X_MWM_Hint_Input *ihint) +{ + unsigned char *p = NULL; + MWMHints *mwmhints = NULL; + int num; + Eina_Bool ret; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = EINA_FALSE; + if (!ecore_x_window_prop_property_get(win, + ECORE_X_ATOM_MOTIF_WM_HINTS, + ECORE_X_ATOM_MOTIF_WM_HINTS, + 32, &p, &num)) + return EINA_FALSE; + + mwmhints = (MWMHints *)p; + if (mwmhints) + { + if (num >= 4) + { + if (dhint) + { + if (mwmhints->flags & ECORE_X_MWM_HINTS_DECORATIONS) + *dhint = mwmhints->decorations; + else + *dhint = ECORE_X_MWM_HINT_DECOR_ALL; + } + + if (fhint) + { + if (mwmhints->flags & ECORE_X_MWM_HINTS_FUNCTIONS) + *fhint = mwmhints->functions; + else + *fhint = ECORE_X_MWM_HINT_FUNC_ALL; + } + + if (ihint) + { + if (mwmhints->flags & ECORE_X_MWM_HINTS_INPUT_MODE) + *ihint = mwmhints->inputmode; + else + *ihint = ECORE_X_MWM_HINT_INPUT_MODELESS; + } + + ret = EINA_TRUE; + } + + free(mwmhints); + } + + return ret; +} /* ecore_x_mwm_hints_get */ + +EAPI void +ecore_x_mwm_borderless_set(Ecore_X_Window win, + Eina_Bool borderless) +{ + unsigned int data[5] = {0, 0, 0, 0, 0}; + + data[0] = 2; /* just set the decorations hint! */ + data[2] = !borderless; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_property_set(win, + ECORE_X_ATOM_MOTIF_WM_HINTS, + ECORE_X_ATOM_MOTIF_WM_HINTS, + 32, (void *)data, 5); +} /* ecore_x_mwm_borderless_set */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c new file mode 100644 index 0000000..1a6fc9a --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_netwm.c @@ -0,0 +1,2003 @@ +/* + * _NET_WM... aka Extended Window Manager Hint (EWMH) functions. + */ + +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include +#include + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" + +typedef struct _Ecore_X_Startup_Info Ecore_X_Startup_Info; + +struct _Ecore_X_Startup_Info +{ + Ecore_X_Window win; + + int init; + + int buffer_size; + char *buffer; + + int length; + + /* These are the sequence info fields */ + char *id; + char *name; + int screen; + char *bin; + char *icon; + int desktop; + int timestamp; + char *description; + char *wmclass; + int silent; +}; + +static void _ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, + Ecore_X_Atom atom, + const char *str); +static char *_ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, + Ecore_X_Atom atom); +#if 0 /* Unused */ +static int _ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info); +static int _ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, + char *data); +#endif /* if 0 */ +static void _ecore_x_netwm_startup_info_free(void *data); + +/* + * Convenience macros + */ +#define _ATOM_SET_UTF8_STRING_LIST(win, atom, string, cnt) \ + XChangeProperty(_ecore_x_disp, \ + win, \ + atom, \ + ECORE_X_ATOM_UTF8_STRING, \ + 8, \ + PropModeReplace, \ + (unsigned char *)string, \ + cnt) + +/* + * Local variables + */ + +static Eina_Hash *startup_info = NULL; + +EAPI void +ecore_x_netwm_init(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + startup_info = eina_hash_string_superfast_new( + _ecore_x_netwm_startup_info_free); +} /* ecore_x_netwm_init */ + +EAPI void +ecore_x_netwm_shutdown(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (startup_info) + eina_hash_free(startup_info); + + startup_info = NULL; +} /* ecore_x_netwm_shutdown */ + +/* + * WM identification + */ +EAPI void +ecore_x_netwm_wm_identify(Ecore_X_Window root, + Ecore_X_Window check, + const char *wm_name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_window_set(root, + ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, + &check, + 1); + ecore_x_window_prop_window_set(check, + ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, + &check, + 1); + _ecore_x_window_prop_string_utf8_set(check, + ECORE_X_ATOM_NET_WM_NAME, + wm_name); + /* This one isn't mandatory */ + _ecore_x_window_prop_string_utf8_set(root, + ECORE_X_ATOM_NET_WM_NAME, + wm_name); +} /* ecore_x_netwm_wm_identify */ + +/* + * Set supported atoms + */ +EAPI void +ecore_x_netwm_supported_set(Ecore_X_Window root, + Ecore_X_Atom *supported, + int num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_atom_set(root, + ECORE_X_ATOM_NET_SUPPORTED, + supported, + num); +} /* ecore_x_netwm_supported_set */ + +EAPI Eina_Bool +ecore_x_netwm_supported_get(Ecore_X_Window root, + Ecore_X_Atom **supported, + int *num) +{ + int num_ret; + + if (num) + *num = 0; + + if (supported) + *supported = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + num_ret = ecore_x_window_prop_atom_list_get(root, ECORE_X_ATOM_NET_SUPPORTED, + supported); + if (num_ret <= 0) + return EINA_FALSE; + + if (num) + *num = num_ret; + + return EINA_TRUE; +} /* ecore_x_netwm_supported_get */ + +/* + * Desktop configuration and status + */ +EAPI void +ecore_x_netwm_desk_count_set(Ecore_X_Window root, + unsigned int n_desks) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_NUMBER_OF_DESKTOPS, + &n_desks, 1); +} /* ecore_x_netwm_desk_count_set */ + +EAPI void +ecore_x_netwm_desk_roots_set(Ecore_X_Window root, + Ecore_X_Window *vroots, + unsigned int n_desks) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_window_set(root, + ECORE_X_ATOM_NET_VIRTUAL_ROOTS, + vroots, + n_desks); +} /* ecore_x_netwm_desk_roots_set */ + +EAPI void +ecore_x_netwm_desk_names_set(Ecore_X_Window root, + const char **names, + unsigned int n_desks) +{ + char ss[32], *buf, *t; + const char *s; + unsigned int i; + int l, len; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + buf = NULL; + len = 0; + + for (i = 0; i < n_desks; i++) + { + s = (names) ? names[i] : NULL; + if (!s) + { + /* Default to "Desk-" */ + sprintf(ss, "Desk-%d", i); + s = ss; + } + + l = strlen(s) + 1; + t = realloc(buf, len + l); + if (t) + { + buf = t; + memcpy(buf + len, s, l); + } + len += l; + } + + _ATOM_SET_UTF8_STRING_LIST(root, ECORE_X_ATOM_NET_DESKTOP_NAMES, buf, len); + + free(buf); +} /* ecore_x_netwm_desk_names_set */ + +EAPI void +ecore_x_netwm_desk_size_set(Ecore_X_Window root, + unsigned int width, + unsigned int height) +{ + unsigned int size[2]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + size[0] = width; + size[1] = height; + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_GEOMETRY, size, + 2); +} /* ecore_x_netwm_desk_size_set */ + +EAPI void +ecore_x_netwm_desk_viewports_set(Ecore_X_Window root, + unsigned int *origins, + unsigned int n_desks) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_VIEWPORT, + origins, 2 * n_desks); +} /* ecore_x_netwm_desk_viewports_set */ + +EAPI void +ecore_x_netwm_desk_layout_set(Ecore_X_Window root, + int orientation, + int columns, + int rows, + int starting_corner) +{ + unsigned int layout[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + layout[0] = orientation; + layout[1] = columns; + layout[2] = rows; + layout[3] = starting_corner; + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_DESKTOP_LAYOUT, + layout, 4); +} /* ecore_x_netwm_desk_layout_set */ + +EAPI void +ecore_x_netwm_desk_workareas_set(Ecore_X_Window root, + unsigned int *areas, + unsigned int n_desks) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_WORKAREA, areas, + 4 * n_desks); +} /* ecore_x_netwm_desk_workareas_set */ + +EAPI unsigned int * +ecore_x_netwm_desk_workareas_get(Ecore_X_Window root, unsigned int *n_desks) +{ + int ret; + unsigned int *areas = NULL; + + if (!root) root = DefaultRootWindow(_ecore_x_disp); + + ret = ecore_x_window_prop_card32_list_get(root, ECORE_X_ATOM_NET_WORKAREA, + &areas); + if (!areas) + { + if (n_desks) *n_desks = 0; + return 0; + } + if (n_desks) *n_desks = ret / 4; + return areas; +} + +EAPI void +ecore_x_netwm_desk_current_set(Ecore_X_Window root, + unsigned int desk) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_CURRENT_DESKTOP, &desk, + 1); +} /* ecore_x_netwm_desk_current_set */ + +EAPI void +ecore_x_netwm_showing_desktop_set(Ecore_X_Window root, + Eina_Bool on) +{ + unsigned int val; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + val = (on) ? 1 : 0; + ecore_x_window_prop_card32_set(root, ECORE_X_ATOM_NET_SHOWING_DESKTOP, &val, + 1); +} /* ecore_x_netwm_showing_desktop_set */ + +/* + * Client status + */ + +/* Mapping order */ +EAPI void +ecore_x_netwm_client_list_set(Ecore_X_Window root, + Ecore_X_Window *p_clients, + unsigned int n_clients) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST, + p_clients, n_clients); +} /* ecore_x_netwm_client_list_set */ + +/* Stacking order */ +EAPI void +ecore_x_netwm_client_list_stacking_set(Ecore_X_Window root, + Ecore_X_Window *p_clients, + unsigned int n_clients) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_CLIENT_LIST_STACKING, + p_clients, n_clients); +} /* ecore_x_netwm_client_list_stacking_set */ + +EAPI void +ecore_x_netwm_client_active_set(Ecore_X_Window root, + Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_window_set(root, ECORE_X_ATOM_NET_ACTIVE_WINDOW, + &win, 1); +} /* ecore_x_netwm_client_active_set */ + +EAPI void +ecore_x_netwm_client_active_request(Ecore_X_Window root, + Ecore_X_Window win, + int type, + Ecore_X_Window current_win) +{ + XEvent xev; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_NET_ACTIVE_WINDOW; + xev.xclient.format = 32; + xev.xclient.data.l[0] = type; + xev.xclient.data.l[1] = CurrentTime; + xev.xclient.data.l[2] = current_win; + xev.xclient.data.l[3] = 0; + xev.xclient.data.l[4] = 0; + + XSendEvent(_ecore_x_disp, root, False, + SubstructureRedirectMask | SubstructureNotifyMask, &xev); +} /* ecore_x_netwm_client_active_request */ + +EAPI void +ecore_x_netwm_name_set(Ecore_X_Window win, + const char *name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_NAME, name); +} /* ecore_x_netwm_name_set */ + +EAPI int +ecore_x_netwm_name_get(Ecore_X_Window win, + char **name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (name) + *name = _ecore_x_window_prop_string_utf8_get(win, + ECORE_X_ATOM_NET_WM_NAME); + + return 1; +} /* ecore_x_netwm_name_get */ + +EAPI void +ecore_x_netwm_startup_id_set(Ecore_X_Window win, + const char *id) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_STARTUP_ID, id); +} /* ecore_x_netwm_startup_id_set */ + +EAPI int +ecore_x_netwm_startup_id_get(Ecore_X_Window win, + char **id) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (id) + *id = _ecore_x_window_prop_string_utf8_get(win, + ECORE_X_ATOM_NET_STARTUP_ID); + + return 1; +} /* ecore_x_netwm_startup_id_get */ + +EAPI void +ecore_x_netwm_visible_name_set(Ecore_X_Window win, + const char *name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_VISIBLE_NAME, + name); +} /* ecore_x_netwm_visible_name_set */ + +EAPI int +ecore_x_netwm_visible_name_get(Ecore_X_Window win, + char **name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (name) + *name = _ecore_x_window_prop_string_utf8_get( + win, + ECORE_X_ATOM_NET_WM_VISIBLE_NAME); + + return 1; +} /* ecore_x_netwm_visible_name_get */ + +EAPI void +ecore_x_netwm_icon_name_set(Ecore_X_Window win, + const char *name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_window_prop_string_utf8_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, + name); +} /* ecore_x_netwm_icon_name_set */ + +EAPI int +ecore_x_netwm_icon_name_get(Ecore_X_Window win, + char **name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (name) + *name = _ecore_x_window_prop_string_utf8_get( + win, + ECORE_X_ATOM_NET_WM_ICON_NAME); + + return 1; +} /* ecore_x_netwm_icon_name_get */ + +EAPI void +ecore_x_netwm_visible_icon_name_set(Ecore_X_Window win, + const char *name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_window_prop_string_utf8_set(win, + ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME, + name); +} /* ecore_x_netwm_visible_icon_name_set */ + +EAPI int +ecore_x_netwm_visible_icon_name_get(Ecore_X_Window win, + char **name) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (name) + *name = _ecore_x_window_prop_string_utf8_get( + win, + ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME); + + return 1; +} /* ecore_x_netwm_visible_icon_name_get */ + +EAPI void +ecore_x_netwm_desktop_set(Ecore_X_Window win, + unsigned int desk) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_DESKTOP, &desk, 1); +} /* ecore_x_netwm_desktop_set */ + +EAPI Eina_Bool +ecore_x_netwm_desktop_get(Ecore_X_Window win, + unsigned int *desk) +{ + int ret; + unsigned int tmp; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_DESKTOP, + &tmp, 1); + + if (desk) + *desk = tmp; + + return ret == 1 ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_netwm_desktop_get */ + +/* + * _NET_WM_STRUT is deprecated + */ +EAPI void +ecore_x_netwm_strut_set(Ecore_X_Window win, + int left, + int right, + int top, + int bottom) +{ + unsigned int strut[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + strut[0] = left; + strut[1] = right; + strut[2] = top; + strut[3] = bottom; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_STRUT, strut, 4); +} /* ecore_x_netwm_strut_set */ + +/* + * _NET_WM_STRUT is deprecated + */ +EAPI Eina_Bool +ecore_x_netwm_strut_get(Ecore_X_Window win, + int *left, + int *right, + int *top, + int *bottom) +{ + int ret = 0; + unsigned int strut[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_NET_WM_STRUT, + strut, + 4); + if (ret != 4) + return EINA_FALSE; + + if (left) + *left = strut[0]; + + if (right) + *right = strut[1]; + + if (top) + *top = strut[2]; + + if (bottom) + *bottom = strut[3]; + + return EINA_TRUE; +} /* ecore_x_netwm_strut_get */ + +EAPI void +ecore_x_netwm_strut_partial_set(Ecore_X_Window win, + int left, + int right, + int top, + int bottom, + int left_start_y, + int left_end_y, + int right_start_y, + int right_end_y, + int top_start_x, + int top_end_x, + int bottom_start_x, + int bottom_end_x) +{ + unsigned int strut[12]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + strut[0] = left; + strut[1] = right; + strut[2] = top; + strut[3] = bottom; + strut[4] = left_start_y; + strut[5] = left_end_y; + strut[6] = right_start_y; + strut[7] = right_end_y; + strut[8] = top_start_x; + strut[9] = top_end_x; + strut[10] = bottom_start_x; + strut[11] = bottom_end_x; + ecore_x_window_prop_card32_set(win, + ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, + strut, + 12); +} /* ecore_x_netwm_strut_partial_set */ + +EAPI Eina_Bool +ecore_x_netwm_strut_partial_get(Ecore_X_Window win, + int *left, + int *right, + int *top, + int *bottom, + int *left_start_y, + int *left_end_y, + int *right_start_y, + int *right_end_y, + int *top_start_x, + int *top_end_x, + int *bottom_start_x, + int *bottom_end_x) +{ + int ret = 0; + unsigned int strut[12]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_NET_WM_STRUT_PARTIAL, + strut, + 12); + if (ret != 12) + return EINA_FALSE; + + if (left) + *left = strut[0]; + + if (right) + *right = strut[1]; + + if (top) + *top = strut[2]; + + if (bottom) + *bottom = strut[3]; + + if (left_start_y) + *left_start_y = strut[4]; + + if (left_end_y) + *left_end_y = strut[5]; + + if (right_start_y) + *right_start_y = strut[6]; + + if (right_end_y) + *right_end_y = strut[7]; + + if (top_start_x) + *top_start_x = strut[8]; + + if (top_end_x) + *top_end_x = strut[9]; + + if (bottom_start_x) + *bottom_start_x = strut[10]; + + if (bottom_end_x) + *bottom_end_x = strut[11]; + + return EINA_TRUE; +} /* ecore_x_netwm_strut_partial_get */ + +EAPI Eina_Bool +ecore_x_netwm_icons_get(Ecore_X_Window win, + Ecore_X_Icon **icon, + int *num) +{ + unsigned int *data, *p; + unsigned int *src; + unsigned int len, icons, i; + int num_ret; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (num) + *num = 0; + + if (icon) + *icon = NULL; + + num_ret = ecore_x_window_prop_card32_list_get(win, ECORE_X_ATOM_NET_WM_ICON, + &data); + if (num_ret <= 0) + return EINA_FALSE; + + if (!data) + return EINA_FALSE; + + if (num_ret < 2) + { + free(data); + return EINA_FALSE; + } + + /* Check how many icons there are */ + icons = 0; + p = data; + while (p) + { + len = p[0] * p[1]; + p += (len + 2); + if ((p - data) > num_ret) + { + free(data); + return EINA_FALSE; + } + + icons++; + + if ((p - data) == num_ret) + p = NULL; + } + if (num) + *num = icons; + + /* If the user doesn't want the icons, return */ + if (!icon) + { + free(data); + return EINA_TRUE; + } + + /* Allocate memory */ + *icon = malloc(icons * sizeof(Ecore_X_Icon)); + if (!(*icon)) + { + free(data); + return EINA_FALSE; + } + + /* Fetch the icons */ + p = data; + for (i = 0; i < icons; i++) + { + unsigned int *ps, *pd, *pe; + + len = p[0] * p[1]; + ((*icon)[i]).width = p[0]; + ((*icon)[i]).height = p[1]; + src = &(p[2]); + ((*icon)[i]).data = malloc(len * sizeof(unsigned int)); + if (!((*icon)[i]).data) + { + while (i) + free(((*icon)[--i]).data); + free(*icon); + free(data); + return EINA_FALSE; + } + + pd = ((*icon)[i]).data; + ps = src; + pe = ps + len; + for (; ps < pe; ps++) + { + unsigned int r, g, b, a; + + a = (*ps >> 24) & 0xff; + r = (((*ps >> 16) & 0xff) * a) / 255; + g = (((*ps >> 8) & 0xff) * a) / 255; + b = (((*ps) & 0xff) * a) / 255; + *pd = (a << 24) | (r << 16) | (g << 8) | (b); + pd++; + } + p += (len + 2); + } + + free(data); + + return EINA_TRUE; +} /* ecore_x_netwm_icons_get */ + +EAPI void +ecore_x_netwm_icon_geometry_set(Ecore_X_Window win, + int x, + int y, + int width, + int height) +{ + unsigned int geometry[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + geometry[0] = x; + geometry[1] = y; + geometry[2] = width; + geometry[3] = height; + ecore_x_window_prop_card32_set(win, + ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, + geometry, + 4); +} /* ecore_x_netwm_icon_geometry_set */ + +EAPI Eina_Bool +ecore_x_netwm_icon_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *width, + int *height) +{ + int ret; + unsigned int geometry[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_NET_WM_ICON_GEOMETRY, + geometry, + 4); + if (ret != 4) + return EINA_FALSE; + + if (x) + *x = geometry[0]; + + if (y) + *y = geometry[1]; + + if (width) + *width = geometry[2]; + + if (height) + *height = geometry[3]; + + return EINA_TRUE; +} /* ecore_x_netwm_icon_geometry_get */ + +EAPI void +ecore_x_netwm_pid_set(Ecore_X_Window win, + int pid) +{ + unsigned int tmp; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + tmp = pid; + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_PID, + &tmp, 1); +} /* ecore_x_netwm_pid_set */ + +EAPI Eina_Bool +ecore_x_netwm_pid_get(Ecore_X_Window win, + int *pid) +{ + int ret; + unsigned int tmp; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_PID, + &tmp, 1); + if (pid) + *pid = tmp; + + return ret == 1 ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_netwm_pid_get */ + +EAPI void +ecore_x_netwm_handled_icons_set(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS, + NULL, 0); +} /* ecore_x_netwm_handled_icons_set */ + +EAPI Eina_Bool +ecore_x_netwm_handled_icons_get(Ecore_X_Window win) +{ + int ret = 0; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_HANDLED_ICONS, + NULL, 0); + return ret == 0 ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_netwm_handled_icons_get */ + +EAPI void +ecore_x_netwm_user_time_set(Ecore_X_Window win, + unsigned int tim) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_USER_TIME, + &tim, 1); +} /* ecore_x_netwm_user_time_set */ + +EAPI Eina_Bool +ecore_x_netwm_user_time_get(Ecore_X_Window win, + unsigned int *tim) +{ + int ret; + unsigned int tmp; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_USER_TIME, + &tmp, 1); + if (tim) + *tim = tmp; + + return ret == 1 ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_netwm_user_time_get */ + +Ecore_X_Window_State +_ecore_x_netwm_state_get(Ecore_X_Atom a) +{ + if (a == ECORE_X_ATOM_NET_WM_STATE_MODAL) + return ECORE_X_WINDOW_STATE_MODAL; + else if (a == ECORE_X_ATOM_NET_WM_STATE_STICKY) + return ECORE_X_WINDOW_STATE_STICKY; + else if (a == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT) + return ECORE_X_WINDOW_STATE_MAXIMIZED_VERT; + else if (a == ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ) + return ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ; + else if (a == ECORE_X_ATOM_NET_WM_STATE_SHADED) + return ECORE_X_WINDOW_STATE_SHADED; + else if (a == ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR) + return ECORE_X_WINDOW_STATE_SKIP_TASKBAR; + else if (a == ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER) + return ECORE_X_WINDOW_STATE_SKIP_PAGER; + else if (a == ECORE_X_ATOM_NET_WM_STATE_HIDDEN) + return ECORE_X_WINDOW_STATE_HIDDEN; + else if (a == ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN) + return ECORE_X_WINDOW_STATE_FULLSCREEN; + else if (a == ECORE_X_ATOM_NET_WM_STATE_ABOVE) + return ECORE_X_WINDOW_STATE_ABOVE; + else if (a == ECORE_X_ATOM_NET_WM_STATE_BELOW) + return ECORE_X_WINDOW_STATE_BELOW; + else if (a == ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION) + return ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION; + else + return ECORE_X_WINDOW_STATE_UNKNOWN; +} /* _ecore_x_netwm_state_get */ + +static Ecore_X_Atom +_ecore_x_netwm_state_atom_get(Ecore_X_Window_State s) +{ + switch(s) + { + case ECORE_X_WINDOW_STATE_MODAL: + return ECORE_X_ATOM_NET_WM_STATE_MODAL; + + case ECORE_X_WINDOW_STATE_STICKY: + return ECORE_X_ATOM_NET_WM_STATE_STICKY; + + case ECORE_X_WINDOW_STATE_MAXIMIZED_VERT: + return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_VERT; + + case ECORE_X_WINDOW_STATE_MAXIMIZED_HORZ: + return ECORE_X_ATOM_NET_WM_STATE_MAXIMIZED_HORZ; + + case ECORE_X_WINDOW_STATE_SHADED: + return ECORE_X_ATOM_NET_WM_STATE_SHADED; + + case ECORE_X_WINDOW_STATE_SKIP_TASKBAR: + return ECORE_X_ATOM_NET_WM_STATE_SKIP_TASKBAR; + + case ECORE_X_WINDOW_STATE_SKIP_PAGER: + return ECORE_X_ATOM_NET_WM_STATE_SKIP_PAGER; + + case ECORE_X_WINDOW_STATE_HIDDEN: + return ECORE_X_ATOM_NET_WM_STATE_HIDDEN; + + case ECORE_X_WINDOW_STATE_FULLSCREEN: + return ECORE_X_ATOM_NET_WM_STATE_FULLSCREEN; + + case ECORE_X_WINDOW_STATE_ABOVE: + return ECORE_X_ATOM_NET_WM_STATE_ABOVE; + + case ECORE_X_WINDOW_STATE_BELOW: + return ECORE_X_ATOM_NET_WM_STATE_BELOW; + + case ECORE_X_WINDOW_STATE_DEMANDS_ATTENTION: + return ECORE_X_ATOM_NET_WM_STATE_DEMANDS_ATTENTION; + + default: + return 0; + } /* switch */ +} /* _ecore_x_netwm_state_atom_get */ + +EAPI void +ecore_x_netwm_window_state_set(Ecore_X_Window win, + Ecore_X_Window_State *state, + unsigned int num) +{ + Ecore_X_Atom *set; + unsigned int i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!num) + { + ecore_x_window_prop_property_del(win, ECORE_X_ATOM_NET_WM_STATE); + return; + } + + set = malloc(num * sizeof(Ecore_X_Atom)); + if (!set) + return; + + for (i = 0; i < num; i++) + set[i] = _ecore_x_netwm_state_atom_get(state[i]); + + ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_STATE, set, num); + + free(set); +} /* ecore_x_netwm_window_state_set */ + +EAPI Eina_Bool +ecore_x_netwm_window_state_get(Ecore_X_Window win, + Ecore_X_Window_State **state, + unsigned int *num) +{ + int num_ret, i; + Ecore_X_Atom *atoms; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (num) + *num = 0; + + if (state) + *state = NULL; + + num_ret = ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_STATE, + &atoms); + if (num_ret <= 0) + return EINA_FALSE; + + if (state) + { + *state = malloc(num_ret * sizeof(Ecore_X_Window_State)); + if (*state) + for (i = 0; i < num_ret; ++i) + (*state)[i] = _ecore_x_netwm_state_get(atoms[i]); + + if (num) + *num = num_ret; + } + + free(atoms); + return EINA_TRUE; +} /* ecore_x_netwm_window_state_get */ + +static Ecore_X_Window_Type +_ecore_x_netwm_window_type_type_get(Ecore_X_Atom atom) +{ + if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP) + return ECORE_X_WINDOW_TYPE_DESKTOP; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK) + return ECORE_X_WINDOW_TYPE_DOCK; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR) + return ECORE_X_WINDOW_TYPE_TOOLBAR; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU) + return ECORE_X_WINDOW_TYPE_MENU; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY) + return ECORE_X_WINDOW_TYPE_UTILITY; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH) + return ECORE_X_WINDOW_TYPE_SPLASH; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG) + return ECORE_X_WINDOW_TYPE_DIALOG; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL) + return ECORE_X_WINDOW_TYPE_NORMAL; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU) + return ECORE_X_WINDOW_TYPE_DROPDOWN_MENU; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU) + return ECORE_X_WINDOW_TYPE_POPUP_MENU; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP) + return ECORE_X_WINDOW_TYPE_TOOLTIP; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION) + return ECORE_X_WINDOW_TYPE_NOTIFICATION; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO) + return ECORE_X_WINDOW_TYPE_COMBO; + else if (atom == ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND) + return ECORE_X_WINDOW_TYPE_DND; + else + return ECORE_X_WINDOW_TYPE_UNKNOWN; +} /* _ecore_x_netwm_window_type_type_get */ + +static Ecore_X_Atom +_ecore_x_netwm_window_type_atom_get(Ecore_X_Window_Type type) +{ + switch (type) + { + case ECORE_X_WINDOW_TYPE_DESKTOP: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP; + + case ECORE_X_WINDOW_TYPE_DOCK: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK; + + case ECORE_X_WINDOW_TYPE_TOOLBAR: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLBAR; + + case ECORE_X_WINDOW_TYPE_MENU: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_MENU; + + case ECORE_X_WINDOW_TYPE_UTILITY: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_UTILITY; + + case ECORE_X_WINDOW_TYPE_SPLASH: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_SPLASH; + + case ECORE_X_WINDOW_TYPE_DIALOG: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DIALOG; + + case ECORE_X_WINDOW_TYPE_NORMAL: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NORMAL; + + case ECORE_X_WINDOW_TYPE_DROPDOWN_MENU: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DROPDOWN_MENU; + + case ECORE_X_WINDOW_TYPE_POPUP_MENU: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_POPUP_MENU; + + case ECORE_X_WINDOW_TYPE_TOOLTIP: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_TOOLTIP; + + case ECORE_X_WINDOW_TYPE_NOTIFICATION: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_NOTIFICATION; + + case ECORE_X_WINDOW_TYPE_COMBO: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_COMBO; + + case ECORE_X_WINDOW_TYPE_DND: + return ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DND; + + default: + return 0; + } /* switch */ +} /* _ecore_x_netwm_window_type_atom_get */ + +/* + * FIXME: We should set WM_TRANSIENT_FOR if type is ECORE_X_WINDOW_TYPE_TOOLBAR + * , ECORE_X_WINDOW_TYPE_MENU or ECORE_X_WINDOW_TYPE_DIALOG + */ +EAPI void +ecore_x_netwm_window_type_set(Ecore_X_Window win, + Ecore_X_Window_Type type) +{ + Ecore_X_Atom atom; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + atom = _ecore_x_netwm_window_type_atom_get(type); + ecore_x_window_prop_atom_set(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, + &atom, 1); +} /* ecore_x_netwm_window_type_set */ + +/* FIXME: Maybe return 0 on some conditions? */ +EAPI Eina_Bool +ecore_x_netwm_window_type_get(Ecore_X_Window win, + Ecore_X_Window_Type *type) +{ + int num; + Ecore_X_Atom *atoms = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (type) + *type = ECORE_X_WINDOW_TYPE_NORMAL; + + num = ecore_x_window_prop_atom_list_get(win, + ECORE_X_ATOM_NET_WM_WINDOW_TYPE, + &atoms); + if ((type) && (num >= 1) && (atoms)) + *type = _ecore_x_netwm_window_type_type_get(atoms[0]); + + free(atoms); + if (num >= 1) + return EINA_TRUE; + + return EINA_FALSE; +} /* ecore_x_netwm_window_type_get */ + +EAPI int +ecore_x_netwm_window_types_get(Ecore_X_Window win, + Ecore_X_Window_Type **types) +{ + int num, i; + Ecore_X_Atom *atoms = NULL; + Ecore_X_Window_Type *atoms2 = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (types) + *types = NULL; + + num = ecore_x_window_prop_atom_list_get(win, + ECORE_X_ATOM_NET_WM_WINDOW_TYPE, + &atoms); + if ((num <= 0) || (!atoms)) + { + if (atoms) + free(atoms); + + return 0; + } + + atoms2 = malloc(num * sizeof(Ecore_X_Window_Type)); + if (!atoms2) + return 0; + + for (i = 0; i < num; i++) + atoms2[i] = _ecore_x_netwm_window_type_type_get(atoms[i]); + free(atoms); + if (types) + *types = atoms2; + else + free(atoms2); + + return num; +} /* ecore_x_netwm_window_types_get */ + +static Ecore_X_Atom +_ecore_x_netwm_action_atom_get(Ecore_X_Action action) +{ + switch (action) + { + case ECORE_X_ACTION_MOVE: + return ECORE_X_ATOM_NET_WM_ACTION_MOVE; + + case ECORE_X_ACTION_RESIZE: + return ECORE_X_ATOM_NET_WM_ACTION_RESIZE; + + case ECORE_X_ACTION_MINIMIZE: + return ECORE_X_ATOM_NET_WM_ACTION_MINIMIZE; + + case ECORE_X_ACTION_SHADE: + return ECORE_X_ATOM_NET_WM_ACTION_SHADE; + + case ECORE_X_ACTION_STICK: + return ECORE_X_ATOM_NET_WM_ACTION_STICK; + + case ECORE_X_ACTION_MAXIMIZE_HORZ: + return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_HORZ; + + case ECORE_X_ACTION_MAXIMIZE_VERT: + return ECORE_X_ATOM_NET_WM_ACTION_MAXIMIZE_VERT; + + case ECORE_X_ACTION_FULLSCREEN: + return ECORE_X_ATOM_NET_WM_ACTION_FULLSCREEN; + + case ECORE_X_ACTION_CHANGE_DESKTOP: + return ECORE_X_ATOM_NET_WM_ACTION_CHANGE_DESKTOP; + + case ECORE_X_ACTION_CLOSE: + return ECORE_X_ATOM_NET_WM_ACTION_CLOSE; + + case ECORE_X_ACTION_ABOVE: + return ECORE_X_ATOM_NET_WM_ACTION_ABOVE; + + case ECORE_X_ACTION_BELOW: + return ECORE_X_ATOM_NET_WM_ACTION_BELOW; + + default: + return 0; + } /* switch */ +} /* _ecore_x_netwm_action_atom_get */ + +/* FIXME: Get complete list */ +EAPI Eina_Bool +ecore_x_netwm_allowed_action_isset(Ecore_X_Window win, + Ecore_X_Action action) +{ + int num, i; + Ecore_X_Atom *atoms, atom; + Eina_Bool ret = EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + num = ecore_x_window_prop_atom_list_get(win, ECORE_X_ATOM_NET_WM_WINDOW_TYPE, + &atoms); + if (num <= 0) + return ret; + + atom = _ecore_x_netwm_action_atom_get(action); + + for (i = 0; i < num; ++i) + { + if (atom == atoms[i]) + { + ret = 1; + break; + } + } + + free(atoms); + return ret; +} /* ecore_x_netwm_allowed_action_isset */ + +/* FIXME: Set complete list */ +EAPI void +ecore_x_netwm_allowed_action_set(Ecore_X_Window win, + Ecore_X_Action *action, + unsigned int num) +{ + Ecore_X_Atom *set; + unsigned int i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!num) + { + ecore_x_window_prop_property_del(win, + ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS); + return; + } + + set = malloc(num * sizeof(Ecore_X_Atom)); + if (!set) + return; + + for (i = 0; i < num; i++) + set[i] = _ecore_x_netwm_action_atom_get(action[i]); + + ecore_x_window_prop_atom_set(win, + ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, + set, + num); + + free(set); +} /* ecore_x_netwm_allowed_action_set */ + +EAPI Eina_Bool +ecore_x_netwm_allowed_action_get(Ecore_X_Window win, + Ecore_X_Action **action, + unsigned int *num) +{ + int num_ret, i; + Ecore_X_Atom *atoms; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (num) + *num = 0; + + if (action) + *action = NULL; + + num_ret = ecore_x_window_prop_atom_list_get( + win, + ECORE_X_ATOM_NET_WM_ALLOWED_ACTIONS, + &atoms); + if (num_ret <= 0) + return EINA_FALSE; + + if (action) + { + *action = malloc(num_ret * sizeof(Ecore_X_Action)); + if (*action) + for (i = 0; i < num_ret; ++i) + (*action)[i] = _ecore_x_netwm_action_atom_get(atoms[i]); + + if (num) + *num = num_ret; + } + + free(atoms); + return EINA_TRUE; +} /* ecore_x_netwm_allowed_action_get */ + +EAPI void +ecore_x_netwm_opacity_set(Ecore_X_Window win, + unsigned int opacity) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, + &opacity, 1); +} /* ecore_x_netwm_opacity_set */ + +EAPI Eina_Bool +ecore_x_netwm_opacity_get(Ecore_X_Window win, + unsigned int *opacity) +{ + int ret; + unsigned int tmp; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = ecore_x_window_prop_card32_get(win, ECORE_X_ATOM_NET_WM_WINDOW_OPACITY, + &tmp, 1); + if (opacity) + *opacity = tmp; + + return ret == 1 ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_netwm_opacity_get */ + +EAPI void +ecore_x_netwm_frame_size_set(Ecore_X_Window win, + int fl, + int fr, + int ft, + int fb) +{ + unsigned int frames[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + frames[0] = fl; + frames[1] = fr; + frames[2] = ft; + frames[3] = fb; + ecore_x_window_prop_card32_set(win, + ECORE_X_ATOM_NET_FRAME_EXTENTS, + frames, + 4); +} /* ecore_x_netwm_frame_size_set */ + +EAPI Eina_Bool +ecore_x_netwm_frame_size_get(Ecore_X_Window win, + int *fl, + int *fr, + int *ft, + int *fb) +{ + int ret = 0; + unsigned int frames[4]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = ecore_x_window_prop_card32_get(win, + ECORE_X_ATOM_NET_FRAME_EXTENTS, + frames, + 4); + if (ret != 4) + return EINA_FALSE; + + if (fl) + *fl = frames[0]; + + if (fr) + *fr = frames[1]; + + if (ft) + *ft = frames[2]; + + if (fb) + *fb = frames[3]; + + return EINA_TRUE; +} /* ecore_x_netwm_frame_size_get */ + +EAPI Eina_Bool +ecore_x_netwm_sync_counter_get(Ecore_X_Window win, + Ecore_X_Sync_Counter *counter) +{ + int ret; + unsigned int tmp; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ret = ecore_x_window_prop_card32_get( + win, + ECORE_X_ATOM_NET_WM_SYNC_REQUEST_COUNTER, + &tmp, + 1); + + if (counter) + *counter = tmp; + + return ret == 1 ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_netwm_sync_counter_get */ + +EAPI void +ecore_x_netwm_ping_send(Ecore_X_Window win) +{ + XEvent xev; + + if (!win) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS; + xev.xclient.format = 32; + xev.xclient.data.l[0] = ECORE_X_ATOM_NET_WM_PING; + xev.xclient.data.l[1] = _ecore_x_event_last_time; + xev.xclient.data.l[2] = win; + xev.xclient.data.l[3] = 0; + xev.xclient.data.l[4] = 0; + + XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev); +} /* ecore_x_netwm_ping_send */ + +EAPI void +ecore_x_netwm_sync_request_send(Ecore_X_Window win, + unsigned int serial) +{ + XSyncValue value; + XEvent xev; + + if (!win) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSyncIntToValue(&value, (int)serial); + + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS; + xev.xclient.format = 32; + xev.xclient.data.l[0] = ECORE_X_ATOM_NET_WM_SYNC_REQUEST; + xev.xclient.data.l[1] = _ecore_x_event_last_time; + xev.xclient.data.l[2] = XSyncValueLow32(value); + xev.xclient.data.l[3] = XSyncValueHigh32(value); + xev.xclient.data.l[4] = 0; + + XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev); +} /* ecore_x_netwm_sync_request_send */ + +EAPI void +ecore_x_netwm_state_request_send(Ecore_X_Window win, + Ecore_X_Window root, + Ecore_X_Window_State s1, + Ecore_X_Window_State s2, + Eina_Bool set) +{ + XEvent xev; + + if (!win) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + + xev.xclient.type = ClientMessage; + xev.xclient.serial = 0; + xev.xclient.send_event = True; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.format = 32; + xev.xclient.message_type = ECORE_X_ATOM_NET_WM_STATE; + xev.xclient.data.l[0] = !!set; + xev.xclient.data.l[1] = _ecore_x_netwm_state_atom_get(s1); + xev.xclient.data.l[2] = _ecore_x_netwm_state_atom_get(s2); + /* 1 == normal client, if someone wants to use this + * function in a pager, this should be 2 */ + xev.xclient.data.l[3] = 1; + xev.xclient.data.l[4] = 0; + + XSendEvent(_ecore_x_disp, root, False, + SubstructureNotifyMask | SubstructureRedirectMask, &xev); +} /* ecore_x_netwm_state_request_send */ + +EAPI void +ecore_x_netwm_desktop_request_send(Ecore_X_Window win, + Ecore_X_Window root, + unsigned int desktop) +{ + XEvent xev; + + if (!win) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!root) + root = DefaultRootWindow(_ecore_x_disp); + + xev.xclient.type = ClientMessage; + xev.xclient.serial = 0; + xev.xclient.send_event = True; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.format = 32; + xev.xclient.message_type = ECORE_X_ATOM_NET_WM_DESKTOP; + xev.xclient.data.l[0] = desktop; + + XSendEvent(_ecore_x_disp, root, False, + SubstructureNotifyMask | SubstructureRedirectMask, &xev); +} /* ecore_x_netwm_desktop_request_send */ + +int +_ecore_x_netwm_startup_info_begin(Ecore_X_Window win __UNUSED__, + char *data __UNUSED__) +{ +#if 0 + Ecore_X_Startup_Info *info; + unsigned char *exists = 0; + + if (!startup_info) + return 0; + + info = eina_hash_find(startup_info, (void *)win); + if (info) + { + exists = 1; + WRN("Already got info for win: 0x%x", win); + _ecore_x_netwm_startup_info_free(info); + } + + info = calloc(1, sizeof(Ecore_X_Startup_Info)); + if (!info) + return 0; + + info->win = win; + info->length = 0; + info->buffer_size = 161; + info->buffer = calloc(info->buffer_size, sizeof(char)); + if (!info->buffer) + { + _ecore_x_netwm_startup_info_free(info); + return 0; + } + + memcpy(info->buffer, data, 20); + info->length += 20; + info->buffer[info->length] = 0; + if (exists) + eina_hash_modify(startup_info, (void *)info->win, info); + else + eina_hash_add(startup_info, (void *)info->win, info); + + if (strlen(info->buffer) != 20) + /* We have a '\0' in there, the message is done */ + _ecore_x_netwm_startup_info_process(info); + +#endif /* if 0 */ + return 1; +} /* _ecore_x_netwm_startup_info_begin */ + +int +_ecore_x_netwm_startup_info(Ecore_X_Window win __UNUSED__, + char *data __UNUSED__) +{ +#if 0 + Ecore_X_Startup_Info *info; + char *p; + + if (!startup_info) + return 0; + + info = eina_hash_find(startup_info, (void *)win); + if (!info) + return 0; + + if ((info->length + 20) > info->buffer_size) + { + info->buffer_size += 160; + info->buffer = realloc(info->buffer, info->buffer_size * sizeof(char)); + if (!info->buffer) + { + eina_hash_del(startup_info, (void *)info->win); + _ecore_x_netwm_startup_info_free(info); + return 0; + } + } + + memcpy(info->buffer + info->length, data, 20); + p = info->buffer + info->length; + info->length += 20; + info->buffer[info->length] = 0; + if (strlen(p) != 20) + /* We have a '\0' in there, the message is done */ + _ecore_x_netwm_startup_info_process(info); + +#endif /* if 0 */ + return 1; +} /* _ecore_x_netwm_startup_info */ + +/* + * Set UTF-8 string property + */ +static void +_ecore_x_window_prop_string_utf8_set(Ecore_X_Window win, + Ecore_X_Atom atom, + const char *str) +{ + XChangeProperty(_ecore_x_disp, win, atom, ECORE_X_ATOM_UTF8_STRING, 8, + PropModeReplace, (unsigned char *)str, strlen(str)); +} /* _ecore_x_window_prop_string_utf8_set */ + +/* + * Get UTF-8 string property + */ +static char * +_ecore_x_window_prop_string_utf8_get(Ecore_X_Window win, + Ecore_X_Atom atom) +{ + char *str; + unsigned char *prop_ret; + Atom type_ret; + unsigned long bytes_after, num_ret; + int format_ret; + + str = NULL; + prop_ret = NULL; + XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False, + ECORE_X_ATOM_UTF8_STRING, &type_ret, + &format_ret, &num_ret, &bytes_after, &prop_ret); + if (prop_ret && num_ret > 0 && format_ret == 8) + { + str = malloc(num_ret + 1); + if (str) + { + memcpy(str, prop_ret, num_ret); + str[num_ret] = '\0'; + } + } + + if (prop_ret) + XFree(prop_ret); + + return str; +} /* _ecore_x_window_prop_string_utf8_get */ + +#if 0 /* Unused */ +/* + * Process startup info + */ +static int +_ecore_x_netwm_startup_info_process(Ecore_X_Startup_Info *info) +{ + Ecore_X_Event_Startup_Sequence *e; + int event; + char *p; + + p = strchr(info->buffer, ':'); + if (!p) + { + eina_hash_del(startup_info, (void *)info->win); + _ecore_x_netwm_startup_info_free(info); + return 0; + } + + *p = 0; + if (!strcmp(info->buffer, "new")) + { + if (info->init) + event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE; + else + event = ECORE_X_EVENT_STARTUP_SEQUENCE_NEW; + + info->init = 1; + } + else if (!strcmp(info->buffer, "change")) + event = ECORE_X_EVENT_STARTUP_SEQUENCE_CHANGE; + else if (!strcmp(info->buffer, "remove")) + event = ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE; + else + { + eina_hash_del(startup_info, (void *)info->win); + _ecore_x_netwm_startup_info_free(info); + return 0; + } + + p++; + + if (!_ecore_x_netwm_startup_info_parse(info, p)) + { + eina_hash_del(startup_info, (void *)info->win); + _ecore_x_netwm_startup_info_free(info); + return 0; + } + + if (info->init) + { + e = calloc(1, sizeof(Ecore_X_Event_Startup_Sequence)); + if (!e) + { + eina_hash_del(startup_info, (void *)info->win); + _ecore_x_netwm_startup_info_free(info); + return 0; + } + + e->win = info->win; + ecore_event_add(event, e, NULL, NULL); + } + + if (event == ECORE_X_EVENT_STARTUP_SEQUENCE_REMOVE) + { + eina_hash_del(startup_info, (void *)info->win); + _ecore_x_netwm_startup_info_free(info); + } + else + { + /* Discard buffer */ + info->length = 0; + info->buffer[0] = 0; + } + + return 1; +} /* _ecore_x_netwm_startup_info_process */ + +/* + * Parse startup info + */ +static int +_ecore_x_netwm_startup_info_parse(Ecore_X_Startup_Info *info, + char *data) +{ + while (*data) + { + int in_quot_sing, in_quot_dbl, escaped; + char *p, *pp; + char *key; + char value[1024]; + + /* Skip space */ + while (*data == ' ') data++; + /* Get key */ + key = data; + data = strchr(key, '='); + if (!data) + return 0; + + *data = 0; + data++; + + /* Get value */ + p = data; + pp = value; + in_quot_dbl = 0; + in_quot_sing = 0; + escaped = 0; + while (*p) + { + if ((pp - value) >= 1024) + return 0; + + if (escaped) + { + *pp = *p; + pp++; + escaped = 0; + } + else if (in_quot_sing) + { + if (*p == '\\') + escaped = 1; + else if (*p == '\'') + in_quot_sing = 0; + else + { + *pp = *p; + pp++; + } + } + else if (in_quot_dbl) + { + if (*p == '\\') + escaped = 1; + else if (*p == '\"') + in_quot_dbl = 0; + else + { + *pp = *p; + pp++; + } + } + else + { + if (*p == '\\') + escaped = 1; + else if (*p == '\'') + in_quot_sing = 1; + else if (*p == '\"') + in_quot_dbl = 1; + else if (*p == ' ') + break; + else + { + *pp = *p; + pp++; + } + } + + p++; + } + if ((in_quot_dbl) || (in_quot_sing)) + return 0; + + data = p; + *pp = 0; + + /* Parse info */ + if (!strcmp(key, "ID")) + { + if ((info->id) && (strcmp(info->id, value))) + return 0; + + info->id = strdup(value); + p = strstr(value, "_TIME"); + if (p) + info->timestamp = atoi(p + 5); + } + else if (!strcmp(key, "NAME")) + { + if (info->name) + free(info->name); + + info->name = strdup(value); + } + else if (!strcmp(key, "SCREEN")) + info->screen = atoi(value); + else if (!strcmp(key, "BIN")) + { + if (info->bin) + free(info->bin); + + info->bin = strdup(value); + } + else if (!strcmp(key, "ICON")) + { + if (info->icon) + free(info->icon); + + info->icon = strdup(value); + } + else if (!strcmp(key, "DESKTOP")) + info->desktop = atoi(value); + else if (!strcmp(key, "TIMESTAMP")) + { + if (!info->timestamp) + info->timestamp = atoi(value); + } + else if (!strcmp(key, "DESCRIPTION")) + { + if (info->description) + free(info->description); + + info->description = strdup(value); + } + else if (!strcmp(key, "WMCLASS")) + { + if (info->wmclass) + free(info->wmclass); + + info->wmclass = strdup(value); + } + else if (!strcmp(key, "SILENT")) + info->silent = atoi(value); + else + ERR("Ecore X Sequence, Unknown: %s=%s", key, value); + } + if (!info->id) + return 0; + + return 1; +} /* _ecore_x_netwm_startup_info_parse */ + +#endif /* if 0 */ + +/* + * Free startup info struct + */ +static void +_ecore_x_netwm_startup_info_free(void *data) +{ + Ecore_X_Startup_Info *info; + + info = data; + if (!info) + return; + + if (info->buffer) + free(info->buffer); + + if (info->id) + free(info->id); + + if (info->name) + free(info->name); + + if (info->bin) + free(info->bin); + + if (info->icon) + free(info->icon); + + if (info->description) + free(info->description); + + if (info->wmclass) + free(info->wmclass); + + free(info); +} /* _ecore_x_netwm_startup_info_free */ + +/* + * Is screen composited? + */ +EAPI Eina_Bool +ecore_x_screen_is_composited(int screen) +{ + Ecore_X_Window win; + static Ecore_X_Atom atom = None; + char buf[32]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + snprintf(buf, sizeof(buf), "_NET_WM_CM_S%i", screen); + if (atom == None) + atom = XInternAtom(_ecore_x_disp, buf, False); + + if (atom == None) + return EINA_FALSE; + + win = XGetSelectionOwner(_ecore_x_disp, atom); + + return (win != None) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_screen_is_composited */ + +EAPI void +ecore_x_screen_is_composited_set(int screen, + Ecore_X_Window win) +{ + static Ecore_X_Atom atom = None; + char buf[32]; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + snprintf(buf, sizeof(buf), "_NET_WM_CM_S%i", screen); + if (atom == None) + atom = XInternAtom(_ecore_x_disp, buf, False); + + if (atom == None) + return; + + XSetSelectionOwner(_ecore_x_disp, atom, win, _ecore_x_event_last_time); +} /* ecore_x_screen_is_composited_set */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c new file mode 100644 index 0000000..b81d06c --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_pixmap.c @@ -0,0 +1,121 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" + +/** + * @defgroup Ecore_X_Pixmap_Group X Pixmap Functions + * + * Functions that operate on pixmaps. + */ + +/** + * Creates a new pixmap. + * @param win Window used to determine which screen of the display the + * pixmap should be created on. If 0, the default root window + * is used. + * @param w Width of the new pixmap. + * @param h Height of the new pixmap. + * @param dep Depth of the pixmap. If 0, the default depth of the default + * screen is used. + * @return New pixmap. + * @ingroup Ecore_X_Pixmap_Group + */ +EAPI Ecore_X_Pixmap +ecore_x_pixmap_new(Ecore_X_Window win, + int w, + int h, + int dep) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (win == 0) + win = DefaultRootWindow(_ecore_x_disp); + + if (dep == 0) + dep = DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp)); + + return XCreatePixmap(_ecore_x_disp, win, w, h, dep); +} /* ecore_x_pixmap_new */ + +/** + * Deletes the reference to the given pixmap. + * + * If no other clients have a reference to the given pixmap, the server + * will destroy it. + * + * @param pmap The given pixmap. + * @ingroup Ecore_X_Pixmap_Group + */ +EAPI void +ecore_x_pixmap_free(Ecore_X_Pixmap pmap) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XFreePixmap(_ecore_x_disp, pmap); +} /* ecore_x_pixmap_free */ + +/** + * Pastes a rectangular area of the given pixmap onto the given drawable. + * @param pmap The given pixmap. + * @param dest The given drawable. + * @param gc The graphics context which governs which operation will + * be used to paste the area onto the drawable. + * @param sx The X position of the area on the pixmap. + * @param sy The Y position of the area on the pixmap. + * @param w The width of the area. + * @param h The height of the area. + * @param dx The X position at which to paste the area on @p dest. + * @param dy The Y position at which to paste the area on @p dest. + * @ingroup Ecore_X_Pixmap_Group + */ +EAPI void +ecore_x_pixmap_paste(Ecore_X_Pixmap pmap, + Ecore_X_Drawable dest, + Ecore_X_GC gc, + int sx, + int sy, + int w, + int h, + int dx, + int dy) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XCopyArea(_ecore_x_disp, pmap, dest, gc, sx, sy, w, h, dx, dy); +} /* ecore_x_pixmap_paste */ + +/** + * Retrieves the size of the given pixmap. + * @param pmap The given pixmap. + * @param x Pointer to an integer in which to store the X position. + * @param y Pointer to an integer in which to store the Y position. + * @param w Pointer to an integer in which to store the width. + * @param h Pointer to an integer in which to store the height. + * @ingroup Ecore_X_Pixmap_Group + */ +EAPI void +ecore_x_pixmap_geometry_get(Ecore_X_Pixmap pmap, + int *x, + int *y, + int *w, + int *h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (pmap) + ecore_x_drawable_geometry_get(pmap, x, y, w, h); +} /* ecore_x_pixmap_geometry_get */ + +/** + * Retrieves the depth of the given pixmap. + * @param pmap The given pixmap. + * @return The depth of the pixmap. + * @ingroup Ecore_X_Pixmap_Group + */ +EAPI int +ecore_x_pixmap_depth_get(Ecore_X_Pixmap pmap) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return ecore_x_drawable_depth_get(pmap); +} /* ecore_x_pixmap_depth_get */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_private.h b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_private.h new file mode 100644 index 0000000..02a01f7 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_private.h @@ -0,0 +1,385 @@ +#ifndef _ECORE_X_PRIVATE_H +#define _ECORE_X_PRIVATE_H + +#include +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 256 +#endif /* ifndef MAXHOSTNAMELEN */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef ECORE_XCURSOR +#include +#endif /* ifdef ECORE_XCURSOR */ +#ifdef ECORE_XPRINT +#include +#endif /* ifdef ECORE_XPRINT */ +#ifdef ECORE_XINERAMA +#include +#endif /* ifdef ECORE_XINERAMA */ +#ifdef ECORE_XRANDR +#include +#endif /* ifdef ECORE_XRANDR */ +#ifdef ECORE_XSS +#include +#endif /* ifdef ECORE_XSS */ +#ifdef ECORE_XRENDER +#include +#endif /* ifdef ECORE_XRENDER */ +#ifdef ECORE_XFIXES +#include +#endif /* ifdef ECORE_XFIXES */ +#ifdef ECORE_XCOMPOSITE +#include +#endif /* ifdef ECORE_XCOMPOSITE */ +#ifdef ECORE_XDAMAGE +#include +#endif /* ifdef ECORE_XDAMAGE */ +#ifdef ECORE_XGESTURE +#include +#include +#endif /* ifdef ECORE_XGESTURE */ +#ifdef ECORE_XDPMS +#include +#endif /* ifdef ECORE_XDPMS */ +#ifdef ECORE_XKB +#include +#endif /* ifdef ECORE_XKB */ +#ifdef ECORE_XI2 +#include +#endif /* ifdef ECORE_XI2 */ + +#ifndef XK_MISCELLANY +# define XK_MISCELLANY 1 +#endif + +#include "Ecore.h" +#include "ecore_private.h" +#include "Ecore_X.h" +#include "Ecore_Input.h" + +extern int _ecore_xlib_log_dom; +#ifdef ECORE_XLIB_DEFAULT_LOG_COLOR +# undef ECORE_XLIB_DEFAULT_LOG_COLOR +#endif /* ifdef ECORE_XLIB_DEFAULT_LOG_COLOR */ +#define ECORE_XLIB_DEFAULT_LOG_COLOR EINA_COLOR_BLUE + +#ifdef ERR +# undef ERR +#endif /* ifdef ERR */ +#define ERR(...) EINA_LOG_DOM_ERR(_ecore_xlib_log_dom, __VA_ARGS__) + +#ifdef DBG +# undef DBG +#endif /* ifdef DBG */ +#define DBG(...) EINA_LOG_DOM_DBG(_ecore_xlib_log_dom, __VA_ARGS__) + +#ifdef INF +# undef INF +#endif /* ifdef INF */ +#define INF(...) EINA_LOG_DOM_INFO(_ecore_xlib_log_dom, __VA_ARGS__) + +#ifdef WRN +# undef WRN +#endif /* ifdef WRN */ +#define WRN(...) EINA_LOG_DOM_WARN(_ecore_xlib_log_dom, __VA_ARGS__) + +#ifdef CRIT +# undef CRIT +#endif /* ifdef CRIT */ +#define CRIT(...) EINA_LOG_DOM_CRIT(_ecore_xlib_log_dom, __VA_ARGS__) + +typedef struct _Ecore_X_Selection_Intern Ecore_X_Selection_Intern; + +struct _Ecore_X_Selection_Intern +{ + Ecore_X_Window win; + Ecore_X_Atom selection; + unsigned char *data; + int length; + Time time; +}; + +typedef struct _Ecore_X_Selection_Converter Ecore_X_Selection_Converter; + +struct _Ecore_X_Selection_Converter +{ + Ecore_X_Atom target; + Eina_Bool (*convert)(char *target, void *data, int size, void **data_ret, int *size_ret, Ecore_X_Atom *type, int *typeseize); + Ecore_X_Selection_Converter *next; +}; + +typedef struct _Ecore_X_Selection_Parser Ecore_X_Selection_Parser; + +struct _Ecore_X_Selection_Parser +{ + char *target; + void *(*parse)(const char *target, void *data, int size, int format); + Ecore_X_Selection_Parser *next; +}; + +typedef struct _Ecore_X_DND_Source +{ + int version; + Ecore_X_Window win, dest; + + enum { + ECORE_X_DND_SOURCE_IDLE, + ECORE_X_DND_SOURCE_DRAGGING, + ECORE_X_DND_SOURCE_DROPPED, + ECORE_X_DND_SOURCE_CONVERTING + } state; + + struct + { + short x, y; + unsigned short width, height; + } rectangle; + + struct + { + Ecore_X_Window window; + int x, y; + } prev; + + Time time; + + Ecore_X_Atom action, accepted_action; + + int will_accept; + int suppress; + + int await_status; +} Ecore_X_DND_Source; + +typedef struct _Ecore_X_DND_Target +{ + int version; + Ecore_X_Window win, source; + + enum { + ECORE_X_DND_TARGET_IDLE, + ECORE_X_DND_TARGET_ENTERED + } state; + + struct + { + int x, y; + } pos; + + Time time; + + Ecore_X_Atom action, accepted_action; + + int will_accept; +} Ecore_X_DND_Target; + +extern int ECORE_X_MODIFIER_SHIFT; +extern int ECORE_X_MODIFIER_CTRL; +extern int ECORE_X_MODIFIER_ALT; +extern int ECORE_X_MODIFIER_WIN; + +extern int ECORE_X_LOCK_SCROLL; +extern int ECORE_X_LOCK_NUM; +extern int ECORE_X_LOCK_CAPS; +extern int ECORE_X_LOCK_SHIFT; + +extern Display *_ecore_x_disp; +extern double _ecore_x_double_click_time; +extern Time _ecore_x_event_last_time; +extern Window _ecore_x_event_last_win; +extern int _ecore_x_event_last_root_x; +extern int _ecore_x_event_last_root_y; +extern Eina_Bool _ecore_x_xcursor; + +extern Ecore_X_Atom _ecore_x_atoms_wm_protocols[ECORE_X_WM_PROTOCOL_NUM]; + +extern int _ecore_window_grabs_num; +extern Window *_ecore_window_grabs; +extern Eina_Bool (*_ecore_window_grab_replay_func)(void *data, + int event_type, + void *event); +extern void *_ecore_window_grab_replay_data; + +extern Ecore_X_Window _ecore_x_private_win; + +void _ecore_x_error_handler_init(void); +void _ecore_x_event_handle_any_event(XEvent *xevent); +void _ecore_x_event_handle_key_press(XEvent *xevent); +void _ecore_x_event_handle_key_release(XEvent *xevent); +void _ecore_x_event_handle_button_press(XEvent *xevent); +void _ecore_x_event_handle_button_release(XEvent *xevent); +void _ecore_x_event_handle_motion_notify(XEvent *xevent); +void _ecore_x_event_handle_enter_notify(XEvent *xevent); +void _ecore_x_event_handle_leave_notify(XEvent *xevent); +void _ecore_x_event_handle_focus_in(XEvent *xevent); +void _ecore_x_event_handle_focus_out(XEvent *xevent); +void _ecore_x_event_handle_keymap_notify(XEvent *xevent); +void _ecore_x_event_handle_expose(XEvent *xevent); +void _ecore_x_event_handle_graphics_expose(XEvent *xevent); +void _ecore_x_event_handle_visibility_notify(XEvent *xevent); +void _ecore_x_event_handle_create_notify(XEvent *xevent); +void _ecore_x_event_handle_destroy_notify(XEvent *xevent); +void _ecore_x_event_handle_unmap_notify(XEvent *xevent); +void _ecore_x_event_handle_map_notify(XEvent *xevent); +void _ecore_x_event_handle_map_request(XEvent *xevent); +void _ecore_x_event_handle_reparent_notify(XEvent *xevent); +void _ecore_x_event_handle_configure_notify(XEvent *xevent); +void _ecore_x_event_handle_configure_request(XEvent *xevent); +void _ecore_x_event_handle_gravity_notify(XEvent *xevent); +void _ecore_x_event_handle_resize_request(XEvent *xevent); +void _ecore_x_event_handle_circulate_notify(XEvent *xevent); +void _ecore_x_event_handle_circulate_request(XEvent *xevent); +void _ecore_x_event_handle_property_notify(XEvent *xevent); +void _ecore_x_event_handle_selection_clear(XEvent *xevent); +void _ecore_x_event_handle_selection_request(XEvent *xevent); +void _ecore_x_event_handle_selection_notify(XEvent *xevent); +void _ecore_x_event_handle_colormap_notify(XEvent *xevent); +void _ecore_x_event_handle_client_message(XEvent *xevent); +void _ecore_x_event_handle_mapping_notify(XEvent *xevent); +void _ecore_x_event_handle_shape_change(XEvent *xevent); +void _ecore_x_event_handle_screensaver_notify(XEvent *xevent); +#ifdef ECORE_XGESTURE +void _ecore_x_event_handle_gesture_notify_flick(XEvent *xevent); +void _ecore_x_event_handle_gesture_notify_pan(XEvent *xevent); +void _ecore_x_event_handle_gesture_notify_pinchrotation(XEvent *xevent); +void _ecore_x_event_handle_gesture_notify_tap(XEvent *xevent); +void _ecore_x_event_handle_gesture_notify_tapnhold(XEvent *xevent); +void _ecore_x_event_handle_gesture_notify_hold(XEvent *xevent); +void _ecore_x_event_handle_gesture_notify_group(XEvent *xevent); +#endif /* ifdef ECORE_XGESTURE */ +void _ecore_x_event_handle_sync_counter(XEvent *xevent); +void _ecore_x_event_handle_sync_alarm(XEvent *xevent); +#ifdef ECORE_XRANDR +void _ecore_x_event_handle_randr_change(XEvent *xevent); +void _ecore_x_event_handle_randr_notify(XEvent *xevent); +#endif /* ifdef ECORE_XRANDR */ +#ifdef ECORE_XFIXES +void _ecore_x_event_handle_fixes_selection_notify(XEvent *xevent); +#endif /* ifdef ECORE_XFIXES */ +#ifdef ECORE_XDAMAGE +void _ecore_x_event_handle_damage_notify(XEvent *xevent); +#endif /* ifdef ECORE_XDAMAGE */ +void _ecore_x_event_handle_generic_event(XEvent *xevent); + +void _ecore_x_selection_data_init(void); +void _ecore_x_selection_shutdown(void); +Ecore_X_Atom _ecore_x_selection_target_atom_get(const char *target); +char *_ecore_x_selection_target_get(Ecore_X_Atom target); +Ecore_X_Selection_Intern *_ecore_x_selection_get(Ecore_X_Atom selection); +Eina_Bool _ecore_x_selection_set(Window w, + const void *data, + int len, + Ecore_X_Atom selection); +int _ecore_x_selection_convert(Ecore_X_Atom selection, + Ecore_X_Atom target, + void **data_ret, + Ecore_X_Atom *targettype, + int *targetsize); +void *_ecore_x_selection_parse(const char *target, + void *data, + int size, + int format); + +void _ecore_x_sync_magic_send(int val, + Ecore_X_Window swin); +void _ecore_x_window_grab_remove(Ecore_X_Window win); +void _ecore_x_key_grab_remove(Ecore_X_Window win); + +/* from dnd */ +void _ecore_x_dnd_init(void); +Ecore_X_DND_Source *_ecore_x_dnd_source_get(void); +Ecore_X_DND_Target *_ecore_x_dnd_target_get(void); +void _ecore_x_dnd_drag(Ecore_X_Window root, + int x, + int y); +void _ecore_x_dnd_shutdown(void); + +/* from netwm */ +Ecore_X_Window_State _ecore_x_netwm_state_get(Ecore_X_Atom a); +int _ecore_x_netwm_startup_info_begin(Ecore_X_Window win, + char *data); +int _ecore_x_netwm_startup_info(Ecore_X_Window win, + char *data); + +/* Fixes * Damage * Composite * DPMS */ +void _ecore_x_fixes_init(void); +void _ecore_x_damage_init(void); +void _ecore_x_composite_init(void); +void _ecore_x_dpms_init(void); +void _ecore_x_randr_init(void); +void _ecore_x_gesture_init(void); + +void _ecore_x_atoms_init(void); + +extern int _ecore_x_xi2_opcode; + +void _ecore_x_events_init(void); +void _ecore_x_events_shutdown(void); + +void _ecore_x_input_init(void); +void _ecore_x_input_shutdown(void); +void _ecore_x_input_handler(XEvent *xevent); +/* from sync */ + +void _ecore_mouse_move(unsigned int timestamp, + unsigned int xmodifiers, + int x, + int y, + int x_root, + int y_root, + unsigned int event_window, + unsigned int window, + unsigned int root_win, + int same_screen, + int dev, + double radx, + double rady, + double pressure, + double angle, + double mx, + double my, + double mrx, + double mry); +Ecore_Event_Mouse_Button *_ecore_mouse_button(int event, + unsigned int timestamp, + unsigned int xmodifiers, + unsigned int buttons, + int x, + int y, + int x_root, + int y_root, + unsigned int event_window, + unsigned int window, + unsigned int root_win, + int same_screen, + int dev, + double radx, + double rady, + double pressure, + double angle, + double mx, + double my, + double mrx, + double mry); + +void _ecore_x_modifiers_get(void); + +//#define LOGFNS 1 + +#ifdef LOGFNS +#include +#define LOGFN(fl, ln, fn) printf("-ECORE-X: %25s: %5i - %s\n", fl, ln, fn); +#else /* ifdef LOGFNS */ +#define LOGFN(fl, ln, fn) +#endif /* ifdef LOGFNS */ + +#endif /* ifndef _ECORE_X_PRIVATE_H */ diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c new file mode 100644 index 0000000..d4d834f --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.c @@ -0,0 +1,102 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "ecore_x_private.h" +#include "ecore_x_randr.h" + +static Eina_Bool _randr_available = EINA_FALSE; +#ifdef ECORE_XRANDR +static int _randr_major, _randr_minor; +int _randr_version; +#define RANDR_1_1 ((1 << 16) | 1) +#define RANDR_1_2 ((1 << 16) | 2) +#define RANDR_1_3 ((1 << 16) | 3) + +#define RANDR_VALIDATE_ROOT(screen, \ + root) ((screen = \ + XRRRootToScreen(_ecore_x_disp, \ + root)) != -1) + +#define Ecore_X_Randr_Unset -1 + +XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display * dpy, + Window window); + +#endif /* ifdef ECORE_XRANDR */ + +void +_ecore_x_randr_init(void) +{ +#ifdef ECORE_XRANDR + _randr_major = 1; + _randr_minor = 3; + _randr_version = 0; + + _ecore_x_randr_get_screen_resources = NULL; + if (XRRQueryVersion(_ecore_x_disp, &_randr_major, &_randr_minor)) + { + _randr_version = (_randr_major << 16) | _randr_minor; + if (_randr_version >= RANDR_1_3) + _ecore_x_randr_get_screen_resources = XRRGetScreenResourcesCurrent; + else if (_randr_version == RANDR_1_2) + _ecore_x_randr_get_screen_resources = XRRGetScreenResources; + + _randr_available = EINA_TRUE; + } + else + _randr_available = EINA_FALSE; + +#else + _randr_available = EINA_FALSE; +#endif +} + +/* + * @brief query whether randr is available or not + * @return EINA_TRUE, if extension is available, else EINA_FALSE + */ +EAPI Eina_Bool +ecore_x_randr_query(void) +{ + return _randr_available; +} + +/* + * @return version of the RandRR extension supported by the server or, + * in case RandRR extension is not available, Ecore_X_Randr_Unset (=-1). + * bit version information: 31 MAJOR 16 | 15 MINOR 0 + */ +EAPI int +ecore_x_randr_version_get(void) +{ +#ifdef ECORE_XRANDR + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (_randr_available) + { + return _randr_version; + } + else + { + return Ecore_X_Randr_Unset; + } +#else + return -1; +#endif +} + +Eina_Bool +_ecore_x_randr_root_validate(Ecore_X_Window root) +{ +#ifdef ECORE_XRANDR + Ecore_X_Randr_Screen scr = -1; + if (root && RANDR_VALIDATE_ROOT(scr, root)) + return EINA_TRUE; + else + return EINA_FALSE; + +#else + return EINA_FALSE; +#endif +} + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.h b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.h new file mode 100644 index 0000000..eca3c0c --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr.h @@ -0,0 +1,7 @@ +#ifndef ECORE_X_INLINE_X +#define ECORE_X_INLINE_X +Eina_Bool _ecore_x_randr_root_validate(Ecore_X_Window root); +Eina_Bool _ecore_x_randr_output_validate(Ecore_X_Window root, + Ecore_X_Randr_Output + output); +#endif diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c new file mode 100644 index 0000000..a6bafb6 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_11.c @@ -0,0 +1,332 @@ +/* + * vim:ts=8:sw=3:sts=8:expandtab:cino=>5n-3f0^-2{2 + */ + +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "ecore_x_private.h" +#include "ecore_x_randr.h" + +#define Ecore_X_Randr_None 0 +#ifdef ECORE_XRANDR + +#define RANDR_1_1 ((1 << 16) | 1) + +#define RANDR_VALIDATE_ROOT(screen, \ + root) ((screen = \ + XRRRootToScreen(_ecore_x_disp, \ + root)) != -1) +#define RANDR_CHECK_1_1_RET(ret) if(_randr_version < RANDR_1_1) return ret + +extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display * + dpy, + Window + window); +extern int _randr_version; +#endif /* ifdef ECORE_XRANDR */ + +/* + * @param root window which's primary output will be queried + */ +EAPI Ecore_X_Randr_Orientation +ecore_x_randr_screen_primary_output_orientations_get(Ecore_X_Window root) +{ +#ifdef ECORE_XRANDR + Rotation rot = Ecore_X_Randr_None, crot; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + rot = + XRRRotations(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, + root), &crot); + return rot; +#else /* ifdef ECORE_XRANDR */ + return Ecore_X_Randr_None; +#endif /* ifdef ECORE_XRANDR */ +} /* ecore_x_randr_screen_primary_output_orientations_get */ + +/* + * @param root window which's primary output will be queried + * @return the current orientation of the root window's screen primary output + */ +EAPI Ecore_X_Randr_Orientation +ecore_x_randr_screen_primary_output_orientation_get(Ecore_X_Window root) +{ +#ifdef ECORE_XRANDR + Rotation crot = Ecore_X_Randr_None; + XRRRotations(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, + root), &crot); + return crot; +#else /* ifdef ECORE_XRANDR */ + return Ecore_X_Randr_None; +#endif /* ifdef ECORE_XRANDR */ +} /* ecore_x_randr_screen_primary_output_orientation_get */ + +/* + * @brief sets a given screen's primary output's orientation + * @param root window which's screen's primary output will be queried + * @param orientation orientation which should be set for the root window's screen primary output + * @return EINA_TRUE if the primary output's orientation could be successfully altered + */ +EAPI Eina_Bool +ecore_x_randr_screen_primary_output_orientation_set( + Ecore_X_Window root, + Ecore_X_Randr_Orientation + orientation) +{ +#ifdef ECORE_XRANDR + XRRScreenConfiguration *xrr_screen_cfg = NULL; + int sizeid; + Rotation crot; + Eina_Bool ret = EINA_FALSE; + if (!(xrr_screen_cfg = XRRGetScreenInfo(_ecore_x_disp, root))) + return EINA_FALSE; + + sizeid = XRRConfigCurrentConfiguration(xrr_screen_cfg, &crot); + if (!XRRSetScreenConfig(_ecore_x_disp, xrr_screen_cfg, root, sizeid, + orientation, CurrentTime)) + ret = EINA_TRUE; + + if (xrr_screen_cfg) + XRRFreeScreenConfigInfo(xrr_screen_cfg); + + return ret; +#else /* ifdef ECORE_XRANDR */ + return EINA_FALSE; +#endif /* ifdef ECORE_XRANDR */ +} /* ecore_x_randr_screen_primary_output_orientation_set */ + +/* + * @brief gets a screen's primary output's possible sizes + * @param root window which's primary output will be queried + * @param num number of sizes reported as supported by the screen's primary output + * @return an array of sizes reported as supported by the screen's primary output or - if query failed - NULL + */ +EAPI Ecore_X_Randr_Screen_Size_MM * +ecore_x_randr_screen_primary_output_sizes_get(Ecore_X_Window root, + int *num) +{ +#ifdef ECORE_XRANDR + Ecore_X_Randr_Screen_Size_MM *ret = NULL; + XRRScreenSize *sizes; + int i, n; + + /* we don't have to free sizes, because they're hold in a cache inside X*/ + sizes = + XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, + root), &n); + if ((!sizes) || (n <= 0)) return NULL; + ret = calloc(n, sizeof(Ecore_X_Randr_Screen_Size_MM)); + if (!ret) + return NULL; + + if (num) + *num = n; + + for (i = 0; i < n; i++) + { + ret[i].width = sizes[i].width; + ret[i].height = sizes[i].height; + ret[i].width_mm = sizes[i].mwidth; + ret[i].height_mm = sizes[i].mheight; + } + return ret; +#else /* ifdef ECORE_XRANDR */ + return NULL; +#endif /* ifdef ECORE_XRANDR */ +} /* ecore_x_randr_screen_primary_output_sizes_get */ + +/* + * @brief get the current set size of a given screen's primary output + * @param root window which's primary output will be queried + * @param w the current size's width + * @param h the current size's height + * @param w_mm the current size's width in mm + * @param h_mm the current size's height in mm + * @param size_index of current set size to be used with ecore_x_randr_primary_output_size_set() + */ +EAPI void +ecore_x_randr_screen_primary_output_current_size_get(Ecore_X_Window root, + int *w, + int *h, + int *w_mm, + int *h_mm, + int *size_index) +{ +#ifdef ECORE_XRANDR + XRRScreenSize *sizes; + XRRScreenConfiguration *sc = NULL; + int idx; + Rotation orientation; + int n; + + if (!(sc = XRRGetScreenInfo(_ecore_x_disp, root))) + { + ERR("Couldn't get screen information for %d", root); + return; + } + + idx = XRRConfigCurrentConfiguration(sc, &orientation); + + sizes = + XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, + root), &n); + if ((idx < n) && (idx >= 0)) + { + if (w) + *w = sizes[idx].width; + + if (h) + *h = sizes[idx].height; + + if (w_mm) + *w_mm = sizes[idx].mwidth; + + if (h_mm) + *h_mm = sizes[idx].mheight; + + if (size_index) + *size_index = idx; + } + + XRRFreeScreenConfigInfo(sc); +#endif /* ifdef ECORE_XRANDR */ +} /* ecore_x_randr_screen_primary_output_current_size_get */ + +/* + * @brief sets a given screen's primary output size, but disables all other outputs at the same time + * @param root window which's primary output will be queried + * @param size_index within the list of sizes reported as supported by the root window's screen primary output + * @return EINA_TRUE on success, EINA_FALSE on failure due to e.g. invalid times + */ +EAPI Eina_Bool +ecore_x_randr_screen_primary_output_size_set(Ecore_X_Window root, + int size_index) +{ +#ifdef ECORE_XRANDR + XRRScreenConfiguration *sc = NULL; + XRRScreenSize *sizes; + Eina_Bool ret = EINA_FALSE; + int nsizes = 0; + + if (size_index >= 0 && _ecore_x_randr_root_validate(root)) + { + sizes = + XRRSizes(_ecore_x_disp, XRRRootToScreen(_ecore_x_disp, + root), &nsizes); + + if (size_index < nsizes) + { + sc = XRRGetScreenInfo(_ecore_x_disp, root); + if (!XRRSetScreenConfig(_ecore_x_disp, sc, + root, size_index, + ECORE_X_RANDR_ORIENTATION_ROT_0, CurrentTime)) + { + ret = EINA_TRUE; + } + + if (sc) + XRRFreeScreenConfigInfo(sc); + } + } + + return ret; +#else /* ifdef ECORE_XRANDR */ + return EINA_FALSE; +#endif /* ifdef ECORE_XRANDR */ +} /* ecore_x_randr_screen_primary_output_size_set */ + +/* + * @param root window which's primary output will be queried + * @return currently used refresh rate or - if request failed or RandRR is not available - 0.0 + */ +EAPI Ecore_X_Randr_Refresh_Rate +ecore_x_randr_screen_primary_output_current_refresh_rate_get( + Ecore_X_Window root) +{ +#ifdef ECORE_XRANDR + Ecore_X_Randr_Refresh_Rate ret = 0.0; + XRRScreenConfiguration *sc = NULL; + + if (!_ecore_x_randr_root_validate(root) || + !(sc = XRRGetScreenInfo(_ecore_x_disp, root))) + return ret; + + ret = XRRConfigCurrentRate(sc); + if (sc) + XRRFreeScreenConfigInfo(sc); + + return ret; +#else /* ifdef ECORE_XRANDR */ + return 0.0; +#endif /* ifdef ECORE_XRANDR */ +} /* ecore_x_randr_screen_primary_output_current_refresh_rate_get */ + +/* + * @param root window which's primary output will be queried + * @param size_index referencing the size to query valid refresh rates for + * @return currently used refresh rate or - if request failed or RandRR is not available - NULL + */ +EAPI Ecore_X_Randr_Refresh_Rate * +ecore_x_randr_screen_primary_output_refresh_rates_get(Ecore_X_Window root, + int size_index, + int *num) +{ +#ifdef ECORE_XRANDR + Ecore_X_Randr_Refresh_Rate *ret = NULL, *rates = NULL; + Ecore_X_Randr_Screen scr; + int n; + + if (num + && RANDR_VALIDATE_ROOT(scr, root) + && (rates = XRRRates(_ecore_x_disp, scr, size_index, &n))) + { + if (rates && (ret = malloc(sizeof(Ecore_X_Randr_Refresh_Rate) * n))) + { + memcpy(ret, rates, (sizeof(Ecore_X_Randr_Refresh_Rate) * n)); + *num = n; + } + } + + return ret; +#else /* ifdef ECORE_XRANDR */ + return NULL; +#endif /* ifdef ECORE_XRANDR */ +} /* ecore_x_randr_screen_primary_output_refresh_rates_get */ + +//>= 1.1 +/* + * @brief sets the current primary output's refresh rate + * @param root window which's primary output will be queried + * @param size_index referencing the size to be set + * @param rate the refresh rate to be set + * @return EINA_TRUE on success else EINA_FALSE + */ +EAPI Eina_Bool +ecore_x_randr_screen_primary_output_refresh_rate_set( + Ecore_X_Window root, + int size_index, + Ecore_X_Randr_Refresh_Rate + rate) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_1_RET(EINA_FALSE); + Eina_Bool ret = EINA_FALSE; + XRRScreenConfiguration *sc = NULL; + + if (!(sc = XRRGetScreenInfo(_ecore_x_disp, root))) + return ret; + + if (!XRRSetScreenConfigAndRate(_ecore_x_disp, sc, + root, size_index, + RR_Rotate_0, rate, CurrentTime)) + ret = EINA_TRUE; + + XRRFreeScreenConfigInfo(sc); + return ret; +#else /* ifdef ECORE_XRANDR */ + return EINA_FALSE; +#endif /* ifdef ECORE_XRANDR */ +} /* ecore_x_randr_screen_primary_output_refresh_rate_set */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c new file mode 100644 index 0000000..fb607d1 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c @@ -0,0 +1,2199 @@ +/* + * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2 + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "ecore_x_private.h" +#include "ecore_x_randr.h" + +#define Ecore_X_Randr_None (Ecore_X_Randr_Crtc)0 +#define Ecore_X_Randr_Unset (Ecore_X_Randr_Crtc) - 1 + +#ifdef ECORE_XRANDR + +#define RANDR_1_2 ((1 << 16) | 2) + +#define RANDR_VALIDATE_ROOT(screen, root) \ + ((screen = XRRRootToScreen(_ecore_x_disp, root)) != -1) + +#define RANDR_CHECK_1_2_RET(ret) if(_randr_version < RANDR_1_2) return ret + +#define RANDR_PROPERTY_EDID "EDID" +#define RANDR_PROPERTY_BACKLIGHT "Backlight" +#define RANDR_PROPERTY_SIGNAL_FORMAT "SignalFormat" +#define RANDR_PROPERTY_SIGNAL_PROPERTIES "SignalProperties" +#define RANDR_PROPERTY_CONNECTOR_TYPE "ConnectorType" +#define RANDR_PROPERTY_CONNECTOR_NUMBER "ConnectorNumber" +#define RANDR_PROPERTY_COMPATIBILITY_LIST "CompatibilityList" +#define RANDR_PROPERTY_CLONE_LIST "CloneList" + +extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display * + dpy, + Window + window); +extern int _randr_version; +#endif + +/** + * @brief enable event selection. This enables basic interaction with + * output/crtc events and requires RRandR >= 1.2. + * @param win select this window's properties for RandRR events + * @param on enable/disable selecting + */ +EAPI void +ecore_x_randr_events_select(Ecore_X_Window win, + Eina_Bool on) +{ +#ifdef ECORE_XRANDR + int mask; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!on) + mask = 0; + else + { + mask = RRScreenChangeNotifyMask; + if (_randr_version >= RANDR_1_2) + mask |= (RRCrtcChangeNotifyMask | + RROutputChangeNotifyMask | + RROutputPropertyNotifyMask); + } + + XRRSelectInput(_ecore_x_disp, win, mask); +#endif +} + +/** + * @brief validates a CRTC for a given root window's screen. + * @param root the window which's default display will be queried + * @param crtc the CRTC to be validated. + * @return in case it is found EINA_TRUE will be returned. Else EINA_FALSE is returned. + */ +static inline Eina_Bool +_ecore_x_randr_crtc_validate(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + XRRScreenResources *res = NULL; + int i; + Eina_Bool ret = EINA_FALSE; + + if ((crtc == Ecore_X_Randr_None) || + (crtc == Ecore_X_Randr_Unset)) + return ret; + + if (_ecore_x_randr_root_validate(root) && crtc && + (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) + { + for (i = 0; i < res->ncrtc; i++) + { + if (res->crtcs[i] == crtc) + { + ret = EINA_TRUE; + break; + } + } + XRRFreeScreenResources(res); + } + + return ret; +#else + return EINA_FALSE; +#endif +} + +Eina_Bool +_ecore_x_randr_output_validate(Ecore_X_Window root, + Ecore_X_Randr_Output output) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + Eina_Bool ret = EINA_FALSE; + XRRScreenResources *res = NULL; + int i; + + if (_ecore_x_randr_root_validate(root) && output && + (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) + { + for (i = 0; i < res->noutput; i++) + { + if (res->outputs[i] == output) + { + ret = EINA_TRUE; + break; + } + } + XRRFreeScreenResources(res); + } + + return ret; +#else + return EINA_FALSE; +#endif +} + +static inline Eina_Bool +_ecore_x_randr_mode_validate(Ecore_X_Window root, + Ecore_X_Randr_Mode mode) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + Eina_Bool ret = EINA_FALSE; + XRRScreenResources *res = NULL; + int i; + + if (_ecore_x_randr_root_validate(root) && mode && + (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) + { + for (i = 0; i < res->nmode; i++) + { + if (res->modes[i].id == mode) + { + ret = EINA_TRUE; + break; + } + } + XRRFreeScreenResources(res); + } + + return ret; +#else + return EINA_FALSE; +#endif +} + +/* + * @param w width of screen in px + * @param h height of screen in px + */ +EAPI void +ecore_x_randr_screen_current_size_get(Ecore_X_Window root, + int *w, + int *h, + int *w_mm, + int *h_mm) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(); + Ecore_X_Randr_Screen scr; + + if (!RANDR_VALIDATE_ROOT(scr, root)) + return; + + if (w) + *w = DisplayWidth(_ecore_x_disp, scr); + + if (h) + *h = DisplayHeight(_ecore_x_disp, scr); + + if (w_mm) + *w_mm = DisplayWidthMM(_ecore_x_disp, scr); + + if (h_mm) + *h_mm = DisplayHeightMM(_ecore_x_disp, scr); + +#endif +} + +/* + * @param root window which's screen will be queried + * @param wmin minimum width the screen can be set to + * @param hmin minimum height the screen can be set to + * @param wmax maximum width the screen can be set to + * @param hmax maximum height the screen can be set to + */ +EAPI void +ecore_x_randr_screen_size_range_get(Ecore_X_Window root, + int *wmin, + int *hmin, + int *wmax, + int *hmax) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(); + int twmin, thmin, twmax, thmax; + if (XRRGetScreenSizeRange (_ecore_x_disp, root, &twmin, &thmin, &twmax, + &thmax)) + { + if (wmin) + *wmin = twmin; + + if (hmin) + *hmin = thmin; + + if (wmax) + *wmax = twmax; + + if (hmax) + *hmax = thmax; + } + +#endif +} + +/* + * @param root window which's screen's size should be set. If invalid (e.g. NULL) no action is taken. + * @param w width in px the screen should be set to. If out of valid boundaries, current value is assumed. + * @param h height in px the screen should be set to. If out of valid boundaries, current value is assumed. + * @param w_mm width in mm the screen should be set to. If 0, current aspect is assumed. + * @param h_mm height in mm the screen should be set to. If 0, current aspect is assumed. + * @return EINA_TRUE if request was successfully sent or screen is already in + * requested size, EINA_FALSE if parameters are invalid + */ +EAPI Eina_Bool +ecore_x_randr_screen_current_size_set(Ecore_X_Window root, + int w, + int h, + int w_mm, + int h_mm) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + Ecore_X_Randr_Screen scr; + int w_c, h_c, w_mm_c, h_mm_c, twmin, thmin, twmax, thmax; + + if (!RANDR_VALIDATE_ROOT(scr, root)) + return EINA_FALSE; + + ecore_x_randr_screen_current_size_get(root, &w_c, &h_c, &w_mm_c, &h_mm_c); + if ((w == w_c) && (h == h_c) && (w_mm_c == w_mm) && (h_mm_c == h_mm)) + return EINA_TRUE; + + ecore_x_randr_screen_size_range_get(root, &twmin, &thmin, &twmax, &thmax); + + if (((w != Ecore_X_Randr_None) && + ((w < twmin) || + (w > twmax))) || + ((h != Ecore_X_Randr_None) && ((h < thmin) || (h > thmax)))) + return EINA_FALSE; + + if (w <= 0) + w = DisplayWidth(_ecore_x_disp, scr); + + if (h <= 0) + h = DisplayHeight(_ecore_x_disp, scr); + + if(w_mm <= 0) + w_mm = + (int)(((double)(DisplayWidthMM(_ecore_x_disp, + scr) / + (double)DisplayWidth(_ecore_x_disp, + scr))) * (double)w); + + if(h_mm <= 0) + h_mm = + (int)(((double)(DisplayHeightMM(_ecore_x_disp, + scr) / + (double)DisplayHeight(_ecore_x_disp, + scr))) * (double)h); + + XRRSetScreenSize (_ecore_x_disp, root, w, h, w_mm, h_mm); + return EINA_TRUE; +#else + return EINA_FALSE; +#endif +} + +/* + * @brief get detailed information for all modes related to a root window's screen + * @param root window which's screen's ressources are queried + * @param num number of modes returned + * @return modes' information + */ +EAPI Ecore_X_Randr_Mode_Info ** +ecore_x_randr_modes_info_get(Ecore_X_Window root, + int *num) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(NULL); + XRRScreenResources *res = NULL; + Ecore_X_Randr_Mode_Info **ret = NULL; + int i; + + if (_ecore_x_randr_root_validate(root) && + (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) + { + if ((ret = + (Ecore_X_Randr_Mode_Info **)malloc(sizeof( + Ecore_X_Randr_Mode_Info *) + * + res->nmode))) + { + for (i = 0; i < res->nmode; i++) + { + if ((ret[i] = malloc(sizeof(Ecore_X_Randr_Mode_Info)))) + { + ret[i]->xid = res->modes[i].id; + ret[i]->width = res->modes[i].width; + ret[i]->height = res->modes[i].height; + ret[i]->dotClock = res->modes[i].dotClock; + ret[i]->hSyncStart = res->modes[i].hSyncStart; + ret[i]->hSyncEnd = res->modes[i].hSyncEnd; + ret[i]->hTotal = res->modes[i].hTotal; + ret[i]->hSkew = res->modes[i].hSkew; + ret[i]->vSyncStart = res->modes[i].vSyncStart; + ret[i]->vSyncEnd = res->modes[i].vSyncEnd; + ret[i]->vTotal = res->modes[i].vTotal; + if ((ret[i]->name = (malloc(res->modes[i].nameLength)))) + strncpy(ret[i]->name, res->modes[i].name, + res->modes[i].nameLength); + else + ret[i]->name = NULL; + + ret[i]->nameLength = res->modes[i].nameLength; + ret[i]->modeFlags = res->modes[i].modeFlags; + } + else + { + while(i > 0) + free(ret[--i]); + free(ret); + ret = NULL; + break; + } + } + } + + if (ret && num) + *num = res->nmode; + + XRRFreeScreenResources(res); + } + + return ret; +#else + return NULL; +#endif +} + +/* + * @brief get detailed information for a given mode id + * @param root window which's screen's ressources are queried + * @param mode the XID which identifies the mode of interest + * @return mode's detailed information + */ +EAPI Ecore_X_Randr_Mode_Info * +ecore_x_randr_mode_info_get(Ecore_X_Window root, + Ecore_X_Randr_Mode mode) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(NULL); + XRRScreenResources *res = NULL; + Ecore_X_Randr_Mode_Info *ret = NULL; + int i; + + if (_ecore_x_randr_root_validate(root) && + (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) + { + for (i = 0; i < res->nmode; i++) + { + if ((res->modes[i].id == mode) && + (ret = malloc(sizeof(Ecore_X_Randr_Mode_Info)))) + { + ret->xid = res->modes[i].id; + ret->width = res->modes[i].width; + ret->height = res->modes[i].height; + ret->dotClock = res->modes[i].dotClock; + ret->hSyncStart = res->modes[i].hSyncStart; + ret->hSyncEnd = res->modes[i].hSyncEnd; + ret->hTotal = res->modes[i].hTotal; + ret->hSkew = res->modes[i].hSkew; + ret->vSyncStart = res->modes[i].vSyncStart; + ret->vSyncEnd = res->modes[i].vSyncEnd; + ret->vTotal = res->modes[i].vTotal; + ret->name = NULL; + ret->nameLength = 0; + if (res->modes[i].nameLength > 0) + { + ret->nameLength = res->modes[i].nameLength; + ret->name = malloc(res->modes[i].nameLength + 1); + if (ret->name) + memcpy(ret->name, res->modes[i].name, + res->modes[i].nameLength + 1); + } + ret->modeFlags = res->modes[i].modeFlags; + break; + } + } + XRRFreeScreenResources(res); + } + + return ret; +#else + return NULL; +#endif +} + +/* + * @brief free detailed mode information. The pointer handed in will be set to + * NULL after freeing the memory. + * @param mode_info the mode information that should be freed + */ +EAPI void +ecore_x_randr_mode_info_free(Ecore_X_Randr_Mode_Info *mode_info) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(); + if (!mode_info) + return; + + if (mode_info->name) + free(mode_info->name); + + free(mode_info); + mode_info = NULL; +#endif +} + +/* + * @brief get all known CRTCs related to a root window's screen + * @param root window which's screen's ressources are queried + * @param num number of CRTCs returned + * @return CRTC IDs + */ +EAPI Ecore_X_Randr_Crtc * +ecore_x_randr_crtcs_get(Ecore_X_Window root, + int *num) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(NULL); + XRRScreenResources *res = NULL; + Ecore_X_Randr_Crtc *ret = NULL; + + if (num && root && + (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) + { + if ((ret = malloc(sizeof(Ecore_X_Randr_Crtc) * res->ncrtc))) + { + memcpy(ret, res->crtcs, (sizeof(Ecore_X_Randr_Crtc) * res->ncrtc)); + *num = res->ncrtc; + } + + XRRFreeScreenResources(res); + } + + return ret; +#else + return NULL; +#endif +} + +EAPI Ecore_X_Randr_Output * +ecore_x_randr_outputs_get(Ecore_X_Window root, + int *num) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(NULL); + XRRScreenResources *res = NULL; + Ecore_X_Randr_Output *ret = NULL; + + if (num && root && + (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) + { + if ((ret = malloc(sizeof(Ecore_X_Randr_Output) * res->noutput))) + { + memcpy(ret, res->outputs, + (sizeof(Ecore_X_Randr_Output) * res->noutput)); + if (num) + *num = res->noutput; + } + + if (res) + XRRFreeScreenResources(res); + } + + return ret; +#else + return NULL; +#endif +} + +//Per Crtc +/* + * @brief get a CRTC's outputs. + * @param root the root window which's screen will be queried + * @param num number of outputs referenced by given CRTC + */ +EAPI Ecore_X_Randr_Output * +ecore_x_randr_crtc_outputs_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *num) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(NULL); + XRRScreenResources *res = NULL; + Ecore_X_Randr_Output *ret = NULL; + XRRCrtcInfo *crtc_info = NULL; + + if (_ecore_x_randr_crtc_validate(root, + crtc) && + (res = + _ecore_x_randr_get_screen_resources (_ecore_x_disp, + root)) && + (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) + { + if ((ret = malloc(sizeof(Ecore_X_Randr_Output) * crtc_info->noutput))) + { + memcpy(ret, crtc_info->outputs, + (sizeof(Ecore_X_Randr_Output) * crtc_info->noutput)); + if (num) + *num = crtc_info->noutput; + } + + if (crtc_info) + XRRFreeCrtcInfo(crtc_info); + + if (res) + XRRFreeScreenResources(res); + } + + return ret; +#else + return NULL; +#endif +} + +/* + * @brief get a CRTC's possible outputs. + * @param root the root window which's screen will be queried + * @param num number of possible outputs referenced by given CRTC + */ +EAPI Ecore_X_Randr_Output * +ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *num) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(NULL); + XRRScreenResources *res = NULL; + Ecore_X_Randr_Output *ret = NULL; + XRRCrtcInfo *crtc_info = NULL; + + if (_ecore_x_randr_crtc_validate(root, + crtc) && + (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) + { + if((crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) + { + if ((ret = + malloc(sizeof(Ecore_X_Randr_Output) * crtc_info->npossible))) + { + memcpy(ret, crtc_info->possible, + (sizeof(Ecore_X_Randr_Output) * crtc_info->npossible)); + if (num) + *num = res->ncrtc; + } + + XRRFreeCrtcInfo(crtc_info); + } + + XRRFreeScreenResources(res); + } + + return ret; +#else + return NULL; +#endif +} + +EAPI void +ecore_x_randr_crtc_geometry_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *x, + int *y, + int *w, + int *h) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(); + XRRScreenResources *res = NULL; + XRRCrtcInfo *crtc_info = NULL; + + if (_ecore_x_randr_crtc_validate(root, + crtc) && + (res = + _ecore_x_randr_get_screen_resources (_ecore_x_disp, + root)) && + (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) + { + if (x) + *x = crtc_info->x; + + if (y) + *y = crtc_info->y; + + if (w) + *w = crtc_info->width; + + if (h) + *h = crtc_info->height; + + XRRFreeCrtcInfo(crtc_info); + XRRFreeScreenResources(res); + } + +#endif +} + +/* + * @brief sets the position of given CRTC within root window's screen + * @param root the window's screen to be queried + * @param crtc the CRTC which's position within the mentioned screen is to be altered + * @param x position on the x-axis (0 == left) of the screen. if x < 0 current value will be kept. + * @param y position on the y-ayis (0 == top) of the screen. if y < 0, current value will be kept. + * @return EINA_TRUE if position could be successfully be altered. + */ +EAPI Eina_Bool +ecore_x_randr_crtc_pos_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int x, + int y) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + int w_c, h_c, w_new = 0, h_new = 0; + Eina_Rectangle crtc_geo; + + ecore_x_randr_crtc_geometry_get(root, + crtc, + &crtc_geo.x, + &crtc_geo.y, + &crtc_geo.w, + &crtc_geo.h); + ecore_x_randr_screen_current_size_get(root, &w_c, &h_c, NULL, NULL); + if (x < 0) + x = crtc_geo.x; + + if (y < 0) + y = crtc_geo.y; + + if ((x + crtc_geo.w) > w_c) + w_new = x + crtc_geo.w; + + if ((y + crtc_geo.h) > h_c) + h_new = y + crtc_geo.h; + + if ((w_new != 0) || (h_new != 0)) + if (!ecore_x_randr_screen_current_size_set(root, w_new, h_new, 0, 0)) + return EINA_FALSE; + + return ecore_x_randr_crtc_settings_set(root, + crtc, + NULL, + Ecore_X_Randr_Unset, + x, + y, + Ecore_X_Randr_Unset, + Ecore_X_Randr_Unset); +#else + return EINA_FALSE; +#endif +} + +/** + * @brief Get the current set mode of a given CRTC + * @param root the window's screen to be queried + * @param crtc the CRTC which's should be queried + * @return currently set mode or - in case parameters are invalid - + * Ecore_X_Randr_Unset + */ +EAPI Ecore_X_Randr_Mode +ecore_x_randr_crtc_mode_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(Ecore_X_Randr_Unset); + XRRScreenResources *res = NULL; + XRRCrtcInfo *crtc_info = NULL; + Ecore_X_Randr_Mode ret = Ecore_X_Randr_Unset; + if (_ecore_x_randr_root_validate(root) && + _ecore_x_randr_crtc_validate(root, + crtc) && + (res = + _ecore_x_randr_get_screen_resources(_ecore_x_disp, + root)) && + (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) + { + ret = crtc_info->mode; + XRRFreeCrtcInfo(crtc_info); + XRRFreeScreenResources(res); + } + + return ret; +#else + return Ecore_X_Randr_Unset; +#endif +} + +/** + * @brief sets a mode for a CRTC and the outputs attached to it + * @param root the window's screen to be queried + * @param crtc the CRTC which shall be set + * @param outputs array of outputs which have to be compatible with the mode. If + * NULL CRTC will be disabled. + * @param noutputs number of outputs in array to be used. Use + * Ecore_X_Randr_Unset (or -1) to use currently used outputs. + * @param mode XID of the mode to be set. If set to 0 the CRTC will be disabled. + * If set to -1 the call will fail. + * @return EINA_TRUE if mode setting was successful. Else EINA_FALSE + */ +EAPI Eina_Bool +ecore_x_randr_crtc_mode_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + Ecore_X_Randr_Output *outputs, + int noutputs, + Ecore_X_Randr_Mode mode) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + if (mode == Ecore_X_Randr_Unset) + return EINA_FALSE; + + return ecore_x_randr_crtc_settings_set(root, + crtc, + outputs, + noutputs, + Ecore_X_Randr_Unset, + Ecore_X_Randr_Unset, + mode, + Ecore_X_Randr_Unset); +#else + return EINA_FALSE; +#endif +} + +EAPI void +ecore_x_randr_crtc_size_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *w, + int *h) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(); + ecore_x_randr_crtc_geometry_get(root, crtc, NULL, NULL, w, h); +#endif +} + +EAPI Ecore_X_Randr_Refresh_Rate +ecore_x_randr_crtc_refresh_rate_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + Ecore_X_Randr_Mode mode) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(0.0); + XRRScreenResources *res = NULL; + XRRCrtcInfo *crtc_info = NULL; + Ecore_X_Randr_Refresh_Rate ret = 0.0; + int i; + + if (_ecore_x_randr_crtc_validate(root, + crtc) && + (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) + { + for (i = 0; i < res->nmode; i++) + if (res->modes[i].id == mode) + { + if (res->modes[i].hTotal && res->modes[i].vTotal) + ret = ((double)res->modes[i].dotClock / + ((double)res->modes[i].hTotal * + (double)res->modes[i].vTotal)); + + break; + } + } + + if (crtc_info) + XRRFreeCrtcInfo(crtc_info); + + if (res) + XRRFreeScreenResources(res); + + return ret; +#else + return 0.0; +#endif +} + +EAPI Ecore_X_Randr_Orientation +ecore_x_randr_crtc_orientations_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(Ecore_X_Randr_None); + XRRCrtcInfo *crtc_info = NULL; + XRRScreenResources *res = NULL; + Ecore_X_Randr_Orientation ret = Ecore_X_Randr_None; + + if (_ecore_x_randr_crtc_validate(root, + crtc) && + (res = + _ecore_x_randr_get_screen_resources (_ecore_x_disp, + root)) && + (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) + { + ret = crtc_info->rotations; + } + if (crtc_info) + XRRFreeCrtcInfo(crtc_info); + + if (res) + XRRFreeScreenResources(res); + + return ret; +#else + return Ecore_X_Randr_None; +#endif +} + +EAPI Ecore_X_Randr_Orientation +ecore_x_randr_crtc_orientation_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(Ecore_X_Randr_None); + XRRCrtcInfo *crtc_info = NULL; + XRRScreenResources *res = NULL; + Ecore_X_Randr_Orientation ret = Ecore_X_Randr_None; + + if (_ecore_x_randr_crtc_validate(root, + crtc) && + (res = + _ecore_x_randr_get_screen_resources (_ecore_x_disp, + root)) && + (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) + { + ret = crtc_info->rotation; + } + if (crtc_info) + XRRFreeCrtcInfo(crtc_info); + + if (res) + XRRFreeScreenResources(res); + + return ret; +#else + return Ecore_X_Randr_None; +#endif +} + +EAPI Eina_Bool +ecore_x_randr_crtc_orientation_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + Ecore_X_Randr_Orientation orientation) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + Eina_Bool ret = EINA_FALSE; + + if (orientation != Ecore_X_Randr_None) + { + ret = ecore_x_randr_crtc_settings_set(root, + crtc, + NULL, + Ecore_X_Randr_Unset, + Ecore_X_Randr_Unset, + Ecore_X_Randr_Unset, + Ecore_X_Randr_Unset, + orientation); + } + + return ret; +#else + return EINA_FALSE; +#endif +} + +EAPI void +ecore_x_randr_crtc_pos_get(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + int *x, + int *y) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(); + + ecore_x_randr_crtc_geometry_get(root, crtc, x, y, NULL, NULL); +#endif +} + +EAPI Eina_Bool +ecore_x_randr_crtc_clone_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc original, + Ecore_X_Randr_Crtc clon) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + XRRScreenResources *res = NULL; + XRRCrtcInfo *clone_crtc_info = NULL; + Ecore_X_Randr_Mode original_mode = Ecore_X_Randr_None; + Ecore_X_Randr_Orientation original_orientation = Ecore_X_Randr_None; + Eina_Bool ret = EINA_FALSE; + int x, y; + + if (_ecore_x_randr_root_validate(root) && + _ecore_x_randr_crtc_validate(root, + original) && + _ecore_x_randr_crtc_validate(root, + clon) && + (res = + _ecore_x_randr_get_screen_resources (_ecore_x_disp, + root)) && + (clone_crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, clon))) + { + ecore_x_randr_crtc_geometry_get(root, original, &x, &y, NULL, NULL); + original_mode = ecore_x_randr_crtc_mode_get(root, original); + original_orientation = ecore_x_randr_crtc_orientation_get(root, + original); + ret = ecore_x_randr_crtc_settings_set(root, + clon, + NULL, + Ecore_X_Randr_Unset, + x, + y, + original_mode, + original_orientation); + XRRFreeCrtcInfo(clone_crtc_info); + XRRFreeScreenResources(res); + } + + return ret; +#else + return EINA_FALSE; +#endif +} + +/** + * @brief sets the demanded parameters for a given CRTC. Note that the CRTC is + * auto enabled in it's preferred mode, when it was disabled before. + * @param root the root window which's default display will be queried + * @param crtc the CRTC which's configuration should be altered + * @param outputs an array of outputs, that should display this CRTC's content. + * @param noutputs number of outputs in the array of outputs. + * If set to Ecore_X_Randr_Unset, current outputs and number of outputs will be used. + * If set to Ecore_X_Randr_None, CRTC will be disabled + * @param x new x coordinate. If <0 (e.g. Ecore_X_Randr_Unset) the current x + * corrdinate will be assumed. + * @param y new y coordinate. If <0 (e.g. Ecore_X_Randr_Unset) the current y + * corrdinate will be assumed. + * @param mode the new mode to be set. If Ecore_X_Randr_None is passed, the + * CRTC will be disabled. If Ecore_X_Randr_Unset is passed, the current mode is assumed. + * @param orientation the new orientation to be set. If Ecore_X_Randr_Unset is used, + * the current mode is assumed. + * @return EINA_TRUE if the configuration alteration was successful, else + * EINA_FALSE + */ +EAPI Eina_Bool +ecore_x_randr_crtc_settings_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc, + Ecore_X_Randr_Output *outputs, + int noutputs, + int x, + int y, + Ecore_X_Randr_Mode mode, + Ecore_X_Randr_Orientation orientation) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + XRRScreenResources *res = NULL; + XRRCrtcInfo *crtc_info = NULL; + Eina_Bool ret = EINA_FALSE; + + if (_ecore_x_randr_crtc_validate(root, + crtc) && + (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) + { + if ((crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) + { + if ((mode == Ecore_X_Randr_None) || + (noutputs == Ecore_X_Randr_None)) + { + outputs = NULL; + noutputs = 0; + } + else if (noutputs == (int)Ecore_X_Randr_Unset) + { + outputs = (Ecore_X_Randr_Output *)crtc_info->outputs; + noutputs = crtc_info->noutput; + } + + if (mode == Ecore_X_Randr_Unset) + mode = crtc_info->mode; + + if (x < 0) + x = crtc_info->x; + + if (y < 0) + y = crtc_info->y; + + if (orientation == Ecore_X_Randr_Unset) + orientation = crtc_info->rotation; + + if (!XRRSetCrtcConfig(_ecore_x_disp, res, crtc, CurrentTime, + x, y, mode, orientation, (RROutput *)outputs, + noutputs)) + ret = EINA_TRUE; + + XRRFreeCrtcInfo(crtc_info); + } + + XRRFreeScreenResources(res); + } + + return ret; +#else + return EINA_FALSE; +#endif +} + +/** + * @brief sets a CRTC relative to another one. + * @param crtc_r1 the CRTC to be positioned. + * @param crtc_r2 the CRTC the position should be relative to + * @param position the relation between the crtcs + * @param alignment in case CRTCs size differ, aligns CRTC1 accordingly at CRTC2's + * borders + * @return EINA_TRUE if crtc could be successfully positioned. EINA_FALSE if + * repositioning failed or if position of new crtc would be out of given screen's min/max bounds. + */ +EAPI Eina_Bool +ecore_x_randr_crtc_pos_relative_set(Ecore_X_Window root, + Ecore_X_Randr_Crtc crtc_r1, + Ecore_X_Randr_Crtc crtc_r2, + Ecore_X_Randr_Output_Policy policy, + Ecore_X_Randr_Relative_Alignment alignment) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + + Eina_Rectangle r1_geo, r2_geo; + int w_max, h_max, cw, ch, x_n = Ecore_X_Randr_Unset, y_n = + Ecore_X_Randr_Unset; + /* + int r1_noutputs, r2_noutputs, r1_nmodes, i, j, outputs_mode_found, mode_w, mode_h; + Ecore_X_Randr_Output *r1_outputs, *r2_outputs, *r2_r1_outputs; + Ecore_X_Randr_Mode *r1_modes, r2_mode, r1_mode; + Eina_Bool ret; + */ + + if ((ecore_x_randr_crtc_mode_get(root, crtc_r1) == Ecore_X_Randr_None) + || (ecore_x_randr_crtc_mode_get(root, crtc_r2) == Ecore_X_Randr_None)) + return EINA_FALSE; + + if (!_ecore_x_randr_crtc_validate(root, crtc_r1) || + (!(crtc_r1 != crtc_r2) && + !_ecore_x_randr_crtc_validate(root, crtc_r2))) + return EINA_FALSE; + + ecore_x_randr_crtc_geometry_get(root, + crtc_r1, + &r1_geo.x, + &r1_geo.y, + &r1_geo.w, + &r1_geo.h); + ecore_x_randr_crtc_geometry_get(root, + crtc_r2, + &r2_geo.x, + &r2_geo.y, + &r2_geo.w, + &r2_geo.h); + ecore_x_randr_screen_size_range_get(root, NULL, NULL, &w_max, &h_max); + ecore_x_randr_screen_current_size_get(root, &cw, &ch, NULL, NULL); + + switch (policy) + { + case ECORE_X_RANDR_OUTPUT_POLICY_RIGHT: + //set r1 right of r2 + x_n = r2_geo.x + r2_geo.w; + + switch (alignment) + { + case ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE: + y_n = Ecore_X_Randr_Unset; + break; + + case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL: + y_n = + ((int)(((double)r2_geo.h / + 2.0) + (double)r2_geo.y - ((double)r1_geo.h / 2.0))); + break; + + case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR: + y_n = ((int)((double)ch / 2.0) - ((double)r1_geo.h / 2.0)); + break; + } + break; + + case ECORE_X_RANDR_OUTPUT_POLICY_LEFT: + //set r1 left of r2 + x_n = r2_geo.x - r1_geo.w; + + switch (alignment) + { + case ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE: + y_n = Ecore_X_Randr_Unset; + break; + + case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL: + y_n = + ((int)(((double)r2_geo.h / + 2.0) + r2_geo.y - ((double)r1_geo.h / 2.0))); + break; + + case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR: + y_n = ((int)(((double)ch / 2.0) - ((double)r1_geo.h / 2.0))); + break; + } + break; + + case ECORE_X_RANDR_OUTPUT_POLICY_BELOW: + //set r1 below r2 + y_n = r2_geo.y + r2_geo.h; + + switch (alignment) + { + case ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE: + x_n = Ecore_X_Randr_Unset; + break; + + case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL: + x_n = + ((int)((((double)r2_geo.x + + (double)r2_geo.w) / 2.0) - ((double)r1_geo.w / 2.0))); + break; + + case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR: + x_n = ((int)((double)cw / 2.0)); + break; + } + break; + + case ECORE_X_RANDR_OUTPUT_POLICY_ABOVE: + y_n = r2_geo.y - r1_geo.h; + + //set r1 above r2 + switch (alignment) + { + case ECORE_X_RANDR_RELATIVE_ALIGNMENT_NONE: + x_n = Ecore_X_Randr_Unset; + break; + + case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_REL: + x_n = + ((int)((((double)r2_geo.x + + (double)r2_geo.w) / 2.0) - ((double)r1_geo.w / 2.0))); + break; + + case ECORE_X_RANDR_RELATIVE_ALIGNMENT_CENTER_SCR: + x_n = ((int)((double)cw / 2.0)); + break; + } + break; + + case ECORE_X_RANDR_OUTPUT_POLICY_CLONE: + return ecore_x_randr_crtc_pos_set(root, crtc_r1, r2_geo.x, r2_geo.y); + + /* entire cloning (including modesetting) + //all outputs of crtc1 capable of crtc2's current mode? + r2_mode = ecore_x_randr_crtc_mode_get(root, crtc_r2); + if (!(r1_outputs = + ecore_x_randr_crtc_outputs_get(root, crtc_r1, + &r1_noutputs)) || + (r1_noutputs == 0)) + return EINA_FALSE; + + for (i = 0, outputs_mode_found = 0; i < r1_noutputs; i++) + { + if (!(r1_modes = + ecore_x_randr_output_modes_get(root, r1_outputs[i], + &r1_nmodes, NULL))) + { + free(r1_outputs); + return EINA_FALSE; + } + + for (j = 0; j < r1_nmodes; j++) + { + ecore_x_randr_mode_size_get(root, + r1_modes[j], + &mode_w, + &mode_h); + if ((mode_w == r2_geo.w) && (mode_h == r2_geo.h)) + { + r1_mode = r1_modes[j]; + ++outputs_mode_found; + free(r1_modes); + r1_modes = NULL; + break; + } + } + if (r1_modes) + free(r1_modes); + + if (outputs_mode_found <= i) + { + //an output doesn't support the set mode, cancel! + free(r1_outputs); + return EINA_FALSE; + } + } + free (r1_outputs); + //CRTC 1's outputs support a mode of same geometry as CRTC 2. + ret = + (ecore_x_randr_crtc_mode_set(root, crtc_r1, Ecore_X_Randr_None, + Ecore_X_Randr_None, + r1_mode) && + ecore_x_randr_crtc_pos_set(root, crtc_r1, r2_geo.x, r2_geo.y)); + return ret; + */ + + /* entire cloning on same CRTC + //all outputs of crtc1 capable of crtc2's current mode? + r2_mode = ecore_x_randr_crtc_mode_get(root, crtc_r2); + if (!(r1_outputs = + ecore_x_randr_crtc_outputs_get(root, crtc_r1, + &r1_noutputs)) || + (r1_noutputs == 0)) + return EINA_FALSE; + + for (i = 0, outputs_mode_found = 0; i < r1_noutputs; i++) + { + if (!(r1_modes = + ecore_x_randr_output_modes_get(root, r1_outputs[i], + &r1_nmodes, NULL))) + { + free(r1_outputs); + return EINA_FALSE; + } + + for (j = 0; j < r1_nmodes; j++) + { + if (r1_modes[j] == r2_mode) + { + ++outputs_mode_found; + free(r1_modes); + r1_modes = NULL; + break; + } + } + if (r1_modes) + free(r1_modes); + + if (outputs_mode_found <= i) + { + //an output doesn't support the set mode, cancel! + free(r1_outputs); + return EINA_FALSE; + } + } + //check whether crtc r2 can use all outputs of r1. + if (!(r2_outputs = + ecore_x_randr_crtc_possible_outputs_get(root, crtc_r2, + &r2_noutputs)) || + (r2_noutputs == 0)) + { + free(r1_outputs); + return EINA_FALSE; + } + + for (i = 0; i < r1_noutputs; i++) + { + for (j = 0; j < r2_noutputs; ) + { + if (r1_outputs[i] == r2_outputs[j]) + break; + + j++; + } + if (j == r2_noutputs) + { + //didn't find the output! + free (r1_outputs); + free (r2_outputs); + return EINA_FALSE; + } + } + + //apparently crtc2 supports all outputs of r1 + //TODO: check with the compatible list of outputs (property in RR1.3) + r2_r1_outputs = + malloc(sizeof(Ecore_X_Randr_Output) * (r1_noutputs + r2_noutputs)); + for (i = 0; i < r1_noutputs; i++) + { + r2_r1_outputs[i] = r1_outputs[i]; + } + free(r1_outputs); + for (; i < r2_noutputs; i++) + { + r2_r1_outputs[i] = r2_outputs[i]; + } + free(r2_outputs); + ret = + ecore_x_randr_crtc_mode_set(root, crtc_r2, r2_r1_outputs, + (r1_noutputs + r1_noutputs), r2_mode); + free (r2_r1_outputs); + return ret; + */ + case ECORE_X_RANDR_OUTPUT_POLICY_NONE: + break; + } + if ((x_n == r1_geo.x) && (y_n == r1_geo.x)) + return EINA_TRUE; + + //out of possible bounds? + if (((y_n + r1_geo.h) > h_max) || ((x_n + r1_geo.w) > w_max)) + return EINA_FALSE; + + return ecore_x_randr_crtc_pos_set(root, crtc_r1, x_n, y_n); +#else + return EINA_FALSE; +#endif +} + +EAPI Ecore_X_Randr_Mode * +ecore_x_randr_output_modes_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num, + int *npreferred) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(NULL); + XRRScreenResources *res = NULL; + XRROutputInfo *output_info = NULL; + Ecore_X_Randr_Mode *modes = NULL; + + if ((output != Ecore_X_Randr_None) + && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)) + && (output_info = + XRRGetOutputInfo(_ecore_x_disp, res, (RROutput)output))) + { + if ((modes = malloc(sizeof(Ecore_X_Randr_Mode) * output_info->nmode))) + { + memcpy(modes, output_info->modes, + (sizeof(Ecore_X_Randr_Mode) * output_info->nmode)); + if (num) + *num = output_info->nmode; + + if (npreferred) + *npreferred = output_info->npreferred; + } + } + + if (output_info) + XRRFreeOutputInfo(output_info); + + if (res) + XRRFreeScreenResources(res); + + return modes; +#else + return NULL; +#endif +} + +EAPI Ecore_X_Randr_Crtc * +ecore_x_randr_output_possible_crtcs_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(NULL); + XRRScreenResources *res = NULL; + XRROutputInfo *output_info = NULL; + Ecore_X_Randr_Crtc *crtcs = NULL; + + if ((output != Ecore_X_Randr_None)) + { + if ((res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) + { + if ((output_info = XRRGetOutputInfo(_ecore_x_disp, res, output))) + { + if ((crtcs = malloc(sizeof(Ecore_X_Randr_Crtc) * output_info->ncrtc))) + { + memcpy(crtcs, output_info->crtcs, (sizeof(Ecore_X_Randr_Crtc) * output_info->ncrtc)); + if (num) *num = output_info->ncrtc; + } + XRRFreeOutputInfo(output_info); + } + XRRFreeScreenResources(res); + } + } + return crtcs; +#else + return Ecore_X_Randr_None; +#endif +} + +/** + * @brief gets the the outputs which might be used simultenously on the same + * CRTC. + * @param root window that this information should be queried for. + * @param output the output which's clones we concern + * @param num number of possible clones + */ +EAPI Ecore_X_Randr_Output * +ecore_x_randr_output_clones_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *num) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(NULL); + XRRScreenResources *res = NULL; + XRROutputInfo *output_info = NULL; + Ecore_X_Randr_Output *outputs = NULL; + + if ((output != Ecore_X_Randr_None)) + { + if ((res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) + { + if ((output_info = XRRGetOutputInfo(_ecore_x_disp, res, output))) + { + if ((outputs = malloc(sizeof(Ecore_X_Randr_Output) * output_info->nclone))) + { + memcpy(outputs, output_info->clones, (sizeof(Ecore_X_Randr_Output) * output_info->nclone)); + if (num) *num = output_info->nclone; + } + XRRFreeOutputInfo(output_info); + } + XRRFreeScreenResources(res); + } + } + return outputs; +#else + return Ecore_X_Randr_None; +#endif +} + +EAPI Ecore_X_Randr_Crtc +ecore_x_randr_output_crtc_get(Ecore_X_Window root, + Ecore_X_Randr_Output output) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(Ecore_X_Randr_None); + XRRScreenResources *res = NULL; + XRROutputInfo *output_info = NULL; + Ecore_X_Randr_Crtc ret = Ecore_X_Randr_None; + + if ((output != Ecore_X_Randr_None)) + { + if ((res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) + { + if ((output_info = XRRGetOutputInfo(_ecore_x_disp, res, output))) + { + ret = output_info->crtc; + XRRFreeOutputInfo(output_info); + } + XRRFreeScreenResources(res); + } + } + + return ret; +#else + return Ecore_X_Randr_None; +#endif +} + +/** + * @brief gets the given output's name as reported by X + * @param root the window which's screen will be queried + * @param len length of returned c-string. + * @return name of the output as reported by X + */ +EAPI char * +ecore_x_randr_output_name_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *len) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(NULL); + XRRScreenResources *res = NULL; + XRROutputInfo *output_info = NULL; + char *ret = NULL; + + if ((output != Ecore_X_Randr_None) + && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)) + && (output_info = XRRGetOutputInfo(_ecore_x_disp, res, output))) + { + /* + * Actually the below command is correct, but due to a bug in libXrandr + * it doesn't work. Therefore we stick with strlen(). + * Replace the line below with the following once this bug is + * fixed within libXrandr. + * + * *len = output_info->nameLen; + * + */ + if ((ret = strdup(output_info->name)) && len) + *len = strlen(ret); + + XRRFreeOutputInfo(output_info); + } + + if (res) + XRRFreeScreenResources(res); + + return ret; +#else + return NULL; +#endif +} + +/** + * @brief gets the width and hight of a given mode + * @param mode the mode which's size is to be looked up + * @param w width of given mode in px + * @param h height of given mode in px + */ +EAPI void +ecore_x_randr_mode_size_get(Ecore_X_Window root, + Ecore_X_Randr_Mode mode, + int *w, + int *h) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(); + XRRScreenResources *res = NULL; + int i; + + if ((mode != Ecore_X_Randr_None) + && (w || h) + && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) + { + for (i = 0; i < res->nmode; i++) + { + if (res->modes[i].id == mode) + { + if (w) + *w = res->modes[i].width; + + if (h) + *h = res->modes[i].height; + + break; + } + } + } + + if (res) + XRRFreeScreenResources(res); + +#endif +} + +/** + * @brief gets the EDID information of an attached output if available. + * Note that this information is not to be compared using ordinary string + * comparison functions, since it includes 0-bytes. + * @param root window this information should be queried from + * @param output the XID of the output + * @param length length of the byte-array. If NULL, request will fail. + */ +EAPI unsigned char * +ecore_x_randr_output_edid_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + unsigned long *length) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(NULL); + Atom name = XInternAtom (_ecore_x_disp, RANDR_PROPERTY_EDID, False); + unsigned char *prop_data, *ret = NULL; + int actual_format; + unsigned long nitems, bytes_after; + Atom actual_type; + + if (!length || !_ecore_x_randr_output_validate(root, output)) + return NULL; + + if(XRRGetOutputProperty (_ecore_x_disp, output, name, + 0, 100, False, False, + AnyPropertyType, + &actual_type, &actual_format, + &nitems, &bytes_after, &prop_data) == Success) + { + if (actual_type == XA_INTEGER && actual_format == 8) + { + if ((ret = malloc(nitems * sizeof(unsigned char)))) + { + if(length && + (memcpy(ret, prop_data, (nitems * sizeof(unsigned char))))) + *length = nitems; + + return ret; + } + } + } + + return NULL; +#else + return NULL; +#endif +} + +EAPI Ecore_X_Randr_Connection_Status +ecore_x_randr_output_connection_status_get(Ecore_X_Window root, + Ecore_X_Randr_Output output) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN); + XRRScreenResources *res = NULL; + XRROutputInfo *output_info = NULL; + Ecore_X_Randr_Connection_Status ret = + ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN; + + if ((output != Ecore_X_Randr_None) + && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root)) + && (output_info = XRRGetOutputInfo(_ecore_x_disp, res, output))) + { + ret = output_info->connection; + } + + if (output_info) + XRRFreeOutputInfo(output_info); + + if (res) + XRRFreeScreenResources(res); + + return ret; +#else + return ECORE_X_RANDR_CONNECTION_STATUS_UNKNOWN; +#endif +} + +EAPI void +ecore_x_randr_output_size_mm_get(Ecore_X_Window root, + Ecore_X_Randr_Output output, + int *w_mm, + int *h_mm) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(); + XRRScreenResources *res = NULL; + XRROutputInfo *output_info = NULL; + + if ((output != Ecore_X_Randr_None) + && (res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) + { + if ((output_info = + XRRGetOutputInfo(_ecore_x_disp, res, (RROutput)output))) + { + if (w_mm) + *w_mm = output_info->mm_width; + + if (h_mm) + *h_mm = output_info->mm_height; + + XRRFreeOutputInfo(output_info); + } + + XRRFreeScreenResources(res); + } + +#endif +} + +EAPI Eina_Bool +ecore_x_randr_move_all_crtcs_but(Ecore_X_Window root, + const Ecore_X_Randr_Crtc *not_moved, + int nnot_moved, + int dx, + int dy) +{ +#ifdef ECORE_XRANDR + Ecore_X_Randr_Crtc *crtcs_to_be_moved = NULL; + XRRScreenResources *res = NULL; + int i, j, k, n; + Eina_Bool ret; + + if ((nnot_moved <= 0) || (!not_moved) + || !_ecore_x_randr_root_validate(root) + || !(res = + _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) + return EINA_FALSE; + + n = (res->ncrtc - nnot_moved); + if ((crtcs_to_be_moved = malloc(sizeof(Ecore_X_Randr_Crtc) * n))) + { + for (i = 0, k = 0; (i < res->ncrtc) && (k < n); i++) + { + for (j = 0; j < nnot_moved; j++) + { + if (res->crtcs[i] == not_moved[j]) + break; + } + if (j == nnot_moved) + //crtcs[i] is not in the 'not to move'-list + crtcs_to_be_moved[k++] = res->crtcs[i]; + } + } + + XRRFreeScreenResources(res); + ret = ecore_x_randr_move_crtcs(root, crtcs_to_be_moved, n, dx, dy); + free(crtcs_to_be_moved); + return ret; +#else + return EINA_FALSE; +#endif +} + +/* + * @brief move given CRTCs belonging to the given root window's screen dx/dy pixels relative to their current position. The screen size will be automatically adjusted if necessary and possible. + * @param root window which's screen's resources are used + * @param crtcs list of CRTCs to be moved + * @param ncrtc number of CRTCs in array + * @param dx amount of pixels the CRTCs should be moved in x direction + * @param dy amount of pixels the CRTCs should be moved in y direction + * @return EINA_TRUE if all crtcs could be moved successfully. + */ +EAPI Eina_Bool +ecore_x_randr_move_crtcs(Ecore_X_Window root, + const Ecore_X_Randr_Crtc *crtcs, + int ncrtc, + int dx, + int dy) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + XRRScreenResources *res = NULL; + XRRCrtcInfo **crtc_info = NULL; + Eina_Bool ret = EINA_TRUE; + int i, cw, ch, w_max, h_max, nw, nh; + + crtc_info = alloca(sizeof(XRRCrtcInfo *) * ncrtc); + memset(crtc_info, 0, sizeof(XRRCrtcInfo *) * ncrtc); + if (_ecore_x_randr_root_validate(root) + && (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) + { + ecore_x_randr_screen_size_range_get(root, NULL, NULL, &w_max, &h_max); + ecore_x_randr_screen_current_size_get(root, &cw, &ch, NULL, NULL); + nw = cw; + nh = ch; + + for (i = 0; + (i < ncrtc) && + (crtc_info[i] = XRRGetCrtcInfo(_ecore_x_disp, res, crtcs[i])); + i++) + { + if (((crtc_info[i]->x + dx) < 0) || + ((int)(crtc_info[i]->x + crtc_info[i]->width + dx) > w_max) + || ((crtc_info[i]->y + dy) < 0) || + ((int)(crtc_info[i]->y + crtc_info[i]->height + dy) > h_max) + ) + goto _ecore_x_randr_move_crtcs_fail_free_crtc_info; + + nw = MAX((int)(crtc_info[i]->x + crtc_info[i]->width + dx), nw); + nh = MAX((int)(crtc_info[i]->y + crtc_info[i]->height + dy), nh); + } + //not out of bounds + + //resize if necessary + if (!(((nw > cw) || + (nh > ch)) || + ecore_x_randr_screen_current_size_set(root, nw, nh, + Ecore_X_Randr_Unset, + Ecore_X_Randr_Unset))) + goto _ecore_x_randr_move_crtcs_fail_free_crtc_info; + + //actually move all the crtcs, keep their rotation and mode. + for (i = 0; (i < ncrtc) && crtc_info[i]; i++) + { + if ((crtc_info[i]) && + (!ecore_x_randr_crtc_settings_set(root, crtcs[i], NULL, + Ecore_X_Randr_Unset, + (crtc_info[i]->x + dx), + (crtc_info[i]->y + dy), + crtc_info[i]->mode, + crtc_info[i]->rotation))) + { + ret = EINA_FALSE; + break; + } + } + if (i < ncrtc) + { + //something went wrong, let's try to move the already moved crtcs + //back. + while ((i--) >= 0) + { + if (crtc_info[i]) + ecore_x_randr_crtc_settings_set(root, + crtcs[i], + NULL, + Ecore_X_Randr_Unset, + (crtc_info[i]->x - dx), + (crtc_info[i]->y - dy), + crtc_info[i]->mode, + crtc_info[i]->rotation); + } + } + + for (i = 0; i < ncrtc; i++) + { + if (crtc_info[i]) XRRFreeCrtcInfo(crtc_info[i]); + } + } + + XRRFreeScreenResources(res); + + return ret; +_ecore_x_randr_move_crtcs_fail_free_crtc_info: + while (i-- > 0) + XRRFreeCrtcInfo(crtc_info[i]); + XRRFreeScreenResources(res); + return EINA_FALSE; +#else + return EINA_FALSE; +#endif +} + +/** + * @brief removes unused screen space. The most upper left CRTC is set to 0x0 + * and all other CRTCs dx,dy respectively. + * @param root the window's screen which will be reset. + */ +EAPI void +ecore_x_randr_screen_reset(Ecore_X_Window root) +{ +#ifdef ECORE_XRANDR + XRRCrtcInfo *crtc_info = NULL; + XRRScreenResources *res = NULL; + //the 100000 are just a random huge number. + int i, dx_min = 100000, dy_min = 100000, w_n = 0, h_n = 0, nenabled_crtcs = 0; + + if (!_ecore_x_randr_root_validate(root) || + !(res = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root))) + return; + + Ecore_X_Randr_Crtc enabled_crtcs[res->ncrtc]; + + for (i = 0; i < res->ncrtc; i++) + { + if (!(crtc_info = + XRRGetCrtcInfo(_ecore_x_disp, res, + res->crtcs[i])) || + (crtc_info->mode == Ecore_X_Randr_None) || + (crtc_info->mode == Ecore_X_Randr_Unset) + || ((crtc_info->noutput == 0))) + continue; + + enabled_crtcs[nenabled_crtcs++] = res->crtcs[i]; + + if ((int)(crtc_info->x + crtc_info->width) > w_n) + w_n = (crtc_info->x + crtc_info->width); + + if ((int)(crtc_info->y + crtc_info->height) > h_n) + h_n = (crtc_info->y + crtc_info->height); + + if (crtc_info->x < dx_min) + dx_min = crtc_info->x; + if (crtc_info->y < dy_min) + dy_min = crtc_info->y; + + XRRFreeCrtcInfo(crtc_info); + } + if ((dx_min > 0) || (dy_min > 0)) + { + if (ecore_x_randr_move_crtcs(root, enabled_crtcs, nenabled_crtcs, -dx_min, -dy_min)) + { + w_n -= dx_min; + h_n -= dy_min; + } + } + ecore_x_randr_screen_current_size_set(root, + w_n, + h_n, + Ecore_X_Randr_Unset, + Ecore_X_Randr_Unset); +#endif +} + +/** + * @brief set up the backlight level to the given level. + * @param root the window's screen which will be set. + * @param level of the backlight between 0 and 1 + */ + +EAPI void +ecore_x_randr_screen_backlight_level_set(Ecore_X_Window root, + double level) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(); + Atom _backlight; + XRRScreenResources *resources = NULL; + Ecore_X_Randr_Output output; + int o; + + if ((level < 0) || (level > 1)) + { + ERR("Wrong value for the backlight level. It should be between 0 and 1."); + return; + } + + /* + * To make sure that the _backlight atomic property still exists. + */ + _backlight = XInternAtom(_ecore_x_disp, RANDR_PROPERTY_BACKLIGHT, True); + if (_backlight == None) + { + WRN("Backlight setting is not supported on this server or driver"); + return; + } + + /* get the ressources */ + resources = _ecore_x_randr_get_screen_resources(_ecore_x_disp, root); + if (!resources) return; + + for (o = 0; o < resources->noutput; o++) + { + output = resources->outputs[o]; + if (ecore_x_randr_output_backlight_level_get(root, output) >= 0) + { + ecore_x_randr_output_backlight_level_set(root, output, level); + } + } + XRRFreeScreenResources(resources); +#endif +} + +/* + * @brief get the backlight level of the given output + * @param root window which's screen should be queried + * @param output from which the backlight level should be retrieved + * @return the backlight level + */ + +EAPI double +ecore_x_randr_output_backlight_level_get(Ecore_X_Window root, + Ecore_X_Randr_Output output) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(-1); + Atom actual_type; + Atom _backlight; + XRRPropertyInfo *info = NULL; + double dvalue; + int actual_format; + long value, max, min; + unsigned long nitems; + unsigned long bytes_after; + unsigned char *prop = NULL; + + /* set backlight variable if not already done */ + + _backlight = XInternAtom(_ecore_x_disp, RANDR_PROPERTY_BACKLIGHT, True); + if (_backlight == None) + { + ERR("Backlight property is not suppported on this server or driver"); + return -1; + } + + if (!_ecore_x_randr_output_validate(root, output)) + { + ERR("Invalid output"); + return -1; + } + + if (XRRGetOutputProperty(_ecore_x_disp, output, _backlight, + 0, 4, False, False, None, + &actual_type, &actual_format, + &nitems, &bytes_after, &prop) != Success) + { + WRN("Backlight not supported on this output"); + return -1; + } + + if ((actual_type != XA_INTEGER) || (nitems != 1) || (actual_format != 32)) return -1; + + value = *((long *)prop); + free (prop); + + /* I have the current value of the backlight */ + /* Now retrieve the min and max intensities of the output */ + info = XRRQueryOutputProperty(_ecore_x_disp, output, _backlight); + if (info) + { + dvalue = -1; + if ((info->range) && (info->num_values == 2)) + { + /* finally convert the current value in the interval [0..1] */ + min = info->values[0]; + max = info->values[1]; + dvalue = ((double)(value - min)) / ((double)(max - min)); + } + free(info); + return dvalue; + } +#endif + return -1; +} + +/* + * @brief set the backlight level of a given output + * @param root window which's screen should be queried + * @param output that should be set + * @param level for which the backlight should be set + * @return EINA_TRUE in case of success + */ + +EAPI Eina_Bool +ecore_x_randr_output_backlight_level_set(Ecore_X_Window root, + Ecore_X_Randr_Output output, + double level) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_2_RET(EINA_FALSE); + Atom _backlight; + XRRPropertyInfo *info = NULL; + double min, max, tmp; + long new; + + if ((level < 0) || (level > 1)) + { + ERR("Backlight level should be between 0 and 1"); + return EINA_FALSE; + } + + if (!_ecore_x_randr_output_validate(root, output)) + { + ERR("Wrong output value"); + return EINA_FALSE; + } + + _backlight = XInternAtom(_ecore_x_disp, RANDR_PROPERTY_BACKLIGHT, True); + if (_backlight == None) + { + WRN("Backlight property is not suppported on this server or driver"); + return EINA_FALSE; + } + + info = XRRQueryOutputProperty(_ecore_x_disp, output, _backlight); + if (info) + { + if ((info->range) && (info->num_values == 2)) + { + min = info->values[0]; + max = info->values[1]; + tmp = (level * (max - min)) + min; + new = tmp; + if (new > max) new = max; + if (new < min) new = min; + XRRChangeOutputProperty(_ecore_x_disp, output, _backlight, XA_INTEGER, 32, + PropModeReplace, (unsigned char *)&new, 1); + XFlush(_ecore_x_disp); + } + free(info); + return EINA_TRUE; + } +#endif + return EINA_FALSE; +} + +/* + * @brief get the outputs, which display a certain window + * @param window window the displaying outputs shall be found for + * @param num the number of outputs displaying the window + * @return array of outputs that display a certain window. NULL if no outputs + * was found that displays the specified window. + */ + +EAPI Ecore_X_Randr_Output * +ecore_x_randr_window_outputs_get(Ecore_X_Window window, + int *num) +{ +#ifdef ECORE_XRANDR + Ecore_X_Window root; + Eina_Rectangle w_geo, c_geo; + Ecore_X_Randr_Crtc *crtcs; + Ecore_X_Randr_Mode mode; + Ecore_X_Randr_Output *outputs, *ret = NULL, *tret; + Window tw; + int ncrtcs, noutputs, i, nret = 0, rx = 0, ry = 0; + + if (_randr_version < RANDR_1_2) goto _ecore_x_randr_current_output_get_fail; + + ecore_x_window_geometry_get(window, + &w_geo.x, &w_geo.y, + &w_geo.w, &w_geo.h); + + root = ecore_x_window_root_get(window); + crtcs = ecore_x_randr_crtcs_get(root, &ncrtcs); + if (!crtcs) goto _ecore_x_randr_current_output_get_fail; + + /* now get window RELATIVE to root window - thats what matters. */ + XTranslateCoordinates(_ecore_x_disp, window, root, 0, 0, &rx, &ry, &tw); + w_geo.x = rx; + w_geo.y = ry; + + for (i = 0; i < ncrtcs; i++) + { + /* if crtc is not enabled, don't bother about it any further */ + mode = ecore_x_randr_crtc_mode_get(root, crtcs[i]); + if (mode == Ecore_X_Randr_None) continue; + + ecore_x_randr_crtc_geometry_get(root, crtcs[i], + &c_geo.x, &c_geo.y, + &c_geo.w, &c_geo.h); + if (eina_rectangles_intersect(&w_geo, &c_geo)) + { + outputs = ecore_x_randr_crtc_outputs_get(root, crtcs[i], + &noutputs); + /* The case below should be impossible, but for safety reasons + * remains */ + if (!outputs) + { + if (num) *num = 0; + free(ret); + free(crtcs); + return NULL; + } + tret = realloc(ret, ((nret + noutputs) * sizeof(Ecore_X_Randr_Output))); + if (!tret) + { + if (num) *num = 0; + free(outputs); + free(ret); + free(crtcs); + return NULL; + } + ret = tret; + memcpy(&ret[nret], outputs, (noutputs * sizeof(Ecore_X_Randr_Output))); + nret += noutputs; + free(outputs); + } + } + free(crtcs); + + if (num) *num = nret; + return ret; + +_ecore_x_randr_current_output_get_fail: +#endif + if (num) *num = 0; + return NULL; +} + +/* + * @depricated bad naming. Use ecore_x_randr_window_outputs_get instead. + * @brief get the outputs, which display a certain window + * @param window window the displaying outputs shall be found for + * @param num the number of outputs displaying the window + * @return array of outputs that display a certain window. NULL if no outputs + * was found that displays the specified window. + */ + +EINA_DEPRECATED EAPI Ecore_X_Randr_Output * +ecore_x_randr_current_output_get(Ecore_X_Window window, + int *num) +{ + return ecore_x_randr_window_outputs_get(window, num); +} + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c new file mode 100644 index 0000000..d434f2f --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12_edid.c @@ -0,0 +1,457 @@ +/* + * Copyright 2006-2009 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * the Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +/* Original Author: Adam Jackson */ +/* Heavily modified by: Leif Middelschulte */ + +#include "Ecore_X.h" + +/* TODO: + * - see other TODO's within this file. + */ + +#define ECORE_X_RANDR_EDID_VERSION_10 ((1 << 8) | 0) +#define ECORE_X_RANDR_EDID_VERSION_11 ((1 << 8) | 1) +#define ECORE_X_RANDR_EDID_VERSION_12 ((1 << 8) | 2) +#define ECORE_X_RANDR_EDID_VERSION_13 ((1 << 8) | 3) +#define ECORE_X_RANDR_EDID_VERSION_14 ((1 << 8) | 4) + +#define _ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER 0x08 +#define _ECORE_X_RANDR_EDID_OFFSET_TYPE 0x14 +#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR 0x12 +#define _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR 0x13 +#define _ECORE_X_RANDR_EDID_OFFSET_DPMS 0x18 +#define _ECORE_X_RANDR_EDID_OFFSET_COLORSPACE 0x18 +#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK 0x36 +#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE 3 +#define _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT 5 +#define _ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO_PREFERRED 15 +#define _ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO 14 + +#define _ECORE_X_RANDR_EDID_MASK_DIGITAL 0x80 +#define _ECORE_X_RANDR_EDID_MASK_DIGITAL_INTERFACE 0x0f +#define _ECORE_X_RANDR_EDID_MASK_DIGITAL_TMDS_DFP_10 0x01 +#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_ANALOGOUS 0x18 +#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_444 0x10 +#define _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_422 0x08 +#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_PREFERRED 0xe0 +#define _ECORE_X_RANDR_EDID_MASK_DPMS 0xE0 +#define _ECORE_X_RANDR_EDID_MASK_DPMS_STANDBY 0x80 +#define _ECORE_X_RANDR_EDID_MASK_DPMS_SUSPEND 0x40 +#define _ECORE_X_RANDR_EDID_MASK_DPMS_OFF 0x20 +#define _ECORE_X_RANDR_EDID_MASK_INTERFACE_TYPE 0x0f +#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_4_3 0x80 +#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_9 0x40 +#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_10 0x20 +#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_5_4 0x10 +#define _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_15_9 0x08 + +#define _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX 13 + +typedef enum _Ecore_X_Randr_Edid_Aspect_Ratio_Preferred { + ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_4_3 = 0x00, + ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_9 = 0x01, + ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_10 = 0x02, + ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_5_4 = 0x03, + ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_15_9 = 0x04 +} Ecore_X_Randr_Edid_Aspect_Ratio_Preferred; + +/* Some convenience loops */ +#define _ECORE_X_RANDR_EDID_FOR_EACH_EXTENSION_BLOCK(edid, edid_length, extension_block_iter) \ + for (extension_block_iter = edid; extension_block_iter < (edid + edid_length); extension_block_iter += 128) + +#define _ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter) \ + _ECORE_X_RANDR_EDID_FOR_EACH_EXTENSION_BLOCK(edid, edid_length, cea_block_iter) \ + if (cea_block_iter[0] == 0x02) + +/* The following macro is to be used with caution as it inherits another loop. + * Therefore using a 'break;' statement will lead to continuation in the + * inherent 'Extension block'-loop. + */ +#define _ECORE_X_RANDR_EDID_FOR_EACH_CEA_DETAILED_BLOCK(edid, edid_length, cea_block_iter, detailed_block_iter) \ + _ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter) \ + for (detailed_block_iter = cea_block_iter + cea_block_iter[2]; detailed_block_iter + 18 < cea_block_iter + 127; detailed_block_iter += 18) \ + if (detailed_block_iter[0]) + +#define _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \ + for (block = edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK; block <= (edid + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK + (3 * 18)); block += 18) + +#define _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) \ + _ECORE_X_RANDR_EDID_FOR_EACH_DESCRIPTOR_BLOCK(edid, block) \ + if ((block[0] == 0) && (block[1] == 0)) + +EAPI Eina_Bool +ecore_x_randr_edid_has_valid_header(unsigned char *edid, + unsigned long edid_length) +{ + const unsigned char header[] = + { 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 }; + if (!edid) return EINA_FALSE; + if (edid_length < 8) return EINA_FALSE; + if (!memcmp(edid, header, 8)) return EINA_TRUE; + return EINA_FALSE; +} + +EAPI int +ecore_x_randr_edid_version_get(unsigned char *edid, + unsigned long edid_length) +{ + if ((edid_length > _ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR) && + (ecore_x_randr_edid_has_valid_header(edid, edid_length))) + return (edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MAJOR] << 8) | + edid[_ECORE_X_RANDR_EDID_OFFSET_VERSION_MINOR]; + return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; +} + +EAPI int +ecore_x_randr_edid_manufacturer_model_get(unsigned char *edid, + unsigned long edid_length) +{ + if ((edid_length > 0x0b) && + (ecore_x_randr_edid_has_valid_header(edid, edid_length))) + return (int)(edid[0x0a] + (edid[0x0b] << 8)); + return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; +} + +EAPI int +ecore_x_randr_edid_manufacturer_serial_number_get(unsigned char *edid, + unsigned long edid_length) +{ + if ((edid_length > 0x0f) && + (ecore_x_randr_edid_has_valid_header(edid, edid_length))) + return (int)(edid[0x0c] + (edid[0x0d] << 8) + + (edid[0x0e] << 16) + (edid[0x0f] << 24)); + return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; +} + +EAPI char * +ecore_x_randr_edid_manufacturer_name_get(unsigned char *edid, + unsigned long edid_length) +{ + if ((edid_length > (_ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER + 1)) && + (ecore_x_randr_edid_has_valid_header(edid, edid_length))) + { + unsigned char *x; + char *name; + + x = (edid + _ECORE_X_RANDR_EDID_OFFSET_MANUFACTURER); + name = malloc(sizeof(char) * 4); + if (!name) return NULL; + name[0] = ((x[0] & 0x7c) >> 2) + '@'; + name[1] = ((x[0] & 0x03) << 3) + ((x[1] & 0xe0) >> 5) + '@'; + name[2] = (x[1] & 0x1f) + '@'; + name[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] = 0; + return name; + } + return NULL; +} + +EAPI char * +ecore_x_randr_edid_display_name_get(unsigned char *edid, + unsigned long edid_length) +{ + unsigned char *block = NULL; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL; + _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) + { + if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfc) + { + char *name, *p; + const char *edid_name; + + edid_name = (const char *)block + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT; + name = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); + if (!name) return NULL; + strncpy(name, edid_name, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1)); + name[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; + for (p = name; *p; p++) + { + if ((*p < ' ') || (*p > '~')) *p = 0; + } + return name; + } + } + return NULL; +} + +EAPI Ecore_X_Randr_Edid_Aspect_Ratio +ecore_x_randr_edid_display_aspect_ratio_preferred_get(unsigned char *edid, + unsigned long edid_length) +{ + unsigned char *block = NULL; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; + _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) + { + if ((block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfd) && + (block[10] == 0x04)) + { + Ecore_X_Randr_Edid_Aspect_Ratio_Preferred preferred_ratio = + (Ecore_X_Randr_Edid_Aspect_Ratio_Preferred) + ((block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO_PREFERRED] & + _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_PREFERRED) >> 5); + switch (preferred_ratio) + { + case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_4_3: + return ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3; + + case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_9: + return ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9; + + case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_16_10: + return ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10; + + case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_5_4: + return ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4; + + case ECORE_X_RANDR_EDID_ASPECT_RATIO_PREFERRED_15_9: + return ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9; + + default: + return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; + } + } + } + return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; +} + +EAPI Ecore_X_Randr_Edid_Aspect_Ratio +ecore_x_randr_edid_display_aspect_ratios_get(unsigned char *edid, + unsigned long edid_length) +{ + Ecore_X_Randr_Edid_Aspect_Ratio ret = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; + unsigned char *block = NULL; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return ECORE_X_RANDR_EDID_UNKNOWN_VALUE; + _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) + { + if ((block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfd) && + (block[10] == 0x04)) + { + if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_4_3) + ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_4_3; + if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_9) + ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_16_9; + if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_16_10) + ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_16_10; + if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_5_4) + ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_5_4; + if (block[_ECORE_X_RANDR_EDID_OFFSET_ASPECT_RATIO] & _ECORE_X_RANDR_EDID_MASK_ASPECT_RATIO_15_9) + ret |= ECORE_X_RANDR_EDID_ASPECT_RATIO_15_9; + } + } + return ret; +} + +EAPI char * +ecore_x_randr_edid_display_ascii_get(unsigned char *edid, + unsigned long edid_length) +{ + unsigned char *block = NULL; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL; + _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) + { + if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xfe) + { + char *ascii, *p; + const char *edid_ascii = (const char *)block + + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT; + /* + * TODO: Two of these in a row, in the third and fourth slots, + * seems to be specified by SPWG: http://www.spwg.org/ + */ + ascii = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); + if (!ascii) return NULL; + strncpy(ascii, edid_ascii, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1)); + ascii[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; + for (p = ascii; *p; p++) + { + if ((*p < ' ') || (*p > '~')) *p = 0; + } + return ascii; + } + } + return NULL; +} + +EAPI char * +ecore_x_randr_edid_display_serial_get(unsigned char *edid, + unsigned long edid_length) +{ + unsigned char *block = NULL; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return NULL; + _ECORE_X_RANDR_EDID_FOR_EACH_NON_PIXEL_DESCRIPTOR_BLOCK(edid, block) + { + if (block[_ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_TYPE] == 0xff) + { + char *serial, *p; + const char *edid_serial = (const char *)block + + _ECORE_X_RANDR_EDID_OFFSET_DESCRIPTOR_BLOCK_CONTENT; + /* + * TODO: Two of these in a row, in the third and fourth slots, + * seems to be specified by SPWG: http://www.spwg.org/ + */ + serial = malloc(sizeof(char) * _ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX); + if (!serial) return NULL; + strncpy(serial, edid_serial, (_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX - 1)); + serial[_ECORE_X_RANDR_EDID_DISPLAY_DESCRIPTOR_BLOCK_CONTENT_LENGTH_MAX] = 0; + for (p = serial; *p; p++) + { + if ((*p < ' ') || (*p > '~')) *p = 0; + } + return serial; + } + } + return NULL; +} + +EAPI Eina_Bool +ecore_x_randr_edid_info_has_valid_checksum(unsigned char *edid, + unsigned long edid_length) +{ + unsigned char *cea_block_iter = NULL; + char sum = 0; + int i; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; + if (edid_length < 128) return EINA_FALSE; + + /* Check the EDID block itself */ + for (i = 0; i < 128; i++) sum += edid[i]; + if (sum) return EINA_FALSE; + + /* Check the cea extension blocks */ + _ECORE_X_RANDR_EDID_FOR_EACH_CEA_BLOCK(edid, edid_length, cea_block_iter) + { + for (i = 0, sum = 0; i < 128; i++) sum += cea_block_iter[i]; + } + if (sum) return EINA_FALSE; + return EINA_TRUE; +} + +EAPI Eina_Bool +ecore_x_randr_edid_dpms_available_get(unsigned char *edid, + unsigned long edid_length) +{ + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; + return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & + _ECORE_X_RANDR_EDID_MASK_DPMS); +} + +EAPI Eina_Bool +ecore_x_randr_edid_dpms_standby_available_get(unsigned char *edid, + unsigned long edid_length) +{ + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; + if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS) + return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & + _ECORE_X_RANDR_EDID_MASK_DPMS_STANDBY); + return EINA_FALSE; +} + +EAPI Eina_Bool +ecore_x_randr_edid_dpms_suspend_available_get(unsigned char *edid, + unsigned long edid_length) +{ + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; + if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS) + return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & + _ECORE_X_RANDR_EDID_MASK_DPMS_SUSPEND); + return EINA_FALSE; +} + +EAPI Eina_Bool +ecore_x_randr_edid_dpms_off_available_get(unsigned char *edid, + unsigned long edid_length) +{ + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; + if (edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & _ECORE_X_RANDR_EDID_MASK_DPMS) + return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_DPMS] & + _ECORE_X_RANDR_EDID_MASK_DPMS_OFF); + return EINA_FALSE; +} + +EAPI Eina_Bool +ecore_x_randr_edid_display_type_digital_get(unsigned char *edid, + unsigned long edid_length) +{ + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return EINA_FALSE; + return !!(edid[_ECORE_X_RANDR_EDID_OFFSET_TYPE] & + _ECORE_X_RANDR_EDID_MASK_DIGITAL); +} + +EAPI Ecore_X_Randr_Edid_Display_Colorscheme +ecore_x_randr_edid_display_colorscheme_get(unsigned char *edid, + unsigned long edid_length) +{ + Ecore_X_Randr_Edid_Display_Colorscheme colorscheme = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return colorscheme; + if (ecore_x_randr_edid_display_type_digital_get(edid, edid_length)) + { + colorscheme = ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_4_4_4; + if (edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] & + _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_444) + colorscheme |= ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_4_4; + if (edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] & + _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_DIGITAL_YCRCB_422) + colorscheme |= ECORE_X_RANDR_EDID_DISPLAY_COLORSCHEME_COLOR_RGB_YCRCB_4_2_2; + } + else + colorscheme = edid[_ECORE_X_RANDR_EDID_OFFSET_COLORSPACE] & _ECORE_X_RANDR_EDID_MASK_COLORSCHEME_ANALOGOUS; + return colorscheme; +} + +EAPI Ecore_X_Randr_Edid_Display_Interface_Type +ecore_x_randr_edid_display_interface_type_get(unsigned char *edid, + unsigned long edid_length) +{ + Ecore_X_Randr_Edid_Display_Interface_Type type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; + int version = ecore_x_randr_edid_version_get(edid, edid_length); + + if (version < ECORE_X_RANDR_EDID_VERSION_13) return type; + type = edid[_ECORE_X_RANDR_EDID_OFFSET_TYPE] & + _ECORE_X_RANDR_EDID_MASK_INTERFACE_TYPE; + if (type > ECORE_X_RANDR_EDID_DISPLAY_INTERFACE_DISPLAY_PORT) + type = ECORE_X_RANDR_EDID_UNKNOWN_VALUE; + return type; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c new file mode 100644 index 0000000..ab242f7 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_randr_13.c @@ -0,0 +1,63 @@ +/* + * vim:ts=8:sw=3:sts=8:expandtab:cino=>5n-3f0^-2{2 + */ + +#ifdef HAVE_CONFIG_H +# include +#endif + +#include "ecore_x_private.h" +#include "ecore_x_randr.h" + +#define Ecore_X_Randr_None 0 +#define Ecore_X_Randr_Unset -1 + +#ifdef ECORE_XRANDR + +#define RANDR_1_3 ((1 << 16) | 3) +#define RANDR_CHECK_1_3_RET(ret) if(_randr_version < RANDR_1_3) return ret + +extern XRRScreenResources *(*_ecore_x_randr_get_screen_resources)(Display * + dpy, + Window + window); +extern int _randr_version; +#endif + +/* + * @param root window which's screen should be queried + * @return Ecore_X_Randr_Ouptut_Id or - if query failed or none is set - Ecore_X_Randr_None + */ +EAPI Ecore_X_Randr_Output +ecore_x_randr_primary_output_get(Ecore_X_Window root) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_3_RET(Ecore_X_Randr_None); + if (!_ecore_x_randr_root_validate(root)) + return Ecore_X_Randr_None; + + return XRRGetOutputPrimary(_ecore_x_disp, root); +#else + return Ecore_X_Randr_None; +#endif +} + +/* + * @param root window which's screen should be queried + * @param output that should be set as given root window's screen primary output + */ +EAPI void +ecore_x_randr_primary_output_set(Ecore_X_Window root, + Ecore_X_Randr_Output output) +{ +#ifdef ECORE_XRANDR + RANDR_CHECK_1_3_RET(); + + if (_ecore_x_randr_output_validate(root, output)) + { + XRRSetOutputPrimary(_ecore_x_disp, root, output); + } + +#endif +} + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_region.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_region.c new file mode 100644 index 0000000..7cc66e3 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_region.c @@ -0,0 +1,158 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "ecore_x_private.h" + +/* + * [x] XCreateRegion + * [ ] XPolygonRegion + * [x] XSetRegion + * [x] XDestroyRegion + * + * [x] XOffsetRegion + * [ ] XShrinkRegion + * + * [ ] XClipBox + * [x] XIntersectRegion + * [x] XUnionRegion + * [x] XUnionRectWithRegion + * [x] XSubtractRegion + * [ ] XXorRegion + * + * [x] XEmptyRegion + * [x] XEqualRegion + * + * [x] XPointInRegion + * [x] XRectInRegion + */ + +EAPI Ecore_X_XRegion * +ecore_x_xregion_new() +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return (Ecore_X_XRegion *)XCreateRegion(); +} /* ecore_x_xregion_new */ + +EAPI void +ecore_x_xregion_free(Ecore_X_XRegion *region) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!region) + return; + + XDestroyRegion((Region)region); +} /* ecore_x_xregion_free */ + +EAPI Eina_Bool +ecore_x_xregion_set(Ecore_X_XRegion *region, + Ecore_X_GC gc) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XSetRegion(_ecore_x_disp, gc, (Region)region) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_xregion_set */ + +EAPI void +ecore_x_xregion_translate(Ecore_X_XRegion *region, + int x, + int y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!region) + return; + + /* return value not used */ + XOffsetRegion((Region)region, x, y); +} /* ecore_x_xregion_translate */ + +EAPI Eina_Bool +ecore_x_xregion_intersect(Ecore_X_XRegion *dst, + Ecore_X_XRegion *r1, + Ecore_X_XRegion *r2) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XIntersectRegion((Region)r1, (Region)r2, (Region)dst) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_xregion_intersect */ + +EAPI Eina_Bool +ecore_x_xregion_union(Ecore_X_XRegion *dst, + Ecore_X_XRegion *r1, + Ecore_X_XRegion *r2) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XUnionRegion((Region)r1, (Region)r2, (Region)dst) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_xregion_union */ + +EAPI Eina_Bool +ecore_x_xregion_union_rect(Ecore_X_XRegion *dst, + Ecore_X_XRegion *src, + Ecore_X_Rectangle *rect) +{ + XRectangle xr; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xr.x = rect->x; + xr.y = rect->y; + xr.width = rect->width; + xr.height = rect->height; + + return XUnionRectWithRegion(&xr, (Region)src, (Region)dst) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_xregion_union_rect */ + +EAPI Eina_Bool +ecore_x_xregion_subtract(Ecore_X_XRegion *dst, + Ecore_X_XRegion *rm, + Ecore_X_XRegion *rs) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XSubtractRegion((Region)rm, (Region)rs, (Region)dst) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_xregion_subtract */ + +EAPI Eina_Bool +ecore_x_xregion_is_empty(Ecore_X_XRegion *region) +{ + if (!region) + return EINA_TRUE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XEmptyRegion((Region)region) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_xregion_is_empty */ + +EAPI Eina_Bool +ecore_x_xregion_is_equal(Ecore_X_XRegion *r1, + Ecore_X_XRegion *r2) +{ + if (!r1 || !r2) + return EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XEqualRegion((Region)r1, (Region)r1) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_xregion_is_equal */ + +EAPI Eina_Bool +ecore_x_xregion_point_contain(Ecore_X_XRegion *region, + int x, + int y) +{ + if (!region) + return EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XPointInRegion((Region)region, x, y) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_xregion_point_contain */ + +EAPI Eina_Bool +ecore_x_xregion_rect_contain(Ecore_X_XRegion *region, + Ecore_X_Rectangle *rect) +{ + if (!region || !rect) + return EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XRectInRegion((Region)region, + rect->x, + rect->y, + rect->width, + rect->height) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_xregion_rect_contain */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_screensaver.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_screensaver.c new file mode 100644 index 0000000..a3bca67 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_screensaver.c @@ -0,0 +1,173 @@ +/* + * Screensaver code + */ + +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include "Ecore_X_Atoms.h" + +static int _screensaver_available = -1; + +EAPI Eina_Bool +ecore_x_screensaver_event_available_get(void) +{ + if (_screensaver_available >= 0) + return _screensaver_available; + +#ifdef ECORE_XSS + int _screensaver_major, _screensaver_minor; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _screensaver_major = 1; + _screensaver_minor = 0; + + if (XScreenSaverQueryVersion(_ecore_x_disp, &_screensaver_major, + &_screensaver_minor)) + _screensaver_available = 1; + else + _screensaver_available = 0; + +#else /* ifdef ECORE_XSS */ + _screensaver_available = 0; +#endif /* ifdef ECORE_XSS */ + return _screensaver_available; +} /* ecore_x_screensaver_event_available_get */ + +EAPI int +ecore_x_screensaver_idle_time_get(void) +{ +#ifdef ECORE_XSS + XScreenSaverInfo *xss; + int idle; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xss = XScreenSaverAllocInfo(); + XScreenSaverQueryInfo(_ecore_x_disp, + RootWindow(_ecore_x_disp, DefaultScreen( + _ecore_x_disp)), xss); + idle = xss->idle / 1000; + XFree(xss); + + return idle; +#else + return 0; +#endif /* ifdef ECORE_XSS */ +} /* ecore_x_screensaver_idle_time_get */ + +EAPI void +ecore_x_screensaver_set(int timeout, + int interval, + int prefer_blanking, + int allow_exposures) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSetScreenSaver(_ecore_x_disp, + timeout, + interval, + prefer_blanking, + allow_exposures); +} /* ecore_x_screensaver_set */ + +EAPI void +ecore_x_screensaver_timeout_set(int timeout) +{ + int pto, pint, pblank, pexpo; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); + XSetScreenSaver(_ecore_x_disp, timeout, pint, pblank, pexpo); +} /* ecore_x_screensaver_timeout_set */ + +EAPI int +ecore_x_screensaver_timeout_get(void) +{ + int pto, pint, pblank, pexpo; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); + return pto; +} /* ecore_x_screensaver_timeout_get */ + +EAPI void +ecore_x_screensaver_blank_set(int blank) +{ + int pto, pint, pblank, pexpo; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); + XSetScreenSaver(_ecore_x_disp, pto, pint, blank, pexpo); +} /* ecore_x_screensaver_blank_set */ + +EAPI int +ecore_x_screensaver_blank_get(void) +{ + int pto, pint, pblank, pexpo; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); + return pblank; +} /* ecore_x_screensaver_blank_get */ + +EAPI void +ecore_x_screensaver_expose_set(int expose) +{ + int pto, pint, pblank, pexpo; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); + XSetScreenSaver(_ecore_x_disp, pto, pint, pblank, expose); +} /* ecore_x_screensaver_expose_set */ + +EAPI int +ecore_x_screensaver_expose_get(void) +{ + int pto, pint, pblank, pexpo; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); + return pexpo; +} /* ecore_x_screensaver_expose_get */ + +EAPI void +ecore_x_screensaver_interval_set(int interval) +{ + int pto, pint, pblank, pexpo; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); + XSetScreenSaver(_ecore_x_disp, pto, interval, pblank, pexpo); +} /* ecore_x_screensaver_interval_set */ + +EAPI int +ecore_x_screensaver_interval_get(void) +{ + int pto, pint, pblank, pexpo; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XGetScreenSaver(_ecore_x_disp, &pto, &pint, &pblank, &pexpo); + return pint; +} /* ecore_x_screensaver_interval_get */ + +EAPI void +ecore_x_screensaver_event_listen_set(Eina_Bool on) +{ +#ifdef ECORE_XSS + Ecore_X_Window root; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + root = DefaultRootWindow(_ecore_x_disp); + if (on) + XScreenSaverSelectInput(_ecore_x_disp, root, ScreenSaverNotifyMask); + else + XScreenSaverSelectInput(_ecore_x_disp, root, 0); +#else + return; + on = EINA_FALSE; +#endif /* ifdef ECORE_XSS */ +} /* ecore_x_screensaver_event_listen_set */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c new file mode 100644 index 0000000..b1aa611 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_selection.c @@ -0,0 +1,1001 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include +#include + +#include "Ecore.h" +#include "ecore_private.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include "Ecore_X_Atoms.h" + +static Ecore_X_Selection_Intern selections[4]; +static Ecore_X_Selection_Converter *converters = NULL; +static Ecore_X_Selection_Parser *parsers = NULL; + +static Eina_Bool _ecore_x_selection_converter_text(char *target, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *tprop, + int *); +static int _ecore_x_selection_data_default_free(void *data); +static void *_ecore_x_selection_parser_files(const char *target, + void *data, + int size, + int format); +static int _ecore_x_selection_data_files_free(void *data); +static void *_ecore_x_selection_parser_text(const char *target, + void *data, + int size, + int format); +static int _ecore_x_selection_data_text_free(void *data); +static void *_ecore_x_selection_parser_targets(const char *target, + void *data, + int size, + int format); +static int _ecore_x_selection_data_targets_free(void *data); + +#define ECORE_X_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x)) + +void +_ecore_x_selection_data_init(void) +{ + /* Initialize global data */ + memset(selections, 0, sizeof(selections)); + + /* Initialize converters */ + ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT, + _ecore_x_selection_converter_text); +#ifdef X_HAVE_UTF8_STRING + ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING, + _ecore_x_selection_converter_text); +#endif /* ifdef X_HAVE_UTF8_STRING */ + ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT, + _ecore_x_selection_converter_text); + ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING, + _ecore_x_selection_converter_text); + + /* Initialize parsers */ + ecore_x_selection_parser_add("text/plain", + _ecore_x_selection_parser_text); + ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING, + _ecore_x_selection_parser_text); + ecore_x_selection_parser_add("text/uri-list", + _ecore_x_selection_parser_files); + ecore_x_selection_parser_add("_NETSCAPE_URL", + _ecore_x_selection_parser_files); + ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS, + _ecore_x_selection_parser_targets); +} /* _ecore_x_selection_data_init */ + +void +_ecore_x_selection_shutdown(void) +{ + Ecore_X_Selection_Converter *cnv; + Ecore_X_Selection_Parser *prs; + + /* free the selection converters */ + cnv = converters; + while (cnv) + { + Ecore_X_Selection_Converter *tmp; + + tmp = cnv->next; + free(cnv); + cnv = tmp; + } + converters = NULL; + + /* free the selection parsers */ + prs = parsers; + while (prs) + { + Ecore_X_Selection_Parser *tmp; + + tmp = prs; + prs = prs->next; + free(tmp->target); + free(tmp); + } + parsers = NULL; +} /* _ecore_x_selection_shutdown */ + +Ecore_X_Selection_Intern * +_ecore_x_selection_get(Ecore_X_Atom selection) +{ + if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) + return &selections[0]; + else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) + return &selections[1]; + else if (selection == ECORE_X_ATOM_SELECTION_XDND) + return &selections[2]; + else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) + return &selections[3]; + else + return NULL; +} /* _ecore_x_selection_get */ + +Eina_Bool +_ecore_x_selection_set(Window w, + const void *data, + int size, + Ecore_X_Atom selection) +{ + int in; + unsigned char *buf = NULL; + + XSetSelectionOwner(_ecore_x_disp, selection, w, _ecore_x_event_last_time); + if (XGetSelectionOwner(_ecore_x_disp, selection) != w) + return EINA_FALSE; + + if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) + in = 0; + else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) + in = 1; + else if (selection == ECORE_X_ATOM_SELECTION_XDND) + in = 2; + else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) + in = 3; + else + return EINA_FALSE; + + if (data) + { + selections[in].win = w; + selections[in].selection = selection; + selections[in].length = size; + selections[in].time = _ecore_x_event_last_time; + + buf = malloc(size); + if (!buf) return EINA_FALSE; + memcpy(buf, data, size); + selections[in].data = buf; + } + else if (selections[in].data) + { + free(selections[in].data); + memset(&selections[in], 0, sizeof(Ecore_X_Selection_Data)); + } + + return EINA_TRUE; +} /* _ecore_x_selection_set */ + +/** + * Claim ownership of the PRIMARY selection and set its data. + * @param w The window to which this selection belongs + * @param data The data associated with the selection + * @param size The size of the data buffer in bytes + * @return Returns 1 if the ownership of the selection was successfully + * claimed, or 0 if unsuccessful. + */ +EAPI Eina_Bool +ecore_x_selection_primary_set(Ecore_X_Window w, + const void *data, + int size) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_PRIMARY); +} /* ecore_x_selection_primary_set */ + +/** + * Release ownership of the primary selection + * @return Returns 1 if the selection was successfully cleared, + * or 0 if unsuccessful. + * + */ +EAPI Eina_Bool +ecore_x_selection_primary_clear(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_PRIMARY); +} /* ecore_x_selection_primary_clear */ + +/** + * Claim ownership of the SECONDARY selection and set its data. + * @param w The window to which this selection belongs + * @param data The data associated with the selection + * @param size The size of the data buffer in bytes + * @return Returns 1 if the ownership of the selection was successfully + * claimed, or 0 if unsuccessful. + */ +EAPI Eina_Bool +ecore_x_selection_secondary_set(Ecore_X_Window w, + const void *data, + int size) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return _ecore_x_selection_set(w, + data, + size, + ECORE_X_ATOM_SELECTION_SECONDARY); +} /* ecore_x_selection_secondary_set */ + +/** + * Release ownership of the secondary selection + * @return Returns 1 if the selection was successfully cleared, + * or 0 if unsuccessful. + * + */ +EAPI Eina_Bool +ecore_x_selection_secondary_clear(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return _ecore_x_selection_set(None, + NULL, + 0, + ECORE_X_ATOM_SELECTION_SECONDARY); +} /* ecore_x_selection_secondary_clear */ + +/** + * Claim ownership of the XDND selection and set its data. + * @param w The window to which this selection belongs + * @param data The data associated with the selection + * @param size The size of the data buffer in bytes + * @return Returns 1 if the ownership of the selection was successfully + * claimed, or 0 if unsuccessful. + */ +EAPI Eina_Bool +ecore_x_selection_xdnd_set(Ecore_X_Window w, + const void *data, + int size) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return _ecore_x_selection_set(w, data, size, ECORE_X_ATOM_SELECTION_XDND); +} /* ecore_x_selection_xdnd_set */ + +/** + * Release ownership of the XDND selection + * @return Returns 1 if the selection was successfully cleared, + * or 0 if unsuccessful. + * + */ +EAPI Eina_Bool +ecore_x_selection_xdnd_clear(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return _ecore_x_selection_set(None, NULL, 0, ECORE_X_ATOM_SELECTION_XDND); +} /* ecore_x_selection_xdnd_clear */ + +/** + * Claim ownership of the CLIPBOARD selection and set its data. + * @param w The window to which this selection belongs + * @param data The data associated with the selection + * @param size The size of the data buffer in bytes + * @return Returns 1 if the ownership of the selection was successfully + * claimed, or 0 if unsuccessful. + * + * Get the converted data from a previous CLIPBOARD selection + * request. The buffer must be freed when done with. + */ +EAPI Eina_Bool +ecore_x_selection_clipboard_set(Ecore_X_Window w, + const void *data, + int size) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return _ecore_x_selection_set(w, + data, + size, + ECORE_X_ATOM_SELECTION_CLIPBOARD); +} /* ecore_x_selection_clipboard_set */ + +/** + * Release ownership of the clipboard selection + * @return Returns 1 if the selection was successfully cleared, + * or 0 if unsuccessful. + * + */ +EAPI Eina_Bool +ecore_x_selection_clipboard_clear(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return _ecore_x_selection_set(None, + NULL, + 0, + ECORE_X_ATOM_SELECTION_CLIPBOARD); +} /* ecore_x_selection_clipboard_clear */ + +Ecore_X_Atom +_ecore_x_selection_target_atom_get(const char *target) +{ + Ecore_X_Atom x_target; + + if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT)) + x_target = ECORE_X_ATOM_TEXT; + else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT)) + x_target = ECORE_X_ATOM_COMPOUND_TEXT; + else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING)) + x_target = ECORE_X_ATOM_STRING; + else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING)) + x_target = ECORE_X_ATOM_UTF8_STRING; + else if (!strcmp(target, ECORE_X_SELECTION_TARGET_FILENAME)) + x_target = ECORE_X_ATOM_FILE_NAME; + else + x_target = ecore_x_atom_get(target); + + return x_target; +} /* _ecore_x_selection_target_atom_get */ + +char * +_ecore_x_selection_target_get(Ecore_X_Atom target) +{ + /* FIXME: Should not return mem allocated with strdup or X mixed, + * one should use free to free, the other XFree */ + if (target == ECORE_X_ATOM_FILE_NAME) + return strdup(ECORE_X_SELECTION_TARGET_FILENAME); + else if (target == ECORE_X_ATOM_STRING) + return strdup(ECORE_X_SELECTION_TARGET_STRING); + else if (target == ECORE_X_ATOM_UTF8_STRING) + return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING); + else if (target == ECORE_X_ATOM_TEXT) + return strdup(ECORE_X_SELECTION_TARGET_TEXT); + else + return XGetAtomName(_ecore_x_disp, target); +} /* _ecore_x_selection_target_get */ + +static void +_ecore_x_selection_request(Ecore_X_Window w, + Ecore_X_Atom selection, + const char *target_str) +{ + Ecore_X_Atom target, prop; + + target = _ecore_x_selection_target_atom_get(target_str); + + if (selection == ECORE_X_ATOM_SELECTION_PRIMARY) + prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY; + else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY) + prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY; + else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD) + prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD; + else + return; + + XConvertSelection(_ecore_x_disp, selection, target, prop, + w, CurrentTime); +} /* _ecore_x_selection_request */ + +EAPI void +ecore_x_selection_primary_request(Ecore_X_Window w, + const char *target) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_PRIMARY, target); +} /* ecore_x_selection_primary_request */ + +EAPI void +ecore_x_selection_secondary_request(Ecore_X_Window w, + const char *target) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_SECONDARY, target); +} /* ecore_x_selection_secondary_request */ + +EAPI void +ecore_x_selection_xdnd_request(Ecore_X_Window w, + const char *target) +{ + Ecore_X_Atom atom; + Ecore_X_DND_Target *_target; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _target = _ecore_x_dnd_target_get(); + atom = _ecore_x_selection_target_atom_get(target); + XConvertSelection(_ecore_x_disp, ECORE_X_ATOM_SELECTION_XDND, atom, + ECORE_X_ATOM_SELECTION_PROP_XDND, w, + _target->time); +} /* ecore_x_selection_xdnd_request */ + +EAPI void +ecore_x_selection_clipboard_request(Ecore_X_Window w, + const char *target) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_selection_request(w, ECORE_X_ATOM_SELECTION_CLIPBOARD, target); +} /* ecore_x_selection_clipboard_request */ + +EAPI void +ecore_x_selection_converter_atom_add(Ecore_X_Atom target, + Eina_Bool (*func)(char *target, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *ttype, + int *tsize)) +{ + Ecore_X_Selection_Converter *cnv; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + cnv = converters; + if (converters) + { + while (1) + { + if (cnv->target == target) + { + cnv->convert = func; + return; + } + + if (cnv->next) + cnv = cnv->next; + else + break; + } + + cnv->next = calloc(1, sizeof(Ecore_X_Selection_Converter)); + if (!cnv->next) return; + cnv = cnv->next; + } + else + { + converters = calloc(1, sizeof(Ecore_X_Selection_Converter)); + if (!converters) return; + cnv = converters; + } + + cnv->target = target; + cnv->convert = func; +} /* ecore_x_selection_converter_atom_add */ + +EAPI void +ecore_x_selection_converter_add(char *target, + Eina_Bool (*func)(char *target, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *, + int *)) +{ + Ecore_X_Atom x_target; + + if (!func || !target) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + x_target = _ecore_x_selection_target_atom_get(target); + + ecore_x_selection_converter_atom_add(x_target, func); +} /* ecore_x_selection_converter_add */ + +EAPI void +ecore_x_selection_converter_atom_del(Ecore_X_Atom target) +{ + Ecore_X_Selection_Converter *cnv, *prev_cnv; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + prev_cnv = NULL; + cnv = converters; + + while (cnv) + { + if (cnv->target == target) + { + if (prev_cnv) + prev_cnv->next = cnv->next; + else + { + converters = cnv->next; /* This was the first converter */ + } + + free(cnv); + + return; + } + + prev_cnv = cnv; + cnv = cnv->next; + } +} /* ecore_x_selection_converter_atom_del */ + +EAPI void +ecore_x_selection_converter_del(char *target) +{ + Ecore_X_Atom x_target; + + if (!target) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + x_target = _ecore_x_selection_target_atom_get(target); + ecore_x_selection_converter_atom_del(x_target); +} /* ecore_x_selection_converter_del */ + +EAPI Eina_Bool +ecore_x_selection_notify_send(Ecore_X_Window requestor, + Ecore_X_Atom selection, + Ecore_X_Atom target, + Ecore_X_Atom property, + Ecore_X_Time tim) +{ + XEvent xev; + XSelectionEvent xnotify; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xnotify.type = SelectionNotify; + xnotify.display = _ecore_x_disp; + xnotify.requestor = requestor; + xnotify.selection = selection; + xnotify.target = target; + xnotify.property = property; + xnotify.time = tim; + xnotify.send_event = True; + xnotify.serial = 0; + + xev.xselection = xnotify; + return (XSendEvent(_ecore_x_disp, requestor, False, 0, &xev) > 0) ? EINA_TRUE : EINA_FALSE; +} /* ecore_x_selection_notify_send */ + +/* Locate and run conversion callback for specified selection target */ +EAPI Eina_Bool +ecore_x_selection_convert(Ecore_X_Atom selection, + Ecore_X_Atom target, + void **data_ret, + int *size, + Ecore_X_Atom *targtype, + int *typesize) +{ + Ecore_X_Selection_Intern *sel; + Ecore_X_Selection_Converter *cnv; + void *data; + char *tgt_str; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + sel = _ecore_x_selection_get(selection); + tgt_str = _ecore_x_selection_target_get(target); + + for (cnv = converters; cnv; cnv = cnv->next) + { + if (cnv->target == target) + { + int r; + r = cnv->convert(tgt_str, sel->data, sel->length, &data, size, + targtype, typesize); + free(tgt_str); + if (r) + { + *data_ret = data; + return r; + } + else + return EINA_FALSE; + } + } + + /* ICCCM says "If the selection cannot be converted into a form based on the target (and parameters, if any), the owner should refuse the SelectionRequest as previously described." */ + return EINA_FALSE; + + /* Default, just return the data + *data_ret = malloc(sel->length); + memcpy(*data_ret, sel->data, sel->length); + free(tgt_str); + return 1; + */ +} /* ecore_x_selection_convert */ + +/* TODO: We need to work out a mechanism for automatic conversion to any requested + * locale using Ecore_Txt functions */ +/* Converter for standard non-utf8 text targets */ +static Eina_Bool +_ecore_x_selection_converter_text(char *target, + void *data, + int size, + void **data_ret, + int *size_ret, + Ecore_X_Atom *targprop __UNUSED__, + int *s __UNUSED__) +{ + XTextProperty text_prop; + char *mystr; + XICCEncodingStyle style; + + if (!data || !size) + return EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT)) + style = XTextStyle; + else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT)) + style = XCompoundTextStyle; + else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING)) + style = XStringStyle; + +#ifdef X_HAVE_UTF8_STRING + else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING)) + style = XUTF8StringStyle; +#endif /* ifdef X_HAVE_UTF8_STRING */ + else + return EINA_FALSE; + + mystr = alloca(size + 1); + memcpy(mystr, data, size); + mystr[size] = '\0'; + +#ifdef X_HAVE_UTF8_STRING + if (Xutf8TextListToTextProperty(_ecore_x_disp, &mystr, 1, style, + &text_prop) == Success) + { + int bufsize = strlen((char *)text_prop.value) + 1; + *data_ret = malloc(bufsize); + if (!*data_ret) + { + return EINA_FALSE; + } + memcpy(*data_ret, text_prop.value, bufsize); + *size_ret = bufsize; + XFree(text_prop.value); + return EINA_TRUE; + } + +#else /* ifdef X_HAVE_UTF8_STRING */ + if (XmbTextListToTextProperty(_ecore_x_disp, &mystr, 1, style, + &text_prop) == Success) + { + int bufsize = strlen(text_prop.value) + 1; + *data_ret = malloc(bufsize); + if (!*data_ret) return EINA_FALSE; + memcpy(*data_ret, text_prop.value, bufsize); + *size_ret = bufsize; + XFree(text_prop.value); + return EINA_TRUE; + } + +#endif /* ifdef X_HAVE_UTF8_STRING */ + else + { + return EINA_TRUE; + } +} /* _ecore_x_selection_converter_text */ + +EAPI void +ecore_x_selection_parser_add(const char *target, + void *(*func)(const char *target, void *data, + int size, + int format)) +{ + Ecore_X_Selection_Parser *prs; + + if (!target) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + prs = parsers; + if (parsers) + { + while (prs->next) + { + if (!strcmp(prs->target, target)) + { + prs->parse = func; + return; + } + + prs = prs->next; + } + + prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser)); + if (!prs->next) return; + prs = prs->next; + } + else + { + parsers = calloc(1, sizeof(Ecore_X_Selection_Parser)); + if (!parsers) return; + prs = parsers; + } + + prs->target = strdup(target); + prs->parse = func; +} /* ecore_x_selection_parser_add */ + +EAPI void +ecore_x_selection_parser_del(const char *target) +{ + Ecore_X_Selection_Parser *prs, *prev_prs; + + if (!target) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + prev_prs = NULL; + prs = parsers; + + while (prs) + { + if (!strcmp(prs->target, target)) + { + if (prev_prs) + prev_prs->next = prs->next; + else + { + parsers = prs->next; /* This was the first parser */ + } + + free(prs->target); + free(prs); + + return; + } + + prev_prs = prs; + prs = prs->next; + } +} /* ecore_x_selection_parser_del */ + +/** + * Change the owner and last-change time for the specified selection. + * @param win The owner of the specified atom. + * @param atom The selection atom + * @param time Specifies the time + * @since 1.1.0 + */ +EAPI void +ecore_x_selection_owner_set(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Time tim) +{ + XSetSelectionOwner(_ecore_x_disp, atom, win, tim); +} + +/** + * Return the window that currently owns the specified selection. + * + * @param atom The specified selection atom. + * + * @return The window that currently owns the specified selection. + * @since 1.1.0 + */ +EAPI Ecore_X_Window +ecore_x_selection_owner_get(Ecore_X_Atom atom) +{ + return XGetSelectionOwner(_ecore_x_disp, atom); +} + +/* Locate and run conversion callback for specified selection target */ +void * +_ecore_x_selection_parse(const char *target, + void *data, + int size, + int format) +{ + Ecore_X_Selection_Parser *prs; + Ecore_X_Selection_Data *sel; + + for (prs = parsers; prs; prs = prs->next) + { + if (!strcmp(prs->target, target)) + { + sel = prs->parse(target, data, size, format); + if (sel) return sel; + } + } + + /* Default, just return the data */ + sel = calloc(1, sizeof(Ecore_X_Selection_Data)); + if (!sel) return NULL; + sel->free = _ecore_x_selection_data_default_free; + sel->length = size; + sel->format = format; + sel->data = data; + return sel; +} /* _ecore_x_selection_parse */ + +static int +_ecore_x_selection_data_default_free(void *data) +{ + Ecore_X_Selection_Data *sel; + + sel = data; + free(sel->data); + free(sel); + return 1; +} /* _ecore_x_selection_data_default_free */ + +static void * +_ecore_x_selection_parser_files(const char *target, + void *_data, + int size, + int format __UNUSED__) +{ + Ecore_X_Selection_Data_Files *sel; + char *t, *data = _data; + int i, is; + char *tmp; + char **t2; + + if (strcmp(target, "text/uri-list") && + strcmp(target, "_NETSCAPE_URL")) + return NULL; + + sel = calloc(1, sizeof(Ecore_X_Selection_Data_Files)); + if (!sel) return NULL; + ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_files_free; + + if (data[size - 1]) + { + /* Isn't nul terminated */ + size++; + t = realloc(data, size); + if (!t) + { + free(sel); + return NULL; + } + data = t; + data[size - 1] = 0; + } + + tmp = malloc(size); + if (!tmp) + { + free(sel); + return NULL; + } + i = 0; + is = 0; + while ((is < size) && (data[is])) + { + if ((i == 0) && (data[is] == '#')) + for (; ((data[is]) && (data[is] != '\n')); is++) ; + else + { + if ((data[is] != '\r') && + (data[is] != '\n')) + tmp[i++] = data[is++]; + else + { + while ((data[is] == '\r') || (data[is] == '\n')) is++; + tmp[i] = 0; + sel->num_files++; + t2 = realloc(sel->files, sel->num_files * sizeof(char *)); + if (t2) + { + sel->files = t2; + sel->files[sel->num_files - 1] = strdup(tmp); + } + tmp[0] = 0; + i = 0; + } + } + } + if (i > 0) + { + tmp[i] = 0; + sel->num_files++; + t2 = realloc(sel->files, sel->num_files * sizeof(char *)); + if (t2) + { + sel->files = t2; + sel->files[sel->num_files - 1] = strdup(tmp); + } + } + + free(tmp); + free(data); + + ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_FILES; + ECORE_X_SELECTION_DATA(sel)->length = sel->num_files; + + return ECORE_X_SELECTION_DATA(sel); +} /* _ecore_x_selection_parser_files */ + +static int +_ecore_x_selection_data_files_free(void *data) +{ + Ecore_X_Selection_Data_Files *sel; + int i; + + sel = data; + if (sel->files) + { + for (i = 0; i < sel->num_files; i++) + free(sel->files[i]); + free(sel->files); + } + + free(sel); + return 0; +} /* _ecore_x_selection_data_files_free */ + +static void * +_ecore_x_selection_parser_text(const char *target __UNUSED__, + void *_data, + int size, + int format __UNUSED__) +{ + Ecore_X_Selection_Data_Text *sel; + unsigned char *data = _data; + void *t; + + sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text)); + if (!sel) return NULL; + if (data[size - 1]) + { + /* Isn't nul terminated */ + size++; + t = realloc(data, size); + if (!t) + { + free(sel); + return NULL; + } + data = t; + data[size - 1] = 0; + } + + sel->text = (char *)data; + ECORE_X_SELECTION_DATA(sel)->length = size; + ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TEXT; + ECORE_X_SELECTION_DATA(sel)->data = data; + ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_text_free; + return sel; +} /* _ecore_x_selection_parser_text */ + +static int +_ecore_x_selection_data_text_free(void *data) +{ + Ecore_X_Selection_Data_Text *sel; + + sel = data; + free(sel->text); + free(sel); + return 1; +} /* _ecore_x_selection_data_text_free */ + +static void * +_ecore_x_selection_parser_targets(const char *target __UNUSED__, + void *data, + int size, + int format __UNUSED__) +{ + Ecore_X_Selection_Data_Targets *sel; + unsigned long *targets; + int i; + + sel = calloc(1, sizeof(Ecore_X_Selection_Data_Targets)); + if (!sel) return NULL; + targets = (unsigned long *)data; + + sel->num_targets = size - 2; + sel->targets = malloc((size - 2) * sizeof(char *)); + if (!sel->targets) + { + free(sel); + return NULL; + } + for (i = 2; i < size; i++) + sel->targets[i - 2] = XGetAtomName(_ecore_x_disp, targets[i]); + + ECORE_X_SELECTION_DATA(sel)->free = _ecore_x_selection_data_targets_free; + ECORE_X_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TARGETS; + ECORE_X_SELECTION_DATA(sel)->length = size; + ECORE_X_SELECTION_DATA(sel)->data = data; + return sel; +} /* _ecore_x_selection_parser_targets */ + +static int +_ecore_x_selection_data_targets_free(void *data) +{ + Ecore_X_Selection_Data_Targets *sel; + int i; + + sel = data; + + if (sel->targets) + { + for (i = 0; i < sel->num_targets; i++) + XFree(sel->targets[i]); + free(sel->targets); + } + + free(ECORE_X_SELECTION_DATA(sel)->data); + free(sel); + return 1; +} /* _ecore_x_selection_data_targets_free */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_sync.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_sync.c new file mode 100644 index 0000000..e49fede --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_sync.c @@ -0,0 +1,159 @@ +/* + * XSync code + */ + +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include "Ecore_X_Atoms.h" + +EAPI Ecore_X_Sync_Alarm +ecore_x_sync_alarm_new(Ecore_X_Sync_Counter counter) +{ + Ecore_X_Sync_Alarm alarm; + XSyncAlarmAttributes values; + XSyncValue init; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSyncIntToValue(&init, 0); + XSyncSetCounter(_ecore_x_disp, counter, init); + + values.trigger.counter = counter; + values.trigger.value_type = XSyncAbsolute; + XSyncIntToValue(&values.trigger.wait_value, 1); + values.trigger.test_type = XSyncPositiveComparison; + + XSyncIntToValue(&values.delta, 1); + + values.events = True; + + alarm = XSyncCreateAlarm(_ecore_x_disp, + XSyncCACounter | + XSyncCAValueType | + XSyncCAValue | + XSyncCATestType | + XSyncCADelta | + XSyncCAEvents, + &values); + + ecore_x_sync(); + return alarm; +} /* ecore_x_sync_alarm_new */ + +EAPI Eina_Bool +ecore_x_sync_alarm_free(Ecore_X_Sync_Alarm alarm) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XSyncDestroyAlarm(_ecore_x_disp, alarm); +} /* ecore_x_sync_alarm_free */ + +EAPI Eina_Bool +ecore_x_sync_counter_query(Ecore_X_Sync_Counter counter, + unsigned int *val) +{ + XSyncValue value; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (XSyncQueryCounter(_ecore_x_disp, counter, &value)) + { + *val = (unsigned int)XSyncValueLow32(value); + return EINA_TRUE; + } + + return EINA_FALSE; +} /* ecore_x_sync_counter_query */ + +EAPI Ecore_X_Sync_Counter +ecore_x_sync_counter_new(int val) +{ + XSyncCounter counter; + XSyncValue v; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSyncIntToValue(&v, val); + counter = XSyncCreateCounter(_ecore_x_disp, v); + return counter; +} /* ecore_x_sync_counter_new */ + +EAPI void +ecore_x_sync_counter_free(Ecore_X_Sync_Counter counter) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSyncDestroyCounter(_ecore_x_disp, counter); +} /* ecore_x_sync_counter_free */ + +EAPI void +ecore_x_sync_counter_inc(Ecore_X_Sync_Counter counter, + int by) +{ + XSyncValue v; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSyncIntToValue(&v, by); + XSyncChangeCounter(_ecore_x_disp, counter, v); +} /* ecore_x_sync_counter_inc */ + +EAPI void +ecore_x_sync_counter_val_wait(Ecore_X_Sync_Counter counter, + int val) +{ + XSyncWaitCondition cond; + XSyncValue v, v2; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSyncQueryCounter(_ecore_x_disp, counter, &v); + XSyncIntToValue(&v, val); + XSyncIntToValue(&v2, val + 1); + cond.trigger.counter = counter; + cond.trigger.value_type = XSyncAbsolute; + cond.trigger.wait_value = v; + cond.trigger.test_type = XSyncPositiveComparison; + cond.event_threshold = v2; + XSyncAwait(_ecore_x_disp, &cond, 1); +// XSync(_ecore_x_disp, False); // dont need this +} /* ecore_x_sync_counter_val_wait */ + +EAPI void +ecore_x_sync_counter_set(Ecore_X_Sync_Counter counter, + int val) +{ + XSyncValue v; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSyncIntToValue(&v, val); + XSyncSetCounter(_ecore_x_disp, counter, v); +} + +EAPI void +ecore_x_sync_counter_2_set(Ecore_X_Sync_Counter counter, + int val_hi, + unsigned int val_lo) +{ + XSyncValue v; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSyncIntsToValue(&v, val_lo, val_hi); + XSyncSetCounter(_ecore_x_disp, counter, v); +} + +EAPI Eina_Bool +ecore_x_sync_counter_2_query(Ecore_X_Sync_Counter counter, + int *val_hi, + unsigned int *val_lo) +{ + XSyncValue value; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (XSyncQueryCounter(_ecore_x_disp, counter, &value)) + { + *val_lo = (unsigned int)XSyncValueLow32(value); + *val_hi = (int)XSyncValueHigh32(value); + return EINA_TRUE; + } + return EINA_FALSE; +} + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c new file mode 100644 index 0000000..c4576f9 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_test.c @@ -0,0 +1,155 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include + +#ifdef ECORE_XTEST +# include +#endif /* ifdef ECORE_XTEST */ + +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include + +EAPI Eina_Bool +#ifdef ECORE_XTEST +ecore_x_test_fake_key_down(const char *key) +#else +ecore_x_test_fake_key_down(const char *key __UNUSED__) +#endif +{ +#ifdef ECORE_XTEST + KeyCode keycode = 0; + KeySym keysym; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!strncmp(key, "Keycode-", 8)) + keycode = atoi(key + 8); + else + { + keysym = XStringToKeysym(key); + if (keysym == NoSymbol) + return EINA_FALSE; + + keycode = XKeysymToKeycode(_ecore_x_disp, keysym); + } + + if (keycode == 0) + return EINA_FALSE; + + return XTestFakeKeyEvent(_ecore_x_disp, keycode, 1, 0) ? EINA_TRUE : EINA_FALSE; +#else /* ifdef ECORE_XTEST */ + return EINA_FALSE; +#endif /* ifdef ECORE_XTEST */ +} /* ecore_x_test_fake_key_down */ + +EAPI Eina_Bool +#ifdef ECORE_XTEST +ecore_x_test_fake_key_up(const char *key) +#else +ecore_x_test_fake_key_up(const char *key __UNUSED__) +#endif +{ +#ifdef ECORE_XTEST + KeyCode keycode = 0; + KeySym keysym; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!strncmp(key, "Keycode-", 8)) + keycode = atoi(key + 8); + else + { + keysym = XStringToKeysym(key); + if (keysym == NoSymbol) + return EINA_FALSE; + + keycode = XKeysymToKeycode(_ecore_x_disp, keysym); + } + + if (keycode == 0) + return EINA_FALSE; + + return XTestFakeKeyEvent(_ecore_x_disp, keycode, 0, 0) ? EINA_TRUE : EINA_FALSE; +#else /* ifdef ECORE_XTEST */ + return EINA_FALSE; +#endif /* ifdef ECORE_XTEST */ +} /* ecore_x_test_fake_key_up */ + +EAPI Eina_Bool +#ifdef ECORE_XTEST +ecore_x_test_fake_key_press(const char *key) +#else +ecore_x_test_fake_key_press(const char *key __UNUSED__) +#endif +{ +#ifdef ECORE_XTEST + KeyCode keycode = 0; + KeySym keysym = 0; + int shift = 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!strncmp(key, "Keycode-", 8)) + keycode = atoi(key + 8); + else + { + keysym = XStringToKeysym(key); + if (keysym == NoSymbol) + return EINA_FALSE; + + keycode = XKeysymToKeycode(_ecore_x_disp, keysym); + if (XKeycodeToKeysym(_ecore_x_disp, keycode, 0) != keysym) + { + if (XKeycodeToKeysym(_ecore_x_disp, keycode, 1) == keysym) + shift = 1; + else + keycode = 0; + } + else + shift = 0; + } + + if (keycode == 0) + { + static int mod = 0; + KeySym *keysyms; + int keycode_min, keycode_max, keycode_num; + int i; + + XDisplayKeycodes(_ecore_x_disp, &keycode_min, &keycode_max); + keysyms = XGetKeyboardMapping(_ecore_x_disp, keycode_min, + keycode_max - keycode_min + 1, + &keycode_num); + mod = (mod + 1) & 0x7; + i = (keycode_max - keycode_min - mod - 1) * keycode_num; + + keysyms[i] = keysym; + XChangeKeyboardMapping(_ecore_x_disp, keycode_min, keycode_num, + keysyms, (keycode_max - keycode_min)); + XFree(keysyms); + XSync(_ecore_x_disp, False); + keycode = keycode_max - mod - 1; + } + + if (shift) + XTestFakeKeyEvent(_ecore_x_disp, + XKeysymToKeycode(_ecore_x_disp, XK_Shift_L), 1, 0); + + XTestFakeKeyEvent(_ecore_x_disp, keycode, 1, 0); + XTestFakeKeyEvent(_ecore_x_disp, keycode, 0, 0); + if (shift) + XTestFakeKeyEvent(_ecore_x_disp, + XKeysymToKeycode(_ecore_x_disp, XK_Shift_L), 0, 0); + + return EINA_TRUE; +#else /* ifdef ECORE_XTEST */ + return EINA_FALSE; +#endif /* ifdef ECORE_XTEST */ +} /* ecore_x_test_fake_key_press */ + +EAPI const char * +ecore_x_keysym_string_get(int keysym) +{ + return XKeysymToString(keysym); +} /* ecore_x_keysym_string_get */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c new file mode 100644 index 0000000..f054298 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_vsync.c @@ -0,0 +1,351 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#define ECORE_X_VSYNC_DRI2 1 + +#ifdef ECORE_X_VSYNC_DRI2 +// relevant header bits of dri/drm inlined here to avoid needing external +// headers to build +/// drm +typedef unsigned int drm_magic_t; + +typedef enum +{ + DRM_VBLANK_ABSOLUTE = 0x00000000, + DRM_VBLANK_RELATIVE = 0x00000001, + DRM_VBLANK_EVENT = 0x04000000, + DRM_VBLANK_FLIP = 0x08000000, + DRM_VBLANK_NEXTONMISS = 0x10000000, + DRM_VBLANK_SECONDARY = 0x20000000, + DRM_VBLANK_SIGNAL = 0x40000000 +} +drmVBlankSeqType; + +typedef struct _drmVBlankReq +{ + drmVBlankSeqType type; + unsigned int sequence; + unsigned long signal; +} drmVBlankReq; + +typedef struct _drmVBlankReply +{ + drmVBlankSeqType type; + unsigned int sequence; + long tval_sec; + long tval_usec; +} drmVBlankReply; + +typedef union _drmVBlank +{ + drmVBlankReq request; + drmVBlankReply reply; +} drmVBlank; + +#define DRM_EVENT_CONTEXT_VERSION 2 + +typedef struct _drmEventContext +{ + int version; + void (*vblank_handler)(int fd, + unsigned int sequence, + unsigned int tv_sec, + unsigned int tv_usec, + void *user_data); + void (*page_flip_handler)(int fd, + unsigned int sequence, + unsigned int tv_sec, + unsigned int tv_usec, + void *user_data); +} drmEventContext; + +static int (*sym_drmClose)(int fd) = NULL; +static int (*sym_drmGetMagic)(int fd, + drm_magic_t *magic) = NULL; +static int (*sym_drmWaitVBlank)(int fd, + drmVBlank *vbl) = NULL; +static int (*sym_drmHandleEvent)(int fd, + drmEventContext *evctx) = NULL; + +//// dri + +static Bool (*sym_DRI2QueryExtension)(Display *display, + int *eventBase, + int *errorBase) = NULL; +static Bool (*sym_DRI2QueryVersion)(Display *display, + int *major, + int *minor) = NULL; +static Bool (*sym_DRI2Connect)(Display *display, + XID window, + char **driverName, + char **deviceName) = NULL; +static Bool (*sym_DRI2Authenticate)(Display *display, + XID window, + drm_magic_t magic) = NULL; + +//// dri/drm data needed +static int dri2_event = 0; +static int dri2_error = 0; +static int dri2_major = 0; +static int dri2_minor = 0; +static char *device_name = 0; +static char *driver_name = 0; +static drm_magic_t drm_magic; + +static int drm_fd = -1; +static int drm_event_is_busy = 0; +static int drm_animators_interval = 1; +static drmEventContext drm_evctx; +static Ecore_Fd_Handler *dri_drm_fdh = NULL; + +static void *dri_lib = NULL; +static void *drm_lib = NULL; + +static Window dri_drm_vsync_root = 0; + +static void +_dri_drm_tick_schedule(void) +{ + drmVBlank vbl; + + vbl.request.type = DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT; + vbl.request.sequence = drm_animators_interval; + vbl.request.signal = 0; + sym_drmWaitVBlank(drm_fd, &vbl); +} + +static void +_dri_drm_tick_begin(void *data __UNUSED__) +{ + drm_event_is_busy = 1; + _dri_drm_tick_schedule(); +} + +static void +_dri_drm_tick_end(void *data __UNUSED__) +{ + drm_event_is_busy = 0; +} + +static void +_dri_drm_vblank_handler(int fd __UNUSED__, + unsigned int frame __UNUSED__, + unsigned int sec __UNUSED__, + unsigned int usec __UNUSED__, + void *data __UNUSED__) +{ + ecore_animator_custom_tick(); + if (drm_event_is_busy) _dri_drm_tick_schedule(); +} + +static Eina_Bool +_dri_drm_cb(void *data __UNUSED__, + Ecore_Fd_Handler *fd_handler __UNUSED__) +{ + sym_drmHandleEvent(drm_fd, &drm_evctx); + return ECORE_CALLBACK_RENEW; +} + +// yes. most evil. we dlopen libdrm and libGL etc. to manually find smbols +// so we can be as compatible as possible given the whole mess of the +// gl/dri/drm etc. world. and handle graceful failure at runtime not +// compile time +static int +_dri_drm_link(void) +{ + const char *drm_libs[] = + { + "libdrm.so.2", + "libdrm.so.1", + "libdrm.so.0", + "libdrm.so", + NULL, + }; + const char *dri_libs[] = + { + "libdri2.so.2", + "libdri2.so.1", + "libdri2.so.0", + "libdri2.so", + "libGL.so.4", + "libGL.so.3", + "libGL.so.2", + "libGL.so.1", + "libGL.so.0", + "libGL.so", + NULL, + }; + int i, fail; +#define SYM(lib, xx) \ + do { \ + sym_ ## xx = dlsym(lib, #xx); \ + if (!(sym_ ## xx)) { \ + fprintf(stderr, "%s\n", dlerror()); \ + fail = 1; \ + } \ + } while (0) + + if (dri_lib) return 1; + for (i = 0; drm_libs[i]; i++) + { + drm_lib = dlopen(drm_libs[i], RTLD_LOCAL | RTLD_LAZY); + if (drm_lib) + { + fail = 0; + SYM(drm_lib, drmClose); + SYM(drm_lib, drmWaitVBlank); + SYM(drm_lib, drmHandleEvent); + if (fail) + { + dlclose(drm_lib); + drm_lib = NULL; + } + else break; + } + } + if (!drm_lib) return 0; + for (i = 0; dri_libs[i]; i++) + { + dri_lib = dlopen(dri_libs[i], RTLD_LOCAL | RTLD_LAZY); + if (dri_lib) + { + fail = 0; + SYM(dri_lib, DRI2QueryExtension); + SYM(dri_lib, DRI2QueryVersion); + SYM(dri_lib, DRI2Connect); + SYM(dri_lib, DRI2Authenticate); + if (fail) + { + dlclose(dri_lib); + dri_lib = NULL; + } + else break; + } + } + if (!dri_lib) + { + dlclose(drm_lib); + drm_lib = NULL; + return 0; + } + return 1; +} + +static int +_dri_drm_init(void) +{ + if (!sym_DRI2QueryExtension(_ecore_x_disp, &dri2_event, &dri2_error)) + return 0; + if (!sym_DRI2QueryVersion(_ecore_x_disp, &dri2_major, &dri2_minor)) + return 0; + if (dri2_major < 2) + return 0; + if (!sym_DRI2Connect(_ecore_x_disp, dri_drm_vsync_root, &driver_name, &device_name)) + return 0; + drm_fd = open(device_name, O_RDWR); + if (drm_fd < 0) + return 0; + sym_drmGetMagic(drm_fd, &drm_magic); + if (!sym_DRI2Authenticate(_ecore_x_disp, dri_drm_vsync_root, drm_magic)) + { + close(drm_fd); + drm_fd = -1; + return 0; + } + memset(&drm_evctx, 0, sizeof(drm_evctx)); + drm_evctx.version = DRM_EVENT_CONTEXT_VERSION; + drm_evctx.vblank_handler = _dri_drm_vblank_handler; + drm_evctx.page_flip_handler = NULL; + + dri_drm_fdh = ecore_main_fd_handler_add(drm_fd, ECORE_FD_READ, + _dri_drm_cb, NULL, NULL, NULL); + if (!dri_drm_fdh) + { + close(drm_fd); + drm_fd = -1; + return 0; + } + return 1; +} + +static void +_dri_drm_shutdown(void) +{ + if (drm_fd >= 0) + { + close(drm_fd); + drm_fd = -1; + } + if (dri_drm_fdh) + { + ecore_main_fd_handler_del(dri_drm_fdh); + dri_drm_fdh = NULL; + } +} + +#endif + +EAPI Eina_Bool +ecore_x_vsync_animator_tick_source_set(Ecore_X_Window win) +{ +#ifdef ECORE_X_VSYNC_DRI2 + Ecore_X_Window root; + + root = ecore_x_window_root_get(win); + if (root != dri_drm_vsync_root) + { + dri_drm_vsync_root = root; + if (dri_drm_vsync_root) + { + if (!_dri_drm_link()) + { + ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); + return EINA_FALSE; + } + _dri_drm_shutdown(); + if (!_dri_drm_init()) + { + dri_drm_vsync_root = 0; + ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); + return EINA_FALSE; + } + ecore_animator_custom_source_tick_begin_callback_set + (_dri_drm_tick_begin, NULL); + ecore_animator_custom_source_tick_end_callback_set + (_dri_drm_tick_end, NULL); + ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_CUSTOM); + } + else + { + if (drm_fd >= 0) + { + _dri_drm_shutdown(); + ecore_animator_custom_source_tick_begin_callback_set + (NULL, NULL); + ecore_animator_custom_source_tick_end_callback_set + (NULL, NULL); + ecore_animator_source_set(ECORE_ANIMATOR_SOURCE_TIMER); + } + } + } + return EINA_TRUE; +#else + return EINA_FALSE; + win = 0; +#endif +} + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c new file mode 100644 index 0000000..76670d3 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window.c @@ -0,0 +1,1723 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include +#include +#include + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include "Ecore_X_Atoms.h" + +static int ignore_num = 0; +static Ecore_X_Window *ignore_list = NULL; + +/** + * @defgroup Ecore_X_Window_Create_Group X Window Creation Functions + * + * Functions that can be used to create an X window. + */ + +/** + * Creates a new window. + * @param parent The parent window to use. If @p parent is @c 0, the root + * window of the default display is used. + * @param x X position. + * @param y Y position. + * @param w Width. + * @param h Height. + * @return The new window handle. + * @ingroup Ecore_X_Window_Create_Group + */ +EAPI Ecore_X_Window +ecore_x_window_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h) +{ + Window win; + XSetWindowAttributes attr; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (parent == 0) + parent = DefaultRootWindow(_ecore_x_disp); + + attr.backing_store = NotUseful; + attr.override_redirect = False; + attr.border_pixel = 0; + attr.background_pixmap = None; + attr.bit_gravity = NorthWestGravity; + attr.win_gravity = NorthWestGravity; + attr.save_under = False; + attr.do_not_propagate_mask = NoEventMask; + attr.event_mask = KeyPressMask | + KeyReleaseMask | + ButtonPressMask | + ButtonReleaseMask | + EnterWindowMask | + LeaveWindowMask | + PointerMotionMask | + ExposureMask | + VisibilityChangeMask | + StructureNotifyMask | + FocusChangeMask | + PropertyChangeMask | + ColormapChangeMask; + win = XCreateWindow(_ecore_x_disp, parent, + x, y, w, h, 0, + CopyFromParent, /*DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/ + InputOutput, + CopyFromParent, /*DefaultVisual(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/ + CWBackingStore | + CWOverrideRedirect | +/* CWColormap | */ + CWBorderPixel | + CWBackPixmap | + CWSaveUnder | + CWDontPropagate | + CWEventMask | + CWBitGravity | + CWWinGravity, + &attr); + + if (parent == DefaultRootWindow(_ecore_x_disp)) + ecore_x_window_defaults_set(win); + + return win; +} /* ecore_x_window_new */ + +/** + * Creates a window with the override redirect attribute set to @c True. + * @param parent The parent window to use. If @p parent is @c 0, the root + * window of the default display is used. + * @param x X position. + * @param y Y position. + * @param w Width. + * @param h Height. + * @return The new window handle. + * @ingroup Ecore_X_Window_Create_Group + */ +EAPI Ecore_X_Window +ecore_x_window_override_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h) +{ + Window win; + XSetWindowAttributes attr; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (parent == 0) + parent = DefaultRootWindow(_ecore_x_disp); + + attr.backing_store = NotUseful; + attr.override_redirect = True; + attr.border_pixel = 0; + attr.background_pixmap = None; + attr.bit_gravity = NorthWestGravity; + attr.win_gravity = NorthWestGravity; + attr.save_under = False; + attr.do_not_propagate_mask = NoEventMask; + attr.event_mask = KeyPressMask | + KeyReleaseMask | + ButtonPressMask | + ButtonReleaseMask | + EnterWindowMask | + LeaveWindowMask | + PointerMotionMask | + ExposureMask | + VisibilityChangeMask | + StructureNotifyMask | + FocusChangeMask | + PropertyChangeMask | + ColormapChangeMask; + win = XCreateWindow(_ecore_x_disp, parent, + x, y, w, h, 0, + CopyFromParent, /*DefaultDepth(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/ + InputOutput, + CopyFromParent, /*DefaultVisual(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/ + CWBackingStore | + CWOverrideRedirect | +/* CWColormap | */ + CWBorderPixel | + CWBackPixmap | + CWSaveUnder | + CWDontPropagate | + CWEventMask | + CWBitGravity | + CWWinGravity, + &attr); + return win; +} /* ecore_x_window_override_new */ + +/** + * Creates a new input window. + * @param parent The parent window to use. If @p parent is @c 0, the root + * window of the default display is used. + * @param x X position. + * @param y Y position. + * @param w Width. + * @param h Height. + * @return The new window. + * @ingroup Ecore_X_Window_Create_Group + */ +EAPI Ecore_X_Window +ecore_x_window_input_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h) +{ + Window win; + XSetWindowAttributes attr; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (parent == 0) + parent = DefaultRootWindow(_ecore_x_disp); + + attr.override_redirect = True; + attr.do_not_propagate_mask = NoEventMask; + attr.event_mask = KeyPressMask | + KeyReleaseMask | + ButtonPressMask | + ButtonReleaseMask | + EnterWindowMask | + LeaveWindowMask | + PointerMotionMask | + ExposureMask | + VisibilityChangeMask | + StructureNotifyMask | + FocusChangeMask | + PropertyChangeMask | + ColormapChangeMask; + win = XCreateWindow(_ecore_x_disp, parent, + x, y, w, h, 0, + CopyFromParent, + InputOnly, + CopyFromParent, /*DefaultVisual(_ecore_x_disp, DefaultScreen(_ecore_x_disp)),*/ + CWOverrideRedirect | + CWDontPropagate | + CWEventMask, + &attr); + + if (parent == DefaultRootWindow(_ecore_x_disp)) + { + } + + return win; +} /* ecore_x_window_input_new */ + +/** + * @defgroup Ecore_X_Window_Properties_Group X Window Property Functions + * + * Functions that set window properties. + */ + +/** + * Sets the default properties for the given window. + * + * The default properties set for the window are @c WM_CLIENT_MACHINE and + * @c _NET_WM_PID. + * + * @param win The given window. + * @ingroup Ecore_X_Window_Properties_Groups + */ +EAPI void +ecore_x_window_defaults_set(Ecore_X_Window win) +{ + long pid; + char buf[MAXHOSTNAMELEN]; + char *hostname[1]; + int argc; + char **argv; + XTextProperty xprop; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* + * Set WM_CLIENT_MACHINE. + */ + gethostname(buf, MAXHOSTNAMELEN); + buf[MAXHOSTNAMELEN - 1] = '\0'; + hostname[0] = buf; + /* The ecore function uses UTF8 which Xlib may not like (especially + * with older clients) */ + /* ecore_x_window_prop_string_set(win, ECORE_X_ATOM_WM_CLIENT_MACHINE, + (char *)buf); */ + if (XStringListToTextProperty(hostname, 1, &xprop)) + { + XSetWMClientMachine(_ecore_x_disp, win, &xprop); + XFree(xprop.value); + } + + /* + * Set _NET_WM_PID + */ + pid = getpid(); + ecore_x_netwm_pid_set(win, pid); + + ecore_x_netwm_window_type_set(win, ECORE_X_WINDOW_TYPE_NORMAL); + + ecore_app_args_get(&argc, &argv); + ecore_x_icccm_command_set(win, argc, argv); +} /* ecore_x_window_defaults_set */ + +EAPI void +ecore_x_window_configure(Ecore_X_Window win, + Ecore_X_Window_Configure_Mask mask, + int x, + int y, + int w, + int h, + int border_width, + Ecore_X_Window sibling, + int stack_mode) +{ + XWindowChanges xwc; + + if (!win) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + + xwc.x = x; + xwc.y = y; + xwc.width = w; + xwc.height = h; + xwc.border_width = border_width; + xwc.sibling = sibling; + xwc.stack_mode = stack_mode; + + XConfigureWindow(_ecore_x_disp, win, mask, &xwc); +} /* ecore_x_window_configure */ + +/** + * @defgroup Ecore_X_Window_Destroy_Group X Window Destroy Functions + * + * Functions to destroy X windows. + */ + +/** + * Deletes the given window. + * @param win The given window. + * @ingroup Ecore_X_Window_Destroy_Group + */ +EAPI void +ecore_x_window_free(Ecore_X_Window win) +{ + /* sorry sir, deleting the root window doesn't sound like + * a smart idea. + */ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (win) + XDestroyWindow(_ecore_x_disp, win); +} /* ecore_x_window_free */ + +/** + * Set if a window should be ignored. + * @param win The given window. + * @param ignore if to ignore + */ +EAPI void +ecore_x_window_ignore_set(Ecore_X_Window win, + int ignore) +{ + int i, j, cnt; + Ecore_X_Window *t; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (ignore) + { + if (ignore_list) + { + for (i = 0; i < ignore_num; i++) + { + if (win == ignore_list[i]) + return; + } + t = realloc(ignore_list, (ignore_num + 1) * sizeof(Ecore_X_Window)); + if (!t) return; + ignore_list = t; + ignore_list[ignore_num++] = win; + } + else + { + ignore_num = 0; + ignore_list = malloc(sizeof(Ecore_X_Window)); + if (ignore_list) + ignore_list[ignore_num++] = win; + } + } + else + { + if (!ignore_list) + return; + + for (cnt = ignore_num, i = 0, j = 0; i < cnt; i++) + { + if (win != ignore_list[i]) + ignore_list[j++] = ignore_list[i]; + else + ignore_num--; + } + + if (ignore_num <= 0) + { + free(ignore_list); + ignore_list = NULL; + return; + } + t = realloc(ignore_list, ignore_num * sizeof(Ecore_X_Window)); + if (t) ignore_list = t; + } +} /* ecore_x_window_ignore_set */ + +/** + * Get the ignore list + * @param num number of windows in the list + * @return list of windows to ignore + */ +EAPI Ecore_X_Window * +ecore_x_window_ignore_list(int *num) +{ + if (num) + *num = ignore_num; + + return ignore_list; +} /* ecore_x_window_ignore_list */ + +/** + * Sends a delete request to the given window. + * @param win The given window. + * @ingroup Ecore_X_Window_Destroy_Group + */ +EAPI void +ecore_x_window_delete_request_send(Ecore_X_Window win) +{ + XEvent xev; + + /* sorry sir, deleting the root window doesn't sound like + * a smart idea. + */ + if (!win) + return; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + xev.xclient.type = ClientMessage; + xev.xclient.display = _ecore_x_disp; + xev.xclient.window = win; + xev.xclient.message_type = ECORE_X_ATOM_WM_PROTOCOLS; + xev.xclient.format = 32; + xev.xclient.data.l[0] = ECORE_X_ATOM_WM_DELETE_WINDOW; + xev.xclient.data.l[1] = CurrentTime; + + XSendEvent(_ecore_x_disp, win, False, NoEventMask, &xev); +} /* ecore_x_window_delete_request_send */ + +/** + * @defgroup Ecore_X_Window_Visibility_Group X Window Visibility Functions + * + * Functions to access and change the visibility of X windows. + */ + +/** + * Shows a window. + * + * Synonymous to "mapping" a window in X Window System terminology. + * + * @param win The window to show. + * @ingroup Ecore_X_Window_Visibility + */ +EAPI void +ecore_x_window_show(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XMapWindow(_ecore_x_disp, win); +} /* ecore_x_window_show */ + +/** + * Hides a window. + * + * Synonymous to "unmapping" a window in X Window System terminology. + * + * @param win The window to hide. + * @ingroup Ecore_X_Window_Visibility + */ +EAPI void +ecore_x_window_hide(Ecore_X_Window win) +{ + XEvent xev; + Window root; + int idum; + unsigned int uidum; + + /* ICCCM: SEND unmap event... */ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + root = win; + if (ScreenCount(_ecore_x_disp) == 1) + root = DefaultRootWindow(_ecore_x_disp); + else + XGetGeometry(_ecore_x_disp, + win, + &root, + &idum, + &idum, + &uidum, + &uidum, + &uidum, + &uidum); + + xev.xunmap.type = UnmapNotify; + xev.xunmap.serial = 0; + xev.xunmap.send_event = True; + xev.xunmap.display = _ecore_x_disp; + xev.xunmap.event = root; + xev.xunmap.window = win; + xev.xunmap.from_configure = False; + XSendEvent(_ecore_x_disp, xev.xunmap.event, False, + SubstructureRedirectMask | SubstructureNotifyMask, &xev); + XUnmapWindow(_ecore_x_disp, win); +} /* ecore_x_window_hide */ + +/** + * @defgroup Ecore_X_Window_Geometry_Group X Window Geometry Functions + * + * Functions that change or retrieve the geometry of X windows. + */ + +/** + * Moves a window to the position @p x, @p y. + * + * The position is relative to the upper left hand corner of the + * parent window. + * + * @param win The window to move. + * @param x X position. + * @param y Y position. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI void +ecore_x_window_move(Ecore_X_Window win, + int x, + int y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XMoveWindow(_ecore_x_disp, win, x, y); +} /* ecore_x_window_move */ + +/** + * Resizes a window. + * @param win The window to resize. + * @param w New width of the window. + * @param h New height of the window. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI void +ecore_x_window_resize(Ecore_X_Window win, + int w, + int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (w < 1) + w = 1; + + if (h < 1) + h = 1; + + XResizeWindow(_ecore_x_disp, win, w, h); +} /* ecore_x_window_resize */ + +/** + * Moves and resizes a window. + * @param win The window to move and resize. + * @param x New X position of the window. + * @param y New Y position of the window. + * @param w New width of the window. + * @param h New height of the window. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI void +ecore_x_window_move_resize(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (w < 1) + w = 1; + + if (h < 1) + h = 1; + + XMoveResizeWindow(_ecore_x_disp, win, x, y, w, h); +} /* ecore_x_window_move_resize */ + +/** + * @defgroup Ecore_X_Window_Focus_Functions X Window Focus Functions + * + * Functions that give the focus to an X Window. + */ + +/** + * Sets the focus to the window @p win. + * @param win The window to focus. + * @ingroup Ecore_X_Window_Focus_Functions + */ +EAPI void +ecore_x_window_focus(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (win == 0) + win = DefaultRootWindow(_ecore_x_disp); // XSetInputFocus(_ecore_x_disp, win, RevertToNone, CurrentTime); + +// XSetInputFocus(_ecore_x_disp, win, RevertToPointerRoot, CurrentTime); + XSetInputFocus(_ecore_x_disp, win, RevertToParent, CurrentTime); +} /* ecore_x_window_focus */ + +/** + * Sets the focus to the given window at a specific time. + * @param win The window to focus. + * @param t When to set the focus to the window. + * @ingroup Ecore_X_Window_Focus_Functions + */ +EAPI void +ecore_x_window_focus_at_time(Ecore_X_Window win, + Ecore_X_Time t) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (win == 0) + win = DefaultRootWindow(_ecore_x_disp); // XSetInputFocus(_ecore_x_disp, win, RevertToNone, t); + +// XSetInputFocus(_ecore_x_disp, win, PointerRoot, t); + XSetInputFocus(_ecore_x_disp, win, RevertToParent, t); +} /* ecore_x_window_focus_at_time */ + +/** + * gets the focus to the window @p win. + * @return The window that has focus. + * @ingroup Ecore_X_Window_Focus_Functions + */ +EAPI Ecore_X_Window +ecore_x_window_focus_get(void) +{ + Window win; + int revert_mode; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + win = 0; + XGetInputFocus(_ecore_x_disp, &win, &revert_mode); + return win; +} /* ecore_x_window_focus_get */ + +/** + * @defgroup Ecore_X_Window_Z_Order_Group X Window Z Order Functions + * + * Functions that change the Z order of X windows. + */ + +/** + * Raises the given window. + * @param win The window to raise. + * @ingroup Ecore_X_Window_Z_Order_Group + */ +EAPI void +ecore_x_window_raise(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XRaiseWindow(_ecore_x_disp, win); +} /* ecore_x_window_raise */ + +/** + * Lowers the given window. + * @param win The window to lower. + * @ingroup Ecore_X_Window_Z_Order_Group + */ +EAPI void +ecore_x_window_lower(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XLowerWindow(_ecore_x_disp, win); +} /* ecore_x_window_lower */ + +/** + * @defgroup Ecore_X_Window_Parent_Group X Window Parent Functions + * + * Functions that retrieve or changes the parent window of a window. + */ + +/** + * Moves a window to within another window at a given position. + * @param win The window to reparent. + * @param new_parent The new parent window. + * @param x X position within new parent window. + * @param y Y position within new parent window. + * @ingroup Ecore_X_Window_Parent_Group + */ +EAPI void +ecore_x_window_reparent(Ecore_X_Window win, + Ecore_X_Window new_parent, + int x, + int y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (new_parent == 0) + new_parent = DefaultRootWindow(_ecore_x_disp); + + XReparentWindow(_ecore_x_disp, win, new_parent, x, y); +} /* ecore_x_window_reparent */ + +/** + * Retrieves the size of the given window. + * @param win The given window. + * @param w Pointer to an integer into which the width is to be stored. + * @param h Pointer to an integer into which the height is to be stored. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI void +ecore_x_window_size_get(Ecore_X_Window win, + int *w, + int *h) +{ + int dummy_x, dummy_y; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (win == 0) + win = DefaultRootWindow(_ecore_x_disp); + + ecore_x_drawable_geometry_get(win, &dummy_x, &dummy_y, w, h); +} /* ecore_x_window_size_get */ + +/** + * Retrieves the geometry of the given window. + * + * Note that the x & y coordingates are relative to your parent. In + * particular for reparenting window managers - relative to you window border. + * If you want screen coordinates either walk the window tree to the root, + * else for ecore_evas applications see ecore_evas_geometry_get(). Elementary + * applications can use elm_win_screen_position_get(). + * + * @param win The given window. + * @param x Pointer to an integer in which the X position is to be stored. + * @param y Pointer to an integer in which the Y position is to be stored. + * @param w Pointer to an integer in which the width is to be stored. + * @param h Pointer to an integer in which the height is to be stored. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI void +ecore_x_window_geometry_get(Ecore_X_Window win, + int *x, + int *y, + int *w, + int *h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!win) + win = DefaultRootWindow(_ecore_x_disp); + + ecore_x_drawable_geometry_get(win, x, y, w, h); +} /* ecore_x_window_geometry_get */ + +/** + * Retrieves the width of the border of the given window. + * @param win The given window. + * @return Width of the border of @p win. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI int +ecore_x_window_border_width_get(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* doesn't make sense to call this on a root window */ + if (!win) + return 0; + + return ecore_x_drawable_border_width_get(win); +} /* ecore_x_window_border_width_get */ + +/** + * Sets the width of the border of the given window. + * @param win The given window. + * @param width The new border width. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI void +ecore_x_window_border_width_set(Ecore_X_Window win, + int width) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* doesn't make sense to call this on a root window */ + if (!win) + return; + + XSetWindowBorderWidth (_ecore_x_disp, win, width); +} /* ecore_x_window_border_width_set */ + +/** + * Retrieves the depth of the given window. + * @param win The given window. + * @return Depth of the window. + */ +EAPI int +ecore_x_window_depth_get(Ecore_X_Window win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return ecore_x_drawable_depth_get(win); +} /* ecore_x_window_depth_get */ + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI void +ecore_x_window_cursor_show(Ecore_X_Window win, + Eina_Bool show) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (win == 0) + win = DefaultRootWindow(_ecore_x_disp); + + if (!show) + { + Cursor c; + XColor cl; + Pixmap p, m; + GC gc; + XGCValues gcv; + + p = XCreatePixmap(_ecore_x_disp, win, 1, 1, 1); + m = XCreatePixmap(_ecore_x_disp, win, 1, 1, 1); + gc = XCreateGC(_ecore_x_disp, m, 0, &gcv); + XSetForeground(_ecore_x_disp, gc, 0); + XDrawPoint(_ecore_x_disp, m, gc, 0, 0); + XFreeGC(_ecore_x_disp, gc); + c = XCreatePixmapCursor(_ecore_x_disp, p, m, &cl, &cl, 0, 0); + XDefineCursor(_ecore_x_disp, win, c); + XFreeCursor(_ecore_x_disp, c); + XFreePixmap(_ecore_x_disp, p); + XFreePixmap(_ecore_x_disp, m); + } + else + XDefineCursor(_ecore_x_disp, win, 0); +} /* ecore_x_window_cursor_show */ + +EAPI void +ecore_x_window_cursor_set(Ecore_X_Window win, + Ecore_X_Cursor c) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (c == 0) + XUndefineCursor(_ecore_x_disp, win); + else + XDefineCursor(_ecore_x_disp, win, c); +} /* ecore_x_window_cursor_set */ + +/** + * Finds out whether the given window is currently visible. + * @param win The given window. + * @return 1 if the window is visible, otherwise 0. + * @ingroup Ecore_X_Window_Visibility_Group + */ +EAPI int +ecore_x_window_visible_get(Ecore_X_Window win) +{ + XWindowAttributes attr; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return XGetWindowAttributes(_ecore_x_disp, win, &attr) && + (attr.map_state == IsViewable); +} /* ecore_x_window_visible_get */ + +typedef struct _Shadow Shadow; +struct _Shadow +{ + Shadow *parent; + Shadow **children; + Window win; + int children_num; + short x, y; + unsigned short w, h; +}; + +static Shadow **shadow_base = NULL; +static int shadow_num = 0; + +static Shadow * +_ecore_x_window_tree_walk(Window win) +{ + Window *list = NULL; + Window parent_win = 0, root_win = 0; + unsigned int num; + Shadow *s, **sl; + XWindowAttributes att; + + if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) + return NULL; // if (att.class == InputOnly) return NULL; + + if (att.map_state != IsViewable) + return NULL; + + s = calloc(1, sizeof(Shadow)); + if (!s) + return NULL; + + s->win = win; + s->x = att.x; + s->y = att.y; + s->w = att.width; + s->h = att.height; + if (XQueryTree(_ecore_x_disp, s->win, &root_win, &parent_win, + &list, &num)) + { + s->children = calloc(1, sizeof(Shadow *) * num); + if (s->children) + { + size_t i, j; + s->children_num = num; + for (i = 0; i < num; i++) + { + s->children[i] = _ecore_x_window_tree_walk(list[i]); + if (s->children[i]) + s->children[i]->parent = s; + } + /* compress list down */ + j = 0; + for (i = 0; i < num; i++) + { + if (s->children[i]) + { + s->children[j] = s->children[i]; + j++; + } + } + if (j == 0) + { + free(s->children); + s->children = NULL; + s->children_num = 0; + } + else + { + s->children_num = j; + sl = realloc(s->children, sizeof(Shadow *) * j); + if (sl) + s->children = sl; + } + } + } + + if (list) + XFree(list); + + return s; +} /* _ecore_x_window_tree_walk */ + +static void +_ecore_x_window_tree_shadow_free1(Shadow *s) +{ + int i; + + if (!s) + return; + + if (s->children) + { + for (i = 0; i < s->children_num; i++) + { + if (s->children[i]) + _ecore_x_window_tree_shadow_free1(s->children[i]); + } + free(s->children); + } + + free(s); +} /* _ecore_x_window_tree_shadow_free1 */ + +static void +_ecore_x_window_tree_shadow_free(void) +{ + int i; + + if (!shadow_base) + return; + + for (i = 0; i < shadow_num; i++) + { + if (!shadow_base[i]) + continue; + + _ecore_x_window_tree_shadow_free1(shadow_base[i]); + } + free(shadow_base); + shadow_base = NULL; + shadow_num = 0; +} /* _ecore_x_window_tree_shadow_free */ + +static void +_ecore_x_window_tree_shadow_populate(void) +{ + Ecore_X_Window *roots; + int i, num; + + roots = ecore_x_window_root_list(&num); + if (roots) + { + shadow_base = calloc(1, sizeof(Shadow *) * num); + if (shadow_base) + { + shadow_num = num; + for (i = 0; i < num; i++) + shadow_base[i] = _ecore_x_window_tree_walk(roots[i]); + } + + free(roots); + } +} /* _ecore_x_window_tree_shadow_populate */ + +/* + static int shadow_count = 0; + + static void + _ecore_x_window_tree_shadow_start(void) + { + shadow_count++; + if (shadow_count > 1) return; + _ecore_x_window_tree_shadow_populate(); + } + + static void + _ecore_x_window_tree_shadow_stop(void) + { + shadow_count--; + if (shadow_count != 0) return; + _ecore_x_window_tree_shadow_free(); + } + */ + +static Shadow * +_ecore_x_window_shadow_tree_find_shadow(Shadow *s, + Window win) +{ + Shadow *ss; + int i; + + if (s->win == win) + return s; + + if (s->children) + for (i = 0; i < s->children_num; i++) + { + if (!s->children[i]) + continue; + + if ((ss = + _ecore_x_window_shadow_tree_find_shadow(s->children[i], win))) + return ss; + } + + return NULL; +} /* _ecore_x_window_shadow_tree_find_shadow */ + +static Shadow * +_ecore_x_window_shadow_tree_find(Window base) +{ + Shadow *s; + int i; + + for (i = 0; i < shadow_num; i++) + { + if (!shadow_base[i]) + continue; + + if ((s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], base))) + return s; + } + return NULL; +} /* _ecore_x_window_shadow_tree_find */ + +static int +_inside_rects(Shadow *s, + int x, + int y, + int bx, + int by, + Ecore_X_Rectangle *rects, + int num) +{ + int i, inside; + + if (!rects) return 0; + inside = 0; + for (i = 0; i < num; i++) + { + if ((x >= s->x + bx + rects[i].x) && + (y >= s->y + by + rects[i].y) && + (x < (int)(s->x + bx + rects[i].x + rects[i].width)) && + (y < (int)(s->y + by + rects[i].y + rects[i].height))) + { + inside = 1; + break; + } + } + free(rects); + return inside; +} + +static Window +_ecore_x_window_shadow_tree_at_xy_get_shadow(Shadow *s, + int bx, + int by, + int x, + int y, + Ecore_X_Window *skip, + int skip_num) +{ + Window child; + int i, j; + int wx, wy; + + wx = s->x + bx; + wy = s->y + by; + if (!((x >= wx) && (y >= wy) && (x < (wx + s->w)) && (y < (wy + s->h)))) + return 0; + + /* FIXME: get shape */ + { + int num; + Ecore_X_Rectangle *rects; + + num = 0; + rects = ecore_x_window_shape_rectangles_get(s->win, &num); + if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0; + num = 0; + rects = ecore_x_window_shape_input_rectangles_get(s->win, &num); + if (!_inside_rects(s, x, y, bx, by, rects, num)) return 0; + } + + if (s->children) + { + int skipit = 0; + + for (i = s->children_num - 1; i >= 0; --i) + { + if (!s->children[i]) + continue; + + skipit = 0; + if (skip) + for (j = 0; j < skip_num; j++) + { + if (s->children[i]->win == skip[j]) + { + skipit = 1; + goto onward; + } + } + +onward: + if (!skipit) + if ((child = + _ecore_x_window_shadow_tree_at_xy_get_shadow(s-> + children[i + ], wx, wy, + x, y, skip, + skip_num))) + return child; + } + } + + return s->win; +} /* _ecore_x_window_shadow_tree_at_xy_get_shadow */ + +static Window +_ecore_x_window_shadow_tree_at_xy_get(Window base, + int bx, + int by, + int x, + int y, + Ecore_X_Window *skip, + int skip_num) +{ + Shadow *s; + + if (!shadow_base) + { + _ecore_x_window_tree_shadow_populate(); + if (!shadow_base) + return 0; + } + + s = _ecore_x_window_shadow_tree_find(base); + if (!s) + return 0; + + return _ecore_x_window_shadow_tree_at_xy_get_shadow(s, + bx, + by, + x, + y, + skip, + skip_num); +} /* _ecore_x_window_shadow_tree_at_xy_get */ + +/** + * Retrieves the top, visible window at the given location, + * but skips the windows in the list. This uses a shadow tree built from the + * window tree that is only updated the first time + * ecore_x_window_shadow_tree_at_xy_with_skip_get() is called, or the next time + * it is called after a ecore_x_window_shadow_tree_flush() + * @param base The base window to start searching from (normally root). + * @param x The given X position. + * @param y The given Y position. + * @return The window at that position. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI Ecore_X_Window +ecore_x_window_shadow_tree_at_xy_with_skip_get(Ecore_X_Window base, + int x, + int y, + Ecore_X_Window *skip, + int skip_num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return _ecore_x_window_shadow_tree_at_xy_get(base, + 0, + 0, + x, + y, + skip, + skip_num); +} /* ecore_x_window_shadow_tree_at_xy_with_skip_get */ + +/** + * Retrieves the parent window a given window has. This uses the shadow window + * tree. + * @param root The root window of @p win - if 0, this will be automatically determined with extra processing overhead + * @param win The window to get the parent window of + * @return The parent window of @p win + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI Ecore_X_Window +ecore_x_window_shadow_parent_get(Ecore_X_Window root __UNUSED__, + Ecore_X_Window win) +{ + Shadow *s; + int i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!shadow_base) + { + _ecore_x_window_tree_shadow_populate(); + if (!shadow_base) + return 0; + } + + for (i = 0; i < shadow_num; i++) + { + if (!shadow_base[i]) + continue; + + s = _ecore_x_window_shadow_tree_find_shadow(shadow_base[i], win); + if (s) + { + if (!s->parent) + return 0; + + return s->parent->win; + } + } + return 0; +} /* ecore_x_window_shadow_parent_get */ + +/** + * Flushes the window shadow tree so nothing is stored. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI void +ecore_x_window_shadow_tree_flush(void) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + _ecore_x_window_tree_shadow_free(); +} /* ecore_x_window_shadow_tree_flush */ + +/** + * Retrieves the root window a given window is on. + * @param win The window to get the root window of + * @return The root window of @p win + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI Ecore_X_Window +ecore_x_window_root_get(Ecore_X_Window win) +{ + XWindowAttributes att; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) + return 0; + + return att.root; +} /* ecore_x_window_root_get */ + +static Window +_ecore_x_window_at_xy_get(Window base, + int bx, + int by, + int x, + int y, + Ecore_X_Window *skip, + int skip_num) +{ + Window *list = NULL; + Window parent_win = 0, child = 0, root_win = 0; + int i, j, wx, wy, ww, wh; + unsigned int num; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!ecore_x_window_visible_get(base)) + return 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_geometry_get(base, &wx, &wy, &ww, &wh); + wx += bx; + wy += by; + + if (!((x >= wx) && (y >= wy) && (x < (wx + ww)) && (y < (wy + wh)))) + return 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!XQueryTree(_ecore_x_disp, base, &root_win, &parent_win, &list, &num)) + return base; + + if (list) + { + int skipit = 0; + + for (i = num - 1; i >= 0; --i) + { + skipit = 0; + + if (skip) + for (j = 0; j < skip_num; j++) + { + if (list[i] == skip[j]) + { + skipit = 1; + goto onward; + } + } + +onward: + if (!skipit) + if ((child = + _ecore_x_window_at_xy_get(list[i], wx, wy, x, y, skip, + skip_num))) + { + XFree(list); + return child; + } + } + XFree(list); + } + + return base; +} /* _ecore_x_window_at_xy_get */ + +/** + * Retrieves the top, visible window at the given location. + * @param x The given X position. + * @param y The given Y position. + * @return The window at that position. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI Ecore_X_Window +ecore_x_window_at_xy_get(int x, + int y) +{ + Ecore_X_Window win, root; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* FIXME: Proper function to determine current root/virtual root + * window missing here */ + root = DefaultRootWindow(_ecore_x_disp); + + ecore_x_grab(); + win = _ecore_x_window_at_xy_get(root, 0, 0, x, y, NULL, 0); + ecore_x_ungrab(); + + return win ? win : root; +} /* ecore_x_window_at_xy_get */ + +/** + * Retrieves the top, visible window at the given location, + * but skips the windows in the list. + * @param x The given X position. + * @param y The given Y position. + * @return The window at that position. + * @ingroup Ecore_X_Window_Geometry_Group + */ +EAPI Ecore_X_Window +ecore_x_window_at_xy_with_skip_get(int x, + int y, + Ecore_X_Window *skip, + int skip_num) +{ + Ecore_X_Window win, root; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* FIXME: Proper function to determine current root/virtual root + * window missing here */ + root = DefaultRootWindow(_ecore_x_disp); + + ecore_x_grab(); + win = _ecore_x_window_at_xy_get(root, 0, 0, x, y, skip, skip_num); + ecore_x_ungrab(); + + return win ? win : root; +} /* ecore_x_window_at_xy_with_skip_get */ + +EAPI Ecore_X_Window +ecore_x_window_at_xy_begin_get(Ecore_X_Window begin, + int x, + int y) +{ + Ecore_X_Window win; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_grab(); + win = _ecore_x_window_at_xy_get(begin, 0, 0, x, y, NULL, 0); + ecore_x_ungrab(); + + return win ? win : begin; +} /* ecore_x_window_at_xy_begin_get */ + +/** + * Retrieves the parent window of the given window. + * @param win The given window. + * @return The parent window of @p win. + * @ingroup Ecore_X_Window_Parent_Group + */ +EAPI Ecore_X_Window +ecore_x_window_parent_get(Ecore_X_Window win) +{ + Window root, parent, *children = NULL; + unsigned int num; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!XQueryTree(_ecore_x_disp, win, &root, &parent, &children, &num)) + return 0; + + if (children) + XFree(children); + + return parent; +} /* ecore_x_window_parent_get */ + +/** + * Sets the background color of the given window. + * @param win The given window + * @param r red value (0...65536, 16 bits) + * @param g green value (0...65536, 16 bits) + * @param b blue value (0...65536, 16 bits) + */ +EAPI void +ecore_x_window_background_color_set(Ecore_X_Window win, + unsigned short r, + unsigned short g, + unsigned short b) +{ + XSetWindowAttributes attr; + Colormap map; + XColor col; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + col.red = r; + col.green = g; + col.blue = b; + + map = DefaultColormap(_ecore_x_disp, DefaultScreen(_ecore_x_disp)); + XAllocColor(_ecore_x_disp, map, &col); + + attr.background_pixel = col.pixel; + XChangeWindowAttributes(_ecore_x_disp, win, CWBackPixel, &attr); +} /* ecore_x_window_background_color_set */ + +EAPI void +ecore_x_window_gravity_set(Ecore_X_Window win, + Ecore_X_Gravity grav) +{ + XSetWindowAttributes att; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + att.win_gravity = grav; + XChangeWindowAttributes(_ecore_x_disp, win, CWWinGravity, &att); +} /* ecore_x_window_gravity_set */ + +EAPI void +ecore_x_window_pixel_gravity_set(Ecore_X_Window win, + Ecore_X_Gravity grav) +{ + XSetWindowAttributes att; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + att.bit_gravity = grav; + XChangeWindowAttributes(_ecore_x_disp, win, CWBitGravity, &att); +} /* ecore_x_window_pixel_gravity_set */ + +EAPI void +ecore_x_window_pixmap_set(Ecore_X_Window win, + Ecore_X_Pixmap pmap) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XSetWindowBackgroundPixmap(_ecore_x_disp, win, pmap); +} /* ecore_x_window_pixmap_set */ + +EAPI void +ecore_x_window_area_clear(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XClearArea(_ecore_x_disp, win, x, y, w, h, False); +} /* ecore_x_window_area_clear */ + +EAPI void +ecore_x_window_area_expose(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XClearArea(_ecore_x_disp, win, x, y, w, h, True); +} /* ecore_x_window_area_expose */ + +EAPI void +ecore_x_window_override_set(Ecore_X_Window win, + Eina_Bool override) +{ + XSetWindowAttributes att; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + att.override_redirect = override; + XChangeWindowAttributes(_ecore_x_disp, win, CWOverrideRedirect, &att); +} /* ecore_x_window_override_set */ + +#ifdef ECORE_XRENDER +static Ecore_X_Window +_ecore_x_window_argb_internal_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h, + Eina_Bool override, + Eina_Bool saveunder) +{ + Window win; + XSetWindowAttributes attr; + XWindowAttributes att; + XVisualInfo *xvi; + XVisualInfo vi_in; + int nvi, i, scr = 0; + XRenderPictFormat *fmt; + Visual *vis; + + if (parent == 0) + { + parent = DefaultRootWindow(_ecore_x_disp); + scr = DefaultScreen(_ecore_x_disp); + } + else + { + /* ewww - round trip */ + XGetWindowAttributes(_ecore_x_disp, parent, &att); + for (i = 0; i < ScreenCount(_ecore_x_disp); i++) + { + if (att.screen == ScreenOfDisplay(_ecore_x_disp, i)) + { + scr = i; + break; + } + } + } + + vi_in.screen = scr; + vi_in.depth = 32; + vi_in.class = TrueColor; + xvi = XGetVisualInfo(_ecore_x_disp, + VisualScreenMask | + VisualDepthMask | + VisualClassMask, + &vi_in, + &nvi); + if (!xvi) + return 0; + + vis = NULL; + for (i = 0; i < nvi; i++) + { + fmt = XRenderFindVisualFormat(_ecore_x_disp, xvi[i].visual); + if ((fmt->type == PictTypeDirect) && (fmt->direct.alphaMask)) + { + vis = xvi[i].visual; + break; + } + } + XFree (xvi); + + attr.backing_store = NotUseful; + attr.override_redirect = override; + attr.colormap = XCreateColormap(_ecore_x_disp, parent, + vis, AllocNone); + attr.border_pixel = 0; + attr.background_pixmap = None; + attr.bit_gravity = NorthWestGravity; + attr.win_gravity = NorthWestGravity; + attr.save_under = saveunder; + attr.do_not_propagate_mask = NoEventMask; + attr.event_mask = KeyPressMask | + KeyReleaseMask | + ButtonPressMask | + ButtonReleaseMask | + EnterWindowMask | + LeaveWindowMask | + PointerMotionMask | + ExposureMask | + VisibilityChangeMask | + StructureNotifyMask | + FocusChangeMask | + PropertyChangeMask | + ColormapChangeMask; + win = XCreateWindow(_ecore_x_disp, parent, + x, y, w, h, 0, + 32, + InputOutput, + vis, + CWBackingStore | + CWOverrideRedirect | + CWColormap | + CWBorderPixel | + CWBackPixmap | + CWSaveUnder | + CWDontPropagate | + CWEventMask | + CWBitGravity | + CWWinGravity, + &attr); + XFreeColormap(_ecore_x_disp, attr.colormap); + + if (parent == DefaultRootWindow(_ecore_x_disp)) + ecore_x_window_defaults_set(win); + + return win; +} /* _ecore_x_window_argb_internal_new */ + +#endif /* ifdef ECORE_XRENDER */ + +EAPI int +ecore_x_window_argb_get(Ecore_X_Window win) +{ +#ifdef ECORE_XRENDER + XWindowAttributes att; + XRenderPictFormat *fmt; + + att.visual = 0; + if (!XGetWindowAttributes(_ecore_x_disp, win, &att)) + return 0; + + fmt = XRenderFindVisualFormat(_ecore_x_disp, att.visual); + if (!fmt) + return 0; + + if ((fmt->type == PictTypeDirect) && (fmt->direct.alphaMask)) + return 1; + + return 0; +#else /* ifdef ECORE_XRENDER */ + return 0; +#endif /* ifdef ECORE_XRENDER */ +} /* ecore_x_window_argb_get */ + +/** + * Creates a new window. + * @param parent The parent window to use. If @p parent is @c 0, the root + * window of the default display is used. + * @param x X position. + * @param y Y position. + * @param w Width. + * @param h Height. + * @return The new window handle. + * @ingroup Ecore_X_Window_Create_Group + */ +EAPI Ecore_X_Window +ecore_x_window_manager_argb_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h) +{ +#ifdef ECORE_XRENDER + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 1, 0); +#else /* ifdef ECORE_XRENDER */ + return 0; +#endif /* ifdef ECORE_XRENDER */ +} /* ecore_x_window_manager_argb_new */ + +/** + * Creates a new window. + * @param parent The parent window to use. If @p parent is @c 0, the root + * window of the default display is used. + * @param x X position. + * @param y Y position. + * @param w Width. + * @param h Height. + * @return The new window handle. + * @ingroup Ecore_X_Window_Create_Group + */ +EAPI Ecore_X_Window +ecore_x_window_argb_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h) +{ +#ifdef ECORE_XRENDER + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 0, 0); +#else /* ifdef ECORE_XRENDER */ + return 0; +#endif /* ifdef ECORE_XRENDER */ +} /* ecore_x_window_argb_new */ + +/** + * Creates a window with the override redirect attribute set to @c True. + * @param parent The parent window to use. If @p parent is @c 0, the root + * window of the default display is used. + * @param x X position. + * @param y Y position. + * @param w Width. + * @param h Height. + * @return The new window handle. + * @ingroup Ecore_X_Window_Create_Group + */ +EAPI Ecore_X_Window +ecore_x_window_override_argb_new(Ecore_X_Window parent, + int x, + int y, + int w, + int h) +{ +#ifdef ECORE_XRENDER + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return _ecore_x_window_argb_internal_new(parent, x, y, w, h, 1, 0); +#else /* ifdef ECORE_XRENDER */ + return 0; +#endif /* ifdef ECORE_XRENDER */ +} /* ecore_x_window_override_argb_new */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c new file mode 100644 index 0000000..8d5c757 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_prop.c @@ -0,0 +1,750 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include +#include + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include "Ecore_X_Atoms.h" +#include +#include + +#define _ATOM_SET_CARD32(win, atom, p_val, cnt) \ + XChangeProperty(_ecore_x_disp, win, atom, XA_CARDINAL, 32, PropModeReplace, \ + (unsigned char *)p_val, cnt) + +/* + * Set CARD32 (array) property + */ +EAPI void +ecore_x_window_prop_card32_set(Ecore_X_Window win, + Ecore_X_Atom atom, + unsigned int *val, + unsigned int num) +{ +#if SIZEOF_INT == SIZEOF_LONG + _ATOM_SET_CARD32(win, atom, val, num); +#else /* if SIZEOF_INT == SIZEOF_LONG */ + long *v2; + unsigned int i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + v2 = malloc(num * sizeof(long)); + if (!v2) + return; + + for (i = 0; i < num; i++) + v2[i] = val[i]; + _ATOM_SET_CARD32(win, atom, v2, num); + free(v2); +#endif /* if SIZEOF_INT == SIZEOF_LONG */ +} /* ecore_x_window_prop_card32_set */ + +/* + * Get CARD32 (array) property + * + * At most len items are returned in val. + * If the property was successfully fetched the number of items stored in + * val is returned, otherwise -1 is returned. + * Note: Return value 0 means that the property exists but has no elements. + */ +EAPI int +ecore_x_window_prop_card32_get(Ecore_X_Window win, + Ecore_X_Atom atom, + unsigned int *val, + unsigned int len) +{ + unsigned char *prop_ret; + Atom type_ret; + unsigned long bytes_after, num_ret; + int format_ret; + unsigned int i; + int num; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + prop_ret = NULL; + if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False, + XA_CARDINAL, &type_ret, &format_ret, &num_ret, + &bytes_after, &prop_ret) != Success) + return -1; + + if (type_ret != XA_CARDINAL || format_ret != 32) + num = -1; + else if (num_ret == 0 || !prop_ret) + num = 0; + else + { + if (num_ret < len) + len = num_ret; + + for (i = 0; i < len; i++) + val[i] = ((unsigned long *)prop_ret)[i]; + num = len; + } + + if (prop_ret) + XFree(prop_ret); + + return num; +} /* ecore_x_window_prop_card32_get */ + +/* + * Get CARD32 (array) property of any length + * + * If the property was successfully fetched the number of items stored in + * val is returned, otherwise -1 is returned. + * Note: Return value 0 means that the property exists but has no elements. + */ +EAPI int +ecore_x_window_prop_card32_list_get(Ecore_X_Window win, + Ecore_X_Atom atom, + unsigned int **plst) +{ + unsigned char *prop_ret; + Atom type_ret; + unsigned long bytes_after, num_ret; + int format_ret; + unsigned int i, *val; + int num; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + *plst = NULL; + prop_ret = NULL; + if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False, + XA_CARDINAL, &type_ret, &format_ret, &num_ret, + &bytes_after, &prop_ret) != Success) + return -1; + + if ((type_ret != XA_CARDINAL) || (format_ret != 32)) + num = -1; + else if ((num_ret == 0) || (!prop_ret)) + num = 0; + else + { + val = malloc(num_ret * sizeof(unsigned int)); + if (!val) + { + if (prop_ret) XFree(prop_ret); + return -1; + } + for (i = 0; i < num_ret; i++) + val[i] = ((unsigned long *)prop_ret)[i]; + num = num_ret; + *plst = val; + } + + if (prop_ret) + XFree(prop_ret); + + return num; +} /* ecore_x_window_prop_card32_list_get */ + +/* + * Set X ID (array) property + */ +EAPI void +ecore_x_window_prop_xid_set(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID *lst, + unsigned int num) +{ +#if SIZEOF_INT == SIZEOF_LONG + XChangeProperty(_ecore_x_disp, win, atom, type, 32, PropModeReplace, + (unsigned char *)lst, num); +#else /* if SIZEOF_INT == SIZEOF_LONG */ + unsigned long *pl; + unsigned int i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + pl = malloc(num * sizeof(long)); + if (!pl) + return; + + for (i = 0; i < num; i++) + pl[i] = lst[i]; + XChangeProperty(_ecore_x_disp, win, atom, type, 32, PropModeReplace, + (unsigned char *)pl, num); + free(pl); +#endif /* if SIZEOF_INT == SIZEOF_LONG */ +} /* ecore_x_window_prop_xid_set */ + +/* + * Get X ID (array) property + * + * At most len items are returned in val. + * If the property was successfully fetched the number of items stored in + * val is returned, otherwise -1 is returned. + * Note: Return value 0 means that the property exists but has no elements. + */ +EAPI int +ecore_x_window_prop_xid_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID *lst, + unsigned int len) +{ + unsigned char *prop_ret; + Atom type_ret; + unsigned long bytes_after, num_ret; + int format_ret; + int num; + unsigned i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + prop_ret = NULL; + if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False, + type, &type_ret, &format_ret, &num_ret, + &bytes_after, &prop_ret) != Success) + return -1; + + if (type_ret != type || format_ret != 32) + num = -1; + else if (num_ret == 0 || !prop_ret) + num = 0; + else + { + if (num_ret < len) + len = num_ret; + + for (i = 0; i < len; i++) + lst[i] = ((unsigned long *)prop_ret)[i]; + num = len; + } + + if (prop_ret) + XFree(prop_ret); + + return num; +} /* ecore_x_window_prop_xid_get */ + +/* + * Get X ID (array) property + * + * If the property was successfully fetched the number of items stored in + * val is returned, otherwise -1 is returned. + * The returned array must be freed with free(). + * Note: Return value 0 means that the property exists but has no elements. + */ +EAPI int +ecore_x_window_prop_xid_list_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID **val) +{ + unsigned char *prop_ret; + Atom type_ret; + unsigned long bytes_after, num_ret; + int format_ret; + Ecore_X_Atom *alst; + int num; + unsigned i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + *val = NULL; + prop_ret = NULL; + if (XGetWindowProperty(_ecore_x_disp, win, atom, 0, 0x7fffffff, False, + type, &type_ret, &format_ret, &num_ret, + &bytes_after, &prop_ret) != Success) + return -1; + + if (type_ret != type || format_ret != 32) + num = -1; + else if (num_ret == 0 || !prop_ret) + num = 0; + else + { + alst = malloc(num_ret * sizeof(Ecore_X_ID)); + for (i = 0; i < num_ret; i++) + alst[i] = ((unsigned long *)prop_ret)[i]; + num = num_ret; + *val = alst; + } + + if (prop_ret) + XFree(prop_ret); + + return num; +} /* ecore_x_window_prop_xid_list_get */ + +/* + * Remove/add/toggle X ID list item. + */ +EAPI void +ecore_x_window_prop_xid_list_change(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom type, + Ecore_X_ID item, + int op) +{ + Ecore_X_ID *lst; + int i, num; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + num = ecore_x_window_prop_xid_list_get(win, atom, type, &lst); + if (num < 0) + { + return; /* Error - assuming invalid window */ + } + + /* Is it there? */ + for (i = 0; i < num; i++) + { + if (lst[i] == item) + break; + } + + if (i < num) + { + /* Was in list */ + if (op == ECORE_X_PROP_LIST_ADD) + goto done; /* Remove it */ + + num--; + for (; i < num; i++) + lst[i] = lst[i + 1]; + } + else + { + /* Was not in list */ + if (op == ECORE_X_PROP_LIST_REMOVE) + goto done; /* Add it */ + + num++; + lst = realloc(lst, num * sizeof(Ecore_X_ID)); + lst[i] = item; + } + + ecore_x_window_prop_xid_set(win, atom, type, lst, num); + +done: + if (lst) + free(lst); +} /* ecore_x_window_prop_xid_list_change */ + +/* + * Set Atom (array) property + */ +EAPI void +ecore_x_window_prop_atom_set(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom *lst, + unsigned int num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_xid_set(win, atom, XA_ATOM, lst, num); +} /* ecore_x_window_prop_atom_set */ + +/* + * Get Atom (array) property + * + * At most len items are returned in val. + * If the property was successfully fetched the number of items stored in + * val is returned, otherwise -1 is returned. + * Note: Return value 0 means that the property exists but has no elements. + */ +EAPI int +ecore_x_window_prop_atom_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom *lst, + unsigned int len) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return ecore_x_window_prop_xid_get(win, atom, XA_ATOM, lst, len); +} /* ecore_x_window_prop_atom_get */ + +/* + * Get Atom (array) property + * + * If the property was successfully fetched the number of items stored in + * val is returned, otherwise -1 is returned. + * The returned array must be freed with free(). + * Note: Return value 0 means that the property exists but has no elements. + */ +EAPI int +ecore_x_window_prop_atom_list_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom **plst) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return ecore_x_window_prop_xid_list_get(win, atom, XA_ATOM, plst); +} /* ecore_x_window_prop_atom_list_get */ + +/* + * Remove/add/toggle atom list item. + */ +EAPI void +ecore_x_window_prop_atom_list_change(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Atom item, + int op) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_xid_list_change(win, atom, XA_ATOM, item, op); +} /* ecore_x_window_prop_atom_list_change */ + +/* + * Set Window (array) property + */ +EAPI void +ecore_x_window_prop_window_set(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Window *lst, + unsigned int num) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ecore_x_window_prop_xid_set(win, atom, XA_WINDOW, lst, num); +} /* ecore_x_window_prop_window_set */ + +/* + * Get Window (array) property + * + * At most len items are returned in val. + * If the property was successfully fetched the number of items stored in + * val is returned, otherwise -1 is returned. + * Note: Return value 0 means that the property exists but has no elements. + */ +EAPI int +ecore_x_window_prop_window_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Window *lst, + unsigned int len) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return ecore_x_window_prop_xid_get(win, atom, XA_WINDOW, lst, len); +} /* ecore_x_window_prop_window_get */ + +/* + * Get Window (array) property + * + * If the property was successfully fetched the number of items stored in + * val is returned, otherwise -1 is returned. + * The returned array must be freed with free(). + * Note: Return value 0 means that the property exists but has no elements. + */ +EAPI int +ecore_x_window_prop_window_list_get(Ecore_X_Window win, + Ecore_X_Atom atom, + Ecore_X_Window **plst) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return ecore_x_window_prop_xid_list_get(win, atom, XA_WINDOW, plst); +} /* ecore_x_window_prop_window_list_get */ + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI Ecore_X_Atom +ecore_x_window_prop_any_type(void) +{ + return AnyPropertyType; +} /* ecore_x_window_prop_any_type */ + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI void +ecore_x_window_prop_property_set(Ecore_X_Window win, + Ecore_X_Atom property, + Ecore_X_Atom type, + int size, + void *data, + int number) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (win == 0) + win = DefaultRootWindow(_ecore_x_disp); + + if (size != 32) + XChangeProperty(_ecore_x_disp, + win, + property, + type, + size, + PropModeReplace, + (unsigned char *)data, + number); + else + { + unsigned long *dat; + int i, *ptr; + + dat = malloc(sizeof(unsigned long) * number); + if (dat) + { + for (ptr = (int *)data, i = 0; i < number; i++) dat[i] = ptr[i]; + XChangeProperty(_ecore_x_disp, win, property, type, size, + PropModeReplace, (unsigned char *)dat, number); + free(dat); + } + } +} /* ecore_x_window_prop_property_set */ + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI int +ecore_x_window_prop_property_get(Ecore_X_Window win, + Ecore_X_Atom property, + Ecore_X_Atom type, + int size __UNUSED__, + unsigned char **data, + int *num) +{ + Atom type_ret = 0; + int ret, size_ret = 0; + unsigned long num_ret = 0, bytes = 0, i; + unsigned char *prop_ret = NULL; + + /* make sure these are initialized */ + if (num) + *num = 0; + + if (data) + *data = NULL; + else /* we can't store the retrieved data, so just return */ + return 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!win) + win = DefaultRootWindow(_ecore_x_disp); + + ret = XGetWindowProperty(_ecore_x_disp, win, property, 0, LONG_MAX, + False, type, &type_ret, &size_ret, + &num_ret, &bytes, &prop_ret); + + if (ret != Success) + return 0; + + if (!num_ret) + { + XFree(prop_ret); + return 0; + } + + if (!(*data = malloc(num_ret * size_ret / 8))) + { + XFree(prop_ret); + return 0; + } + + switch (size_ret) { + case 8: + for (i = 0; i < num_ret; i++) + (*data)[i] = prop_ret[i]; + break; + + case 16: + for (i = 0; i < num_ret; i++) + ((unsigned short *)*data)[i] = ((unsigned short *)prop_ret)[i]; + break; + + case 32: + for (i = 0; i < num_ret; i++) + ((unsigned int *)*data)[i] = ((unsigned long *)prop_ret)[i]; + break; + } /* switch */ + + XFree(prop_ret); + + if (num) + *num = num_ret; + + return size_ret; +} /* ecore_x_window_prop_property_get */ + +EAPI void +ecore_x_window_prop_property_del(Ecore_X_Window win, + Ecore_X_Atom property) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XDeleteProperty(_ecore_x_disp, win, property); +} /* ecore_x_window_prop_property_del */ + +EAPI Ecore_X_Atom * +ecore_x_window_prop_list(Ecore_X_Window win, + int *num_ret) +{ + Ecore_X_Atom *atoms; + Atom *atom_ret; + int num = 0, i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (num_ret) + *num_ret = 0; + + atom_ret = XListProperties(_ecore_x_disp, win, &num); + if (!atom_ret) + return NULL; + + atoms = malloc(num * sizeof(Ecore_X_Atom)); + if (atoms) + { + for (i = 0; i < num; i++) atoms[i] = atom_ret[i]; + if (num_ret) + *num_ret = num; + } + + XFree(atom_ret); + return atoms; +} /* ecore_x_window_prop_list */ + +/** + * Set a window string property. + * @param win The window + * @param type The property + * @param str The string + * + * Set a window string property + */ +EAPI void +ecore_x_window_prop_string_set(Ecore_X_Window win, + Ecore_X_Atom type, + const char *str) +{ + XTextProperty xtp; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (win == 0) + win = DefaultRootWindow(_ecore_x_disp); + + xtp.value = (unsigned char *)str; + xtp.format = 8; + xtp.encoding = ECORE_X_ATOM_UTF8_STRING; + xtp.nitems = strlen(str); + XSetTextProperty(_ecore_x_disp, win, &xtp, type); +} /* ecore_x_window_prop_string_set */ + +/** + * Get a window string property. + * @param win The window + * @param type The property + * + * Return window string property of a window. String must be free'd when done. + */ +EAPI char * +ecore_x_window_prop_string_get(Ecore_X_Window win, + Ecore_X_Atom type) +{ + XTextProperty xtp; + char *str = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (win == 0) + win = DefaultRootWindow(_ecore_x_disp); + + if (XGetTextProperty(_ecore_x_disp, win, &xtp, type)) + { + int items; + char **list = NULL; + Status s; + + if (xtp.encoding == ECORE_X_ATOM_UTF8_STRING) + str = strdup((char *)xtp.value); + else + { +#ifdef X_HAVE_UTF8_STRING + s = Xutf8TextPropertyToTextList(_ecore_x_disp, &xtp, + &list, &items); +#else /* ifdef X_HAVE_UTF8_STRING */ + s = XmbTextPropertyToTextList(_ecore_x_disp, &xtp, + &list, &items); +#endif /* ifdef X_HAVE_UTF8_STRING */ + if ((s == XLocaleNotSupported) || + (s == XNoMemory) || (s == XConverterNotFound)) + str = strdup((char *)xtp.value); + else if ((s >= Success) && (items > 0)) + str = strdup(list[0]); + + if (list) + XFreeStringList(list); + } + + XFree(xtp.value); + } + + return str; +} /* ecore_x_window_prop_string_get */ + +EAPI Eina_Bool +ecore_x_window_prop_protocol_isset(Ecore_X_Window win, + Ecore_X_WM_Protocol protocol) +{ + Atom proto, *protos = NULL; + int i, protos_count = 0; + Eina_Bool ret = EINA_FALSE; + + /* check for invalid values */ + if (protocol >= ECORE_X_WM_PROTOCOL_NUM) + return EINA_FALSE; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + proto = _ecore_x_atoms_wm_protocols[protocol]; + + if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count)) + return ret; + + for (i = 0; i < protos_count; i++) + if (protos[i] == proto) + { + ret = EINA_TRUE; + break; + } + + XFree(protos); + + return ret; +} /* ecore_x_window_prop_protocol_isset */ + +/** + * To be documented. + * + * FIXME: To be fixed. + */ +EAPI Ecore_X_WM_Protocol * +ecore_x_window_prop_protocol_list_get(Ecore_X_Window win, + int *num_ret) +{ + Atom *protos = NULL; + int i, protos_count = 0; + Ecore_X_WM_Protocol *prot_ret = NULL; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!XGetWMProtocols(_ecore_x_disp, win, &protos, &protos_count)) + return NULL; + + if ((!protos) || (protos_count <= 0)) + return NULL; + + prot_ret = calloc(1, protos_count * sizeof(Ecore_X_WM_Protocol)); + if (!prot_ret) + { + XFree(protos); + return NULL; + } + + for (i = 0; i < protos_count; i++) + { + Ecore_X_WM_Protocol j; + + prot_ret[i] = -1; + for (j = 0; j < ECORE_X_WM_PROTOCOL_NUM; j++) + { + if (_ecore_x_atoms_wm_protocols[j] == protos[i]) + prot_ret[i] = j; + } + } + XFree(protos); + *num_ret = protos_count; + return prot_ret; +} /* ecore_x_window_prop_protocol_list_get */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c new file mode 100644 index 0000000..2e8f8ce --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_window_shape.c @@ -0,0 +1,658 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" + +/** + * @defgroup Ecore_X_Window_Shape X Window Shape Functions + * + * These functions use the shape extension of the X server to change + * shape of given windows. + */ + +/** + * Sets the shape of the given window to that given by the pixmap @p mask. + * @param win The given window. + * @param mask A 2-bit depth pixmap that provides the new shape of the + * window. + * @ingroup Ecore_X_Window_Shape + */ +EAPI void +ecore_x_window_shape_mask_set(Ecore_X_Window win, + Ecore_X_Pixmap mask) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XShapeCombineMask(_ecore_x_disp, win, ShapeBounding, 0, 0, mask, ShapeSet); +} /* ecore_x_window_shape_mask_set */ + +/** + * Sets the input shape of the given window to that given by the pixmap @p mask. + * @param win The given window. + * @param mask A 1-bit depth pixmap that provides the new input shape of the + * window. + * @ingroup Ecore_X_Window_Shape + */ +EAPI void +ecore_x_window_shape_input_mask_set(Ecore_X_Window win, + Ecore_X_Pixmap mask) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); +#ifdef ShapeInput + XShapeCombineMask(_ecore_x_disp, win, ShapeInput, 0, 0, mask, ShapeSet); +#else /* ifdef ShapeInput */ + return; + win = mask = 0; +#endif /* ifdef ShapeInput */ +} /* ecore_x_window_shape_input_mask_set */ + +EAPI void +ecore_x_window_shape_window_set(Ecore_X_Window win, + Ecore_X_Window shape_win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XShapeCombineShape(_ecore_x_disp, + win, + ShapeBounding, + 0, + 0, + shape_win, + ShapeBounding, + ShapeSet); +} /* ecore_x_window_shape_window_set */ + +EAPI void +ecore_x_window_shape_input_window_set(Ecore_X_Window win, + Ecore_X_Window shape_win) +{ +#ifdef ShapeInput + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XShapeCombineShape(_ecore_x_disp, + win, + ShapeInput, + 0, + 0, + shape_win, + ShapeInput, + ShapeSet); +#else + return; + win = shape_win = 0; +#endif +} /* ecore_x_window_shape_input_window_set */ + +EAPI void +ecore_x_window_shape_window_set_xy(Ecore_X_Window win, + Ecore_X_Window shape_win, + int x, + int y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XShapeCombineShape(_ecore_x_disp, + win, + ShapeBounding, + x, + y, + shape_win, + ShapeBounding, + ShapeSet); +} /* ecore_x_window_shape_window_set_xy */ + +EAPI void +ecore_x_window_shape_input_window_set_xy(Ecore_X_Window win, + Ecore_X_Window shape_win, + int x, + int y) +{ +#ifdef ShapeInput + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XShapeCombineShape(_ecore_x_disp, + win, + ShapeInput, + x, + y, + shape_win, + ShapeInput, + ShapeSet); +#else + return; + win = shape_win = x = y = 0; +#endif +} /* ecore_x_window_shape_input_window_set_xy */ + +EAPI void +ecore_x_window_shape_rectangle_set(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + XRectangle rect; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + XShapeCombineRectangles(_ecore_x_disp, + win, + ShapeBounding, + 0, + 0, + &rect, + 1, + ShapeSet, + Unsorted); +} /* ecore_x_window_shape_rectangle_set */ + +EAPI void +ecore_x_window_shape_input_rectangle_set(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ +#ifdef ShapeInput + XRectangle rect; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + XShapeCombineRectangles(_ecore_x_disp, + win, + ShapeInput, + 0, + 0, + &rect, + 1, + ShapeSet, + Unsorted); +#else + return; + win = x = y = w = h = 0; +#endif +} /* ecore_x_window_shape_input_rectangle_set */ + +EAPI void +ecore_x_window_shape_rectangles_set(Ecore_X_Window win, + Ecore_X_Rectangle *rects, + int num) +{ +#ifdef ShapeInput + XRectangle *rect = NULL; + int i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!rects) return; + if (num > 0) + { + rect = malloc(sizeof(XRectangle) * num); + if (!rect) return; + for (i = 0; i < num; i++) + { + rect[i].x = rects[i].x; + rect[i].y = rects[i].y; + rect[i].width = rects[i].width; + rect[i].height = rects[i].height; + } + } + XShapeCombineRectangles(_ecore_x_disp, + win, + ShapeBounding, + 0, + 0, + rect, + num, + ShapeSet, + Unsorted); + if (rect) free(rect); +#else + return; + win = rects = num = 0; +#endif +} /* ecore_x_window_shape_rectangles_set */ + +EAPI void +ecore_x_window_shape_input_rectangles_set(Ecore_X_Window win, + Ecore_X_Rectangle *rects, + int num) +{ +#ifdef ShapeInput + XRectangle *rect = NULL; + int i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!rects) return; + if (num > 0) + { + rect = malloc(sizeof(XRectangle) * num); + if (!rect) return; + for (i = 0; i < num; i++) + { + rect[i].x = rects[i].x; + rect[i].y = rects[i].y; + rect[i].width = rects[i].width; + rect[i].height = rects[i].height; + } + } + XShapeCombineRectangles(_ecore_x_disp, + win, + ShapeInput, + 0, + 0, + rect, + num, + ShapeSet, + Unsorted); + if (rect) free(rect); +#else + return; + win = rects = num = 0; +#endif +} /* ecore_x_window_shape_input_rectangles_set */ + +EAPI void +ecore_x_window_shape_rectangle_subtract(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + XRectangle rect; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + XShapeCombineRectangles(_ecore_x_disp, + win, + ShapeBounding, + 0, + 0, + &rect, + 1, + ShapeSubtract, + Unsorted); +} /* ecore_x_window_shape_rectangle_subtract */ + +EAPI void +ecore_x_window_shape_input_rectangle_subtract(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ +#ifdef ShapeInput + XRectangle rect; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + XShapeCombineRectangles(_ecore_x_disp, + win, + ShapeInput, + 0, + 0, + &rect, + 1, + ShapeSubtract, + Unsorted); +#else + return; + win = x = y = w = h = 0; +#endif +} /* ecore_x_window_shape_input_rectangle_subtract */ + +EAPI void +ecore_x_window_shape_window_add(Ecore_X_Window win, + Ecore_X_Window shape_win) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XShapeCombineShape(_ecore_x_disp, + win, + ShapeBounding, + 0, + 0, + shape_win, + ShapeBounding, + ShapeUnion); +} /* ecore_x_window_shape_window_add */ + +EAPI void +ecore_x_window_shape_window_add_xy(Ecore_X_Window win, + Ecore_X_Window shape_win, + int x, + int y) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XShapeCombineShape(_ecore_x_disp, + win, + ShapeBounding, + x, + y, + shape_win, + ShapeBounding, + ShapeUnion); +} /* ecore_x_window_shape_window_add_xy */ + +EAPI void +ecore_x_window_shape_input_window_add_xy(Ecore_X_Window win, + Ecore_X_Window shape_win, + int x, + int y) +{ +#ifdef ShapeInput + LOGFN(__FILE__, __LINE__, __FUNCTION__); + XShapeCombineShape(_ecore_x_disp, + win, + ShapeInput, + x, + y, + shape_win, + ShapeInput, + ShapeUnion); +#else + return; + win = shape_win = x = y = 0; +#endif +} /* ecore_x_window_shape_input_window_add_xy */ + +EAPI void +ecore_x_window_shape_rectangle_add(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + XRectangle rect; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + XShapeCombineRectangles(_ecore_x_disp, + win, + ShapeBounding, + 0, + 0, + &rect, + 1, + ShapeUnion, + Unsorted); +} /* ecore_x_window_shape_rectangle_add */ + +EAPI void +ecore_x_window_shape_input_rectangle_add(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ +#ifdef ShapeInput + XRectangle rect; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + XShapeCombineRectangles(_ecore_x_disp, + win, + ShapeInput, + 0, + 0, + &rect, + 1, + ShapeUnion, + Unsorted); +#else + return; + win = x = y = w = h = 0; +#endif +} /* ecore_x_window_shape_input_rectangle_add */ + +EAPI void +ecore_x_window_shape_rectangle_clip(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ + XRectangle rect; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + XShapeCombineRectangles(_ecore_x_disp, + win, + ShapeBounding, + 0, + 0, + &rect, + 1, + ShapeIntersect, + Unsorted); +} /* ecore_x_window_shape_rectangle_clip */ + +EAPI void +ecore_x_window_shape_input_rectangle_clip(Ecore_X_Window win, + int x, + int y, + int w, + int h) +{ +#ifdef ShapeInput + XRectangle rect; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + rect.x = x; + rect.y = y; + rect.width = w; + rect.height = h; + XShapeCombineRectangles(_ecore_x_disp, + win, + ShapeInput, + 0, + 0, + &rect, + 1, + ShapeIntersect, + Unsorted); +#else + return; + win = x = y = w = h = 0; +#endif +} /* ecore_x_window_shape_input_rectangle_clip */ + +EAPI void +ecore_x_window_shape_rectangles_add(Ecore_X_Window win, + Ecore_X_Rectangle *rects, + int num) +{ + XRectangle *rect = NULL; + int i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (num > 0) + { + rect = malloc(sizeof(XRectangle) * num); + if (!rect) return; + for (i = 0; i < num; i++) + { + rect[i].x = rects[i].x; + rect[i].y = rects[i].y; + rect[i].width = rects[i].width; + rect[i].height = rects[i].height; + } + } + + XShapeCombineRectangles(_ecore_x_disp, + win, + ShapeBounding, + 0, + 0, + rect, + num, + ShapeUnion, + Unsorted); + if (rect) free(rect); +} /* ecore_x_window_shape_rectangles_add */ + +EAPI void +ecore_x_window_shape_input_rectangles_add(Ecore_X_Window win, + Ecore_X_Rectangle *rects, + int num) +{ +#ifdef ShapeInput + XRectangle *rect = NULL; + int i; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (num > 0) + { + rect = malloc(sizeof(XRectangle) * num); + if (!rect) return; + for (i = 0; i < num; i++) + { + rect[i].x = rects[i].x; + rect[i].y = rects[i].y; + rect[i].width = rects[i].width; + rect[i].height = rects[i].height; + } + } + + XShapeCombineRectangles(_ecore_x_disp, + win, + ShapeInput, + 0, + 0, + rect, + num, + ShapeUnion, + Unsorted); + if (rect) free(rect); +#else + return; + win = rects = num = 0; +#endif +} /* ecore_x_window_shape_input_rectangles_add */ + +EAPI Ecore_X_Rectangle * +ecore_x_window_shape_rectangles_get(Ecore_X_Window win, + int *num_ret) +{ + XRectangle *rect; + Ecore_X_Rectangle *rects = NULL; + int i, num = 0, ord; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeBounding, &num, &ord); + if (rect) + { + if (num < 1) + { + XFree(rect); + if (num_ret) *num_ret = 0; + return NULL; + } + rects = malloc(sizeof(Ecore_X_Rectangle) * num); + if (!rects) + { + XFree(rect); + if (num_ret) *num_ret = 0; + return NULL; + } + for (i = 0; i < num; i++) + { + rects[i].x = rect[i].x; + rects[i].y = rect[i].y; + rects[i].width = rect[i].width; + rects[i].height = rect[i].height; + } + XFree(rect); + } + if (num_ret) *num_ret = num; + return rects; +} /* ecore_x_window_shape_rectangles_get */ + +EAPI Ecore_X_Rectangle * +ecore_x_window_shape_input_rectangles_get(Ecore_X_Window win, + int *num_ret) +{ + Ecore_X_Rectangle *rects = NULL; +#ifdef ShapeInput + XRectangle *rect; + int i, num = 0, ord; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + rect = XShapeGetRectangles(_ecore_x_disp, win, ShapeInput, &num, &ord); + if (rect) + { + if (num < 1) + { + XFree(rect); + if (num_ret) *num_ret = 0; + return NULL; + } + rects = malloc(sizeof(Ecore_X_Rectangle) * num); + if (!rects) + { + XFree(rect); + if (num_ret) *num_ret = 0; + return NULL; + } + for (i = 0; i < num; i++) + { + rects[i].x = rect[i].x; + rects[i].y = rect[i].y; + rects[i].width = rect[i].width; + rects[i].height = rect[i].height; + } + XFree(rect); + } + if (num_ret) *num_ret = num; + return rects; +#else + // have to return fake shape input rect of size of window + Window dw; + unsigned int di; + + if (num_ret) *num_ret = 0; + rects = malloc(sizeof(Ecore_X_Rectangle)); + if (!rects) return NULL; + if (!XGetGeometry(_ecore_x_disp, win, &dw, + &(rects[0].x), &(rects[0].y), + &(rects[0].width), &(rects[0].height), + &di, &di)) + { + free(rects); + return NULL; + } + if (num_ret) *num_ret = 1; + return rects; +#endif +} /* ecore_x_window_shape_input_rectangles_get */ + +EAPI void +ecore_x_window_shape_events_select(Ecore_X_Window win, + Eina_Bool on) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (on) + XShapeSelectInput(_ecore_x_disp, win, ShapeNotifyMask); + else + XShapeSelectInput(_ecore_x_disp, win, 0); +} /* ecore_x_window_shape_events_select */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c new file mode 100644 index 0000000..38a81dd --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xi2.c @@ -0,0 +1,283 @@ +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" + +#ifdef ECORE_XI2 +#include "Ecore_Input.h" +#endif /* ifdef ECORE_XI2 */ + +int _ecore_x_xi2_opcode = -1; + +#ifndef XIPointerEmulated +#define XIPointerEmulated (1 << 16) +#endif + +#ifdef ECORE_XI2 +static XIDeviceInfo *_ecore_x_xi2_devs = NULL; +static int _ecore_x_xi2_num = 0; +#endif /* ifdef ECORE_XI2 */ + +void +_ecore_x_input_init(void) +{ +#ifdef ECORE_XI2 + int event, error; + int major = 2, minor = 0; + + if (!XQueryExtension(_ecore_x_disp, "XInputExtension", + &_ecore_x_xi2_opcode, &event, &error)) + { + _ecore_x_xi2_opcode = -1; + return; + } + + if (XIQueryVersion(_ecore_x_disp, &major, &minor) == BadRequest) + { + _ecore_x_xi2_opcode = -1; + return; + } + + _ecore_x_xi2_devs = XIQueryDevice(_ecore_x_disp, XIAllDevices, + &_ecore_x_xi2_num); +#endif /* ifdef ECORE_XI2 */ +} /* _ecore_x_input_init */ + +void +_ecore_x_input_shutdown(void) +{ +#ifdef ECORE_XI2 + if (_ecore_x_xi2_devs) + { + XIFreeDeviceInfo(_ecore_x_xi2_devs); + _ecore_x_xi2_devs = NULL; + } + + _ecore_x_xi2_num = 0; + _ecore_x_xi2_opcode = -1; +#endif /* ifdef ECORE_XI2 */ +} /* _ecore_x_input_shutdown */ + +void +_ecore_x_input_handler(XEvent *xevent) +{ +#ifdef ECORE_XI2 + XIDeviceEvent *evd = (XIDeviceEvent *)(xevent->xcookie.data); + int devid = evd->deviceid; + int i; + + if (_ecore_x_xi2_devs) + { + for (i = 0; i < _ecore_x_xi2_num; i++) + { + XIDeviceInfo *dev = &(_ecore_x_xi2_devs[i]); + + if (devid == dev->deviceid) + { + if (dev->use == XIMasterPointer) return; + if ((dev->use == XISlavePointer) && + (evd->flags & XIPointerEmulated)) return; + } + } + } + switch (xevent->xcookie.evtype) + { + case XI_Motion: + _ecore_mouse_move + (evd->time, + 0, // state + evd->event_x, evd->event_y, + evd->root_x, evd->root_y, + evd->event, + (evd->child ? evd->child : evd->event), + evd->root, + 1, // same_screen + devid, 1, 1, + 1.0, // pressure + 0.0, // angle + evd->event_x, evd->event_y, + evd->root_x, evd->root_y); + break; + + case XI_ButtonPress: + _ecore_mouse_button + (ECORE_EVENT_MOUSE_BUTTON_DOWN, + evd->time, + 0, // state + 0, // button + evd->event_x, evd->event_y, + evd->root_x, evd->root_y, + evd->event, + (evd->child ? evd->child : evd->event), + evd->root, + 1, // same_screen + devid, 1, 1, + 1.0, // pressure + 0.0, // angle + evd->event_x, evd->event_y, + evd->root_x, evd->root_y); + break; + + case XI_ButtonRelease: + _ecore_mouse_button + (ECORE_EVENT_MOUSE_BUTTON_UP, + evd->time, + 0, // state + 0, // button + evd->event_x, evd->event_y, + evd->root_x, evd->root_y, + evd->event, + (evd->child ? evd->child : evd->event), + evd->root, + 1, // same_screen + devid, 1, 1, + 1.0, // pressure + 0.0, // angle + evd->event_x, evd->event_y, + evd->root_x, evd->root_y); + break; + +#ifdef XI_TouchUpdate + case XI_TouchUpdate: + _ecore_mouse_move + (evd->time, + 0, // state + evd->event_x, evd->event_y, + evd->root_x, evd->root_y, + evd->event, + (evd->child ? evd->child : evd->event), + evd->root, + 1, // same_screen + devid, 1, 1, + 1.0, // pressure + 0.0, // angle + evd->event_x, evd->event_y, + evd->root_x, evd->root_y); + break; + +#endif +#ifdef XI_TouchBegin + case XI_TouchBegin: + _ecore_mouse_button + (ECORE_EVENT_MOUSE_BUTTON_DOWN, + evd->time, + 0, // state + 0, // button + evd->event_x, evd->event_y, + evd->root_x, evd->root_y, + evd->event, + (evd->child ? evd->child : evd->event), + evd->root, + 1, // same_screen + devid, 1, 1, + 1.0, // pressure + 0.0, // angle + evd->event_x, evd->event_y, + evd->root_x, evd->root_y); + break; + +#endif +#ifdef XI_TouchEnd + case XI_TouchEnd: + _ecore_mouse_button + (ECORE_EVENT_MOUSE_BUTTON_UP, + evd->time, + 0, // state + 0, // button + evd->event_x, evd->event_y, + evd->root_x, evd->root_y, + evd->event, + (evd->child ? evd->child : evd->event), + evd->root, + 1, // same_screen + devid, 1, 1, + 1.0, // pressure + 0.0, // angle + evd->event_x, evd->event_y, + evd->root_x, evd->root_y); + break; + +#endif + default: + break; + } /* switch */ +#endif /* ifdef ECORE_XI2 */ +} /* _ecore_x_input_handler */ + +EAPI Eina_Bool +ecore_x_input_multi_select(Ecore_X_Window win) +{ +#ifdef ECORE_XI2 + int i; + Eina_Bool find = EINA_FALSE; + + if (!_ecore_x_xi2_devs) + return 0; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + for (i = 0; i < _ecore_x_xi2_num; i++) + { + XIDeviceInfo *dev = &(_ecore_x_xi2_devs[i]); + + if (dev->use == XIFloatingSlave) + { + XIEventMask eventmask; + unsigned char mask[4] = { 0 }; + + eventmask.deviceid = dev->deviceid; + eventmask.mask_len = sizeof(mask); + eventmask.mask = mask; + XISetMask(mask, XI_ButtonPress); + XISetMask(mask, XI_ButtonRelease); + XISetMask(mask, XI_Motion); + XISelectEvents(_ecore_x_disp, win, &eventmask, 1); + find = EINA_TRUE; + } + else if (dev->use == XISlavePointer) + { + XIDeviceInfo *atdev = NULL; + int j; + + for (j = 0; j < _ecore_x_xi2_num; j++) + { + if (_ecore_x_xi2_devs[j].deviceid == dev->attachment) + atdev = &(_ecore_x_xi2_devs[j]); + } + if (((atdev) && (atdev->use != XIMasterPointer)) || + (!atdev)) + { + XIEventMask eventmask; + unsigned char mask[4] = { 0 }; + + eventmask.deviceid = dev->deviceid; + eventmask.mask_len = sizeof(mask); + eventmask.mask = mask; + XISetMask(mask, XI_ButtonPress); + XISetMask(mask, XI_ButtonRelease); + XISetMask(mask, XI_Motion); +# ifdef XI_TouchUpdate + XISetMask(mask, XI_TouchUpdate); +# endif +# ifdef XI_TouchBegin + XISetMask(mask, XI_TouchBegin); +# endif +# ifdef XI_TouchEnd + XISetMask(mask, XI_TouchEnd); +# endif + XISelectEvents(_ecore_x_disp, win, &eventmask, 1); + find = EINA_TRUE; + } + } + } + + return find; +#else /* ifdef ECORE_XI2 */ + return EINA_FALSE; +#endif /* ifdef ECORE_XI2 */ +} /* ecore_x_input_multi_select */ + diff --git a/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c new file mode 100644 index 0000000..1d956b7 --- /dev/null +++ b/libraries/ecore/src/lib/ecore_x/xlib/ecore_x_xinerama.c @@ -0,0 +1,91 @@ +/* + * Xinerama code + */ + +#ifdef HAVE_CONFIG_H +# include +#endif /* ifdef HAVE_CONFIG_H */ + +#include "Ecore.h" +#include "ecore_x_private.h" +#include "Ecore_X.h" +#include "Ecore_X_Atoms.h" + +#ifdef ECORE_XINERAMA +static XineramaScreenInfo *_xin_info = NULL; +static int _xin_scr_num = 0; +#endif /* ifdef ECORE_XINERAMA */ + +EAPI int +ecore_x_xinerama_screen_count_get(void) +{ +#ifdef ECORE_XINERAMA + int event_base, error_base; + + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (_xin_info) + XFree(_xin_info); + + _xin_info = NULL; + if (XineramaQueryExtension(_ecore_x_disp, &event_base, &error_base)) + { + _xin_info = XineramaQueryScreens(_ecore_x_disp, &_xin_scr_num); + if (_xin_info) + return _xin_scr_num; + } + +#endif /* ifdef ECORE_XINERAMA */ + return 0; +} /* ecore_x_xinerama_screen_count_get */ + +EAPI Eina_Bool +ecore_x_xinerama_screen_geometry_get(int screen, + int *x, + int *y, + int *w, + int *h) +{ + LOGFN(__FILE__, __LINE__, __FUNCTION__); +#ifdef ECORE_XINERAMA + if (_xin_info) + { + int i; + + for (i = 0; i < _xin_scr_num; i++) + { + if (_xin_info[i].screen_number == screen) + { + if (x) + *x = _xin_info[i].x_org; + + if (y) + *y = _xin_info[i].y_org; + + if (w) + *w = _xin_info[i].width; + + if (h) + *h = _xin_info[i].height; + + return EINA_TRUE; + } + } + } + +#endif /* ifdef ECORE_XINERAMA */ + if (x) + *x = 0; + + if (y) + *y = 0; + + if (w) + *w = DisplayWidth(_ecore_x_disp, 0); + + if (h) + *h = DisplayHeight(_ecore_x_disp, 0); + + return EINA_FALSE; + screen = 0; +} /* ecore_x_xinerama_screen_geometry_get */ + diff --git a/libraries/ecore/src/modules/Makefile.am b/libraries/ecore/src/modules/Makefile.am new file mode 100644 index 0000000..99a1469 --- /dev/null +++ b/libraries/ecore/src/modules/Makefile.am @@ -0,0 +1,3 @@ +MAINTAINERCLEANFILES = Makefile.in + +SUBDIRS = immodules diff --git a/libraries/ecore/src/modules/Makefile.in b/libraries/ecore/src/modules/Makefile.in new file mode 100644 index 0000000..62cbce2 --- /dev/null +++ b/libraries/ecore/src/modules/Makefile.in @@ -0,0 +1,795 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/modules +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +SUBDIRS = immodules +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/modules/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/modules/immodules/Makefile.am b/libraries/ecore/src/modules/immodules/Makefile.am new file mode 100644 index 0000000..6978672 --- /dev/null +++ b/libraries/ecore/src/modules/immodules/Makefile.am @@ -0,0 +1,7 @@ +MAINTAINERCLEANFILES = Makefile.in + +SUBDIRS = + +if BUILD_ECORE_IMF_XIM +SUBDIRS += xim +endif diff --git a/libraries/ecore/src/modules/immodules/Makefile.in b/libraries/ecore/src/modules/immodules/Makefile.in new file mode 100644 index 0000000..2ebe9fe --- /dev/null +++ b/libraries/ecore/src/modules/immodules/Makefile.in @@ -0,0 +1,796 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@BUILD_ECORE_IMF_XIM_TRUE@am__append_1 = xim +subdir = src/modules/immodules +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = xim +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +SUBDIRS = $(am__append_1) +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/immodules/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/modules/immodules/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +html-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-dvi-am: + +install-exec-am: + +install-html: install-html-recursive + +install-html-am: + +install-info: install-info-recursive + +install-info-am: + +install-man: + +install-pdf: install-pdf-recursive + +install-pdf-am: + +install-ps: install-ps-recursive + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \ + install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-pdf install-pdf-am \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/modules/immodules/xim/Makefile.am b/libraries/ecore/src/modules/immodules/xim/Makefile.am new file mode 100644 index 0000000..57a9068 --- /dev/null +++ b/libraries/ecore/src/modules/immodules/xim/Makefile.am @@ -0,0 +1,29 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir) \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_srcdir)/src/lib/ecore_x \ +-I$(top_srcdir)/src/lib/ecore_imf \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore_x \ +-I$(top_builddir)/src/lib/ecore_imf \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@x_cflags@ \ +@EINA_CFLAGS@ + +pkgdir = $(libdir)/ecore/immodules + +pkg_LTLIBRARIES = xim.la +xim_la_SOURCES = \ +ecore_imf_xim.c +xim_la_LIBADD = \ + $(top_builddir)/src/lib/ecore_imf/libecore_imf.la \ + $(top_builddir)/src/lib/ecore_x/libecore_x.la \ + @x_libs@ \ + @EINA_LIBS@ +xim_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version +xim_la_LIBTOOLFLAGS = --tag=disable-static diff --git a/libraries/ecore/src/modules/immodules/xim/Makefile.in b/libraries/ecore/src/modules/immodules/xim/Makefile.in new file mode 100644 index 0000000..ec58d4b --- /dev/null +++ b/libraries/ecore/src/modules/immodules/xim/Makefile.in @@ -0,0 +1,808 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/modules/immodules/xim +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(pkgdir)" +LTLIBRARIES = $(pkg_LTLIBRARIES) +xim_la_DEPENDENCIES = \ + $(top_builddir)/src/lib/ecore_imf/libecore_imf.la \ + $(top_builddir)/src/lib/ecore_x/libecore_x.la +am_xim_la_OBJECTS = xim_la-ecore_imf_xim.lo +xim_la_OBJECTS = $(am_xim_la_OBJECTS) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +xim_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(xim_la_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(xim_la_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(xim_la_SOURCES) +DIST_SOURCES = $(xim_la_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir) \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_input \ +-I$(top_srcdir)/src/lib/ecore_x \ +-I$(top_srcdir)/src/lib/ecore_imf \ +-I$(top_builddir)/src/lib/ecore \ +-I$(top_builddir)/src/lib/ecore_input \ +-I$(top_builddir)/src/lib/ecore_x \ +-I$(top_builddir)/src/lib/ecore_imf \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@x_cflags@ \ +@EINA_CFLAGS@ + +pkgdir = $(libdir)/ecore/immodules +pkg_LTLIBRARIES = xim.la +xim_la_SOURCES = \ +ecore_imf_xim.c + +xim_la_LIBADD = \ + $(top_builddir)/src/lib/ecore_imf/libecore_imf.la \ + $(top_builddir)/src/lib/ecore_x/libecore_x.la \ + @x_libs@ \ + @EINA_LIBS@ + +xim_la_LDFLAGS = -no-undefined @lt_enable_auto_import@ -module -avoid-version +xim_la_LIBTOOLFLAGS = --tag=disable-static +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/modules/immodules/xim/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/modules/immodules/xim/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +install-pkgLTLIBRARIES: $(pkg_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(pkgdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdir)" + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(pkgdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(pkgdir)"; \ + } + +uninstall-pkgLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(pkg_LTLIBRARIES)'; test -n "$(pkgdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(pkgdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(pkgdir)/$$f"; \ + done + +clean-pkgLTLIBRARIES: + -test -z "$(pkg_LTLIBRARIES)" || rm -f $(pkg_LTLIBRARIES) + @list='$(pkg_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +xim.la: $(xim_la_OBJECTS) $(xim_la_DEPENDENCIES) + $(AM_V_CCLD)$(xim_la_LINK) -rpath $(pkgdir) $(xim_la_OBJECTS) $(xim_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xim_la-ecore_imf_xim.Plo@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +xim_la-ecore_imf_xim.lo: ecore_imf_xim.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(xim_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT xim_la-ecore_imf_xim.lo -MD -MP -MF $(DEPDIR)/xim_la-ecore_imf_xim.Tpo -c -o xim_la-ecore_imf_xim.lo `test -f 'ecore_imf_xim.c' || echo '$(srcdir)/'`ecore_imf_xim.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/xim_la-ecore_imf_xim.Tpo $(DEPDIR)/xim_la-ecore_imf_xim.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ecore_imf_xim.c' object='xim_la-ecore_imf_xim.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) $(AM_V_lt) --tag=CC $(xim_la_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o xim_la-ecore_imf_xim.lo `test -f 'ecore_imf_xim.c' || echo '$(srcdir)/'`ecore_imf_xim.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LTLIBRARIES) +installdirs: + for dir in "$(DESTDIR)$(pkgdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pkgLTLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-pkgLTLIBRARIES + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-pkgLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pkgLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pkgLTLIBRARIES install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-pkgLTLIBRARIES + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c b/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c new file mode 100644 index 0000000..7c40606 --- /dev/null +++ b/libraries/ecore/src/modules/immodules/xim/ecore_imf_xim.c @@ -0,0 +1,1273 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef HAVE_CONFIG_H +# include +#endif + +#define CLAMP(x, low, high) (x > high) ? high : (x < low) ? low : x +#define _(x) x + +#ifdef ENABLE_XIM +static Eina_List *open_ims = NULL; +#endif + +typedef struct _XIM_Im_Info XIM_Im_Info; +struct _XIM_Im_Info +{ + Ecore_X_Window win; + char *locale; + XIM im; + Eina_List *ics; + Eina_Bool reconnecting; + XIMStyles *xim_styles; + Eina_Bool supports_string_conversion : 1; + Eina_Bool supports_cursor : 1; +}; + +typedef struct _Ecore_IMF_Context_Data Ecore_IMF_Context_Data; +struct _Ecore_IMF_Context_Data +{ + Ecore_X_Window win; + long mask; + XIC ic; /* Input context for composed characters */ + char *locale; + XIM_Im_Info *im_info; + int preedit_length; + int preedit_cursor; + Eina_Unicode *preedit_chars; + Eina_Bool use_preedit; + Eina_Bool finalizing; + Eina_Bool has_focus; + Eina_Bool in_toplevel; + + XIMCallback preedit_start_cb; + XIMCallback preedit_done_cb; + XIMCallback preedit_draw_cb; + XIMCallback preedit_caret_cb; +}; + +/* prototype */ +Ecore_IMF_Context_Data *imf_context_data_new(); +void imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data); + +#ifdef ENABLE_XIM +static void reinitialize_ic(Ecore_IMF_Context *ctx); +static void reinitialize_all_ics(XIM_Im_Info *info); +static void set_ic_client_window(Ecore_IMF_Context *ctx, + Ecore_X_Window window); +static int preedit_start_callback(XIC xic, + XPointer client_data, + XPointer call_data); +static void preedit_done_callback(XIC xic, + XPointer client_data, + XPointer call_data); +static int xim_text_to_utf8(Ecore_IMF_Context *ctx, + XIMText *xim_text, + char **text); +static void preedit_draw_callback(XIC xic, + XPointer client_data, + XIMPreeditDrawCallbackStruct *call_data); +static void preedit_caret_callback(XIC xic, + XPointer client_data, + XIMPreeditCaretCallbackStruct *call_data); +static XVaNestedList preedit_callback_set(Ecore_IMF_Context *ctx); +static XIC get_ic(Ecore_IMF_Context *ctx); +static XIM_Im_Info *get_im(Ecore_X_Window window, + char *locale); +static void xim_info_try_im(XIM_Im_Info *info); +static void xim_info_display_closed(Ecore_X_Display *display, + int is_error, + XIM_Im_Info *info); +static void xim_instantiate_callback(Display *display, + XPointer client_data, + XPointer call_data); +static void setup_im(XIM_Im_Info *info); +static void xim_destroy_callback(XIM xim, + XPointer client_data, + XPointer call_data); +#endif + +static void +_ecore_imf_context_xim_add(Ecore_IMF_Context *ctx) +{ + EINA_LOG_DBG("in"); +#ifdef ENABLE_XIM + Ecore_IMF_Context_Data *imf_context_data = NULL; + + imf_context_data = imf_context_data_new(); + if(!imf_context_data) return; + + imf_context_data->use_preedit = EINA_TRUE; + imf_context_data->finalizing = EINA_FALSE; + imf_context_data->has_focus = EINA_FALSE; + imf_context_data->in_toplevel = EINA_FALSE; + + ecore_imf_context_data_set(ctx, imf_context_data); +#endif +} + +static void +_ecore_imf_context_xim_del(Ecore_IMF_Context *ctx) +{ + EINA_LOG_DBG("in"); +#ifdef ENABLE_XIM + Ecore_IMF_Context_Data *imf_context_data; + imf_context_data = ecore_imf_context_data_get(ctx); + + imf_context_data->finalizing = EINA_TRUE; + if(imf_context_data->im_info && !imf_context_data->im_info->ics->next) + { + if(imf_context_data->im_info->reconnecting == EINA_TRUE) + { + Ecore_X_Display *dsp; + dsp = ecore_x_display_get(); + XUnregisterIMInstantiateCallback (dsp, + NULL, NULL, NULL, + xim_instantiate_callback, + (XPointer)imf_context_data->im_info); + } + else if(imf_context_data->im_info->im) + { + XIMCallback im_destroy_callback; + im_destroy_callback.client_data = NULL; + im_destroy_callback.callback = NULL; + XSetIMValues (imf_context_data->im_info->im, + XNDestroyCallback, &im_destroy_callback, + NULL); + } + } + + set_ic_client_window(ctx, 0); + + imf_context_data_destroy(imf_context_data); +#endif +} + +static void +_ecore_imf_context_xim_client_window_set(Ecore_IMF_Context *ctx, + void *window) +{ + EINA_LOG_DBG("in"); +#ifdef ENABLE_XIM + set_ic_client_window(ctx, (Ecore_X_Window)((Ecore_Window)window)); +#endif +} + +static void +_ecore_imf_context_xim_preedit_string_get(Ecore_IMF_Context *ctx, + char **str, + int *cursor_pos) +{ + EINA_LOG_DBG("in"); +#ifdef ENABLE_XIM + Ecore_IMF_Context_Data *imf_context_data; + char *utf8; + int len; + imf_context_data = ecore_imf_context_data_get(ctx); + if (imf_context_data->preedit_chars) + { + utf8 = eina_unicode_unicode_to_utf8(imf_context_data->preedit_chars, + &len); + if(str) + *str = utf8; + else + free(utf8); + } + else + { + if(str) + *str = NULL; + if(cursor_pos) + *cursor_pos = 0; + } + + if(cursor_pos) + *cursor_pos = imf_context_data->preedit_cursor; +#else + if(str) + *str = NULL; + if(cursor_pos) + *cursor_pos = 0; +#endif +} + +static void +_ecore_imf_context_xim_focus_in(Ecore_IMF_Context *ctx) +{ + EINA_LOG_DBG("in"); +#ifdef ENABLE_XIM + XIC ic; + Ecore_IMF_Context_Data *imf_context_data; + imf_context_data = ecore_imf_context_data_get(ctx); + ic = imf_context_data->ic; + imf_context_data->has_focus = EINA_TRUE; + if(ic) + { + char *str; + +#ifdef X_HAVE_UTF8_STRING + if ((str = Xutf8ResetIC(ic))) +#else + if ((str = XmbResetIC(ic))) +#endif + XFree(str); + + XSetICFocus(ic); + } +#endif +} + +static void +_ecore_imf_context_xim_focus_out(Ecore_IMF_Context *ctx) +{ + EINA_LOG_DBG("%s in", __FUNCTION__); +#ifdef ENABLE_XIM + XIC ic; + Ecore_IMF_Context_Data *imf_context_data; + imf_context_data = ecore_imf_context_data_get(ctx); + if(imf_context_data->has_focus == EINA_TRUE) + { + imf_context_data->has_focus = EINA_FALSE; + ic = imf_context_data->ic; + if(ic) + XUnsetICFocus(ic); + } +#endif +} + +static void +_ecore_imf_context_xim_reset(Ecore_IMF_Context *ctx) +{ + EINA_LOG_DBG("%s in", __FUNCTION__); +#ifdef ENABLE_XIM + XIC ic; + Ecore_IMF_Context_Data *imf_context_data; + char *result; + + /* restore conversion state after resetting ic later */ + XIMPreeditState preedit_state = XIMPreeditUnKnown; + XVaNestedList preedit_attr; + Eina_Bool have_preedit_state = EINA_FALSE; + + imf_context_data = ecore_imf_context_data_get(ctx); + ic = imf_context_data->ic; + if(!ic) + return; + + if(imf_context_data->preedit_length == 0) + return; + + preedit_attr = XVaCreateNestedList(0, + XNPreeditState, &preedit_state, + NULL); + if(!XGetICValues(ic, + XNPreeditAttributes, preedit_attr, + NULL)) + have_preedit_state = EINA_TRUE; + + XFree(preedit_attr); + + result = XmbResetIC(ic); + + preedit_attr = XVaCreateNestedList(0, + XNPreeditState, preedit_state, + NULL); + if(have_preedit_state) + XSetICValues(ic, + XNPreeditAttributes, preedit_attr, + NULL); + + XFree(preedit_attr); + + if(imf_context_data->preedit_length) + { + imf_context_data->preedit_length = 0; + free(imf_context_data->preedit_chars); + imf_context_data->preedit_chars = NULL; + ecore_imf_context_preedit_changed_event_add(ctx); + } + + if(result) + { + char *result_utf8 = strdup(result); + if(result_utf8) + { + ecore_imf_context_commit_event_add(ctx, result_utf8); + free(result_utf8); + } + } + + XFree (result); +#endif +} + +static void +_ecore_imf_context_xim_use_preedit_set(Ecore_IMF_Context *ctx, + Eina_Bool use_preedit) +{ + EINA_LOG_DBG("in"); +#ifdef ENABLE_XIM + Ecore_IMF_Context_Data *imf_context_data; + imf_context_data = ecore_imf_context_data_get(ctx); + + use_preedit = use_preedit != EINA_FALSE; + + if(imf_context_data->use_preedit != use_preedit) + { + imf_context_data->use_preedit = use_preedit; + reinitialize_ic(ctx); + } +#endif +} + +static void +_ecore_imf_context_xim_cursor_location_set (Ecore_IMF_Context *ctx, + int x, int y, int w, int h) +{ + EINA_LOG_DBG("%s in", __FUNCTION__); + +#ifdef ENABLE_XIM + Ecore_IMF_Context_Data *imf_context_data; + XIC ic; + XVaNestedList preedit_attr; + XPoint spot; + + imf_context_data = ecore_imf_context_data_get(ctx); + ic = imf_context_data->ic; + if (!ic) + return; + + spot.x = x; + spot.y = y + h; + + preedit_attr = XVaCreateNestedList (0, + XNSpotLocation, &spot, + NULL); + XSetICValues (ic, + XNPreeditAttributes, preedit_attr, + NULL); + + XFree(preedit_attr); +#endif + (void)(w); // yes w is unused, but only a bi-product of the algorithm +} + +#ifdef ENABLE_XIM +static unsigned int +_ecore_x_event_reverse_modifiers(unsigned int state) +{ + unsigned int modifiers = 0; + + /**< "Control" is pressed */ + if(state & ECORE_IMF_KEYBOARD_MODIFIER_CTRL) + modifiers |= ControlMask; + + /**< "Alt" is pressed */ + if(state & ECORE_IMF_KEYBOARD_MODIFIER_ALT) + modifiers |= Mod1Mask; + + /**< "Shift" is pressed */ + if(state & ECORE_IMF_KEYBOARD_MODIFIER_SHIFT) + modifiers |= ShiftMask; + + /**< "Win" (between "Ctrl" and "A */ + if(state & ECORE_IMF_KEYBOARD_MODIFIER_WIN) + modifiers |= Mod5Mask; + + return modifiers; +} + +static unsigned int +_ecore_x_event_reverse_locks(unsigned int state) +{ + unsigned int locks = 0; + + /**< "Num" lock is active */ + if(state & ECORE_IMF_KEYBOARD_LOCK_NUM) + locks |= Mod3Mask; + + if(state & ECORE_IMF_KEYBOARD_LOCK_CAPS) + locks |= LockMask; + +#if 0 /* FIXME: add mask. */ + if(state & ECORE_IMF_KEYBOARD_LOCK_SCROLL) + ; +#endif + + return locks; +} + +static KeyCode +_keycode_get(Ecore_X_Display *dsp, + const char *keyname) +{ + KeyCode keycode; + + // EINA_LOG_DBG("keyname:%s keysym:%lu", keyname, XStringToKeysym(keyname)); + if(strcmp(keyname, "Keycode-0") == 0) + { + keycode = 0; + } + else { + keycode = XKeysymToKeycode(dsp, XStringToKeysym(keyname)); + } + + return keycode; +} + +#endif + +static Eina_Bool +_ecore_imf_context_xim_filter_event(Ecore_IMF_Context *ctx, + Ecore_IMF_Event_Type type, + Ecore_IMF_Event *event) +{ + EINA_LOG_DBG("%s in", __FUNCTION__); +#ifdef ENABLE_XIM + Ecore_IMF_Context_Data *imf_context_data; + XIC ic; + + Ecore_X_Display *dsp; + Ecore_X_Window win; + + int val; + char compose_buffer[256]; + KeySym sym; + char *compose = NULL; + char *tmp = NULL; + Eina_Bool result = EINA_FALSE; + + imf_context_data = ecore_imf_context_data_get(ctx); + ic = imf_context_data->ic; + if(!ic) + { + ic = get_ic(ctx); + } + + if(type == ECORE_IMF_EVENT_KEY_DOWN) + { + XKeyPressedEvent xev; + Ecore_IMF_Event_Key_Down *ev = (Ecore_IMF_Event_Key_Down *)event; + EINA_LOG_DBG("ECORE_IMF_EVENT_KEY_DOWN"); + + dsp = ecore_x_display_get(); + win = imf_context_data->win; + + xev.type = KeyPress; + xev.serial = 0; /* hope it doesn't matter */ + xev.send_event = 0; + xev.display = dsp; + xev.window = win; + xev.root = ecore_x_window_root_get(win); + xev.subwindow = win; + xev.time = ev->timestamp; + xev.x = xev.x_root = 0; + xev.y = xev.y_root = 0; + xev.state = 0; + xev.state |= _ecore_x_event_reverse_modifiers(ev->modifiers); + xev.state |= _ecore_x_event_reverse_locks(ev->locks); + xev.keycode = _keycode_get(dsp, ev->keyname); + xev.same_screen = True; + + if(ic) + { + Status mbstatus; +#ifdef X_HAVE_UTF8_STRING + val = Xutf8LookupString(ic, + &xev, + compose_buffer, + sizeof(compose_buffer) - 1, + &sym, + &mbstatus); +#else /* ifdef X_HAVE_UTF8_STRING */ + val = XmbLookupString(ic, + &xev, + compose_buffer, + sizeof(compose_buffer) - 1, + &sym, + &mbstatus); +#endif /* ifdef X_HAVE_UTF8_STRING */ + if (mbstatus == XBufferOverflow) + { + tmp = malloc(sizeof (char) * (val + 1)); + if (!tmp) + { + return EINA_FALSE; + } + + compose = tmp; + +#ifdef X_HAVE_UTF8_STRING + val = Xutf8LookupString(ic, + (XKeyEvent *)&xev, + tmp, + val, + &sym, + &mbstatus); +#else /* ifdef X_HAVE_UTF8_STRING */ + val = XmbLookupString(ic, + (XKeyEvent *)&xev, + tmp, + val, + &sym, + &mbstatus); +#endif /* ifdef X_HAVE_UTF8_STRING */ + if (val > 0) + { + tmp[val] = '\0'; +#ifndef X_HAVE_UTF8_STRING + compose = eina_str_convert(nl_langinfo(CODESET), + "UTF-8", tmp); + free(tmp); + tmp = compose; +#endif /* ifndef X_HAVE_UTF8_STRING */ + } + else + compose = NULL; + } + else if (val > 0) + { + compose_buffer[val] = '\0'; +#ifdef X_HAVE_UTF8_STRING + compose = strdup(compose_buffer); +#else /* ifdef X_HAVE_UTF8_STRING */ + compose = eina_str_convert(nl_langinfo(CODESET), "UTF-8", + compose_buffer); +#endif /* ifdef X_HAVE_UTF8_STRING */ + } + } + else { + XComposeStatus status; + val = XLookupString(&xev, + compose_buffer, + sizeof(compose_buffer), + &sym, + &status); + if (val > 0) + { + compose_buffer[val] = '\0'; + compose = eina_str_convert(nl_langinfo(CODESET), + "UTF-8", compose_buffer); + } + } + + if(compose) + { + Eina_Unicode *unicode; + int len; + unicode = eina_unicode_utf8_to_unicode(compose, &len); + if(!unicode) abort(); + if(unicode[0] >= 0x20 && unicode[0] != 0x7f) + { + ecore_imf_context_commit_event_add(ctx, compose); + result = EINA_TRUE; + } + free(compose); + free(unicode); + } + } + + return result; +#else + return EINA_FALSE; +#endif +} + +static const Ecore_IMF_Context_Info xim_info = { + .id = "xim", + .description = _("X input method"), + .default_locales = "ko:ja:th:zh", + .canvas_type = "evas", + .canvas_required = 1, +}; + +static Ecore_IMF_Context_Class xim_class = { + .add = _ecore_imf_context_xim_add, + .del = _ecore_imf_context_xim_del, + .client_window_set = _ecore_imf_context_xim_client_window_set, + .client_canvas_set = NULL, + .show = NULL, + .hide = NULL, + .preedit_string_get = _ecore_imf_context_xim_preedit_string_get, + .focus_in = _ecore_imf_context_xim_focus_in, + .focus_out = _ecore_imf_context_xim_focus_out, + .reset = _ecore_imf_context_xim_reset, + .cursor_position_set = NULL, + .use_preedit_set = _ecore_imf_context_xim_use_preedit_set, + .input_mode_set = NULL, + .filter_event = _ecore_imf_context_xim_filter_event, + .preedit_string_with_attributes_get = NULL, + .prediction_allow_set = NULL, + .autocapital_type_set = NULL, + .control_panel_show = NULL, + .control_panel_hide = NULL, + .input_panel_layout_set = NULL, + .input_panel_layout_get = NULL, + .input_panel_language_set = NULL, + .input_panel_language_get = NULL, + .cursor_location_set = _ecore_imf_context_xim_cursor_location_set, +}; + +static Ecore_IMF_Context * +xim_imf_module_create(void) +{ + EINA_LOG_DBG("%s in", __FUNCTION__); + Ecore_IMF_Context *ctx = NULL; + + ctx = ecore_imf_context_new(&xim_class); + if(!ctx) + goto error; + + return ctx; + +error: + free(ctx); + return NULL; +} + +static Ecore_IMF_Context * +xim_imf_module_exit(void) +{ + return NULL; +} + +Eina_Bool +ecore_imf_xim_init(void) +{ + EINA_LOG_DBG("%s in", __FUNCTION__); + eina_init(); + ecore_x_init(NULL); + ecore_imf_module_register(&xim_info, + xim_imf_module_create, + xim_imf_module_exit); + + return EINA_TRUE; +} + +void +ecore_imf_xim_shutdown(void) +{ +#ifdef ENABLE_XIM + while (open_ims) { + XIM_Im_Info *info = open_ims->data; + Ecore_X_Display *display = ecore_x_display_get(); + + xim_info_display_closed(display, EINA_FALSE, info); + } +#endif + + ecore_x_shutdown(); + eina_shutdown(); +} + +EINA_MODULE_INIT(ecore_imf_xim_init); +EINA_MODULE_SHUTDOWN(ecore_imf_xim_shutdown); + +#ifdef ENABLE_XIM +/* + * internal functions + */ +Ecore_IMF_Context_Data * +imf_context_data_new() +{ + Ecore_IMF_Context_Data *imf_context_data = NULL; + char *locale; + + locale = setlocale(LC_CTYPE, ""); + if(!locale) return NULL; + + if(!XSupportsLocale()) return NULL; + + imf_context_data = calloc(1, sizeof(Ecore_IMF_Context_Data)); + if(!imf_context_data) return NULL; + + imf_context_data->locale = strdup(locale); + if(!imf_context_data->locale) goto error; + + return imf_context_data; +error: + imf_context_data_destroy(imf_context_data); + return NULL; +} + +void +imf_context_data_destroy(Ecore_IMF_Context_Data *imf_context_data) +{ + if(!imf_context_data) + return; + + if(imf_context_data->ic) + XDestroyIC(imf_context_data->ic); + + free(imf_context_data->preedit_chars); + free(imf_context_data->locale); + free(imf_context_data); +} + +static int +preedit_start_callback(XIC xic __UNUSED__, + XPointer client_data, + XPointer call_data __UNUSED__) +{ + EINA_LOG_DBG("in"); + Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data; + Ecore_IMF_Context_Data *imf_context_data; + imf_context_data = ecore_imf_context_data_get(ctx); + + if(imf_context_data->finalizing == EINA_FALSE) + ecore_imf_context_preedit_start_event_add(ctx); + + return -1; +} + +static void +preedit_done_callback(XIC xic __UNUSED__, + XPointer client_data, + XPointer call_data __UNUSED__) +{ + EINA_LOG_DBG("in"); + Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data; + Ecore_IMF_Context_Data *imf_context_data; + imf_context_data = ecore_imf_context_data_get(ctx); + + if(imf_context_data->preedit_length) + { + imf_context_data->preedit_length = 0; + free(imf_context_data->preedit_chars); + imf_context_data->preedit_chars = NULL; + ecore_imf_context_preedit_changed_event_add(ctx); + } + + if(imf_context_data->finalizing == EINA_FALSE) + ecore_imf_context_preedit_end_event_add(ctx); +} + +/* FIXME */ +static int +xim_text_to_utf8(Ecore_IMF_Context *ctx __UNUSED__, + XIMText *xim_text, + char **text) +{ + int text_length = 0; + char *result = NULL; + + if(xim_text && xim_text->string.multi_byte) + { + if(xim_text->encoding_is_wchar) + { + EINA_LOG_WARN("Wide character return from Xlib not currently supported"); + *text = NULL; + return 0; + } + + /* XXX Convert to UTF-8 */ + result = strdup(xim_text->string.multi_byte); + if(result) + { + text_length = eina_unicode_utf8_get_len(result); + if (text_length != xim_text->length) + { + EINA_LOG_WARN("Size mismatch when converting text from input method: supplied length = %d\n, result length = %d", xim_text->length, text_length); + } + } + else { + EINA_LOG_WARN("Error converting text from IM to UCS-4"); + *text = NULL; + return 0; + } + + *text = result; + return text_length; + } + else { + *text = NULL; + return 0; + } +} + +static void +preedit_draw_callback(XIC xic __UNUSED__, + XPointer client_data, + XIMPreeditDrawCallbackStruct *call_data) +{ + EINA_LOG_DBG("in"); + Eina_Bool ret = EINA_FALSE; + Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data; + Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx); + XIMText *t = call_data->text; + char *tmp; + Eina_Unicode *new_text = NULL; + Eina_UStrbuf *preedit_bufs = NULL; + int new_text_length; + + preedit_bufs = eina_ustrbuf_new(); + if(imf_context_data->preedit_chars) { + ret = eina_ustrbuf_append(preedit_bufs, imf_context_data->preedit_chars); + if(ret == EINA_FALSE) goto done; + } + + new_text_length = xim_text_to_utf8(ctx, t, &tmp); + if(tmp) + { + int tmp_len; + new_text = eina_unicode_utf8_to_unicode((const char *)tmp, &tmp_len); + free(tmp); + } + + if(t == NULL) { + /* delete string */ + ret = eina_ustrbuf_remove(preedit_bufs, + call_data->chg_first, call_data->chg_length); + } else if(call_data->chg_length == 0) { + /* insert string */ + ret = eina_ustrbuf_insert(preedit_bufs, new_text, call_data->chg_first); + } else if(call_data->chg_length > 0) { + /* replace string */ + ret = eina_ustrbuf_remove(preedit_bufs, + call_data->chg_first, call_data->chg_length); + if(ret == EINA_FALSE) goto done; + + ret = eina_ustrbuf_insert_n(preedit_bufs, new_text, + new_text_length, call_data->chg_first); + if(ret == EINA_FALSE) goto done; + } else { + ret = EINA_FALSE; + } + + done: + if(ret == EINA_TRUE) { + free(imf_context_data->preedit_chars); + imf_context_data->preedit_chars = + eina_ustrbuf_string_steal(preedit_bufs); + imf_context_data->preedit_length = + eina_unicode_strlen(imf_context_data->preedit_chars); + + ecore_imf_context_preedit_changed_event_add(ctx); + } + + free(new_text); + eina_ustrbuf_free(preedit_bufs); +} + +static void +preedit_caret_callback(XIC xic __UNUSED__, + XPointer client_data, + XIMPreeditCaretCallbackStruct *call_data) +{ + EINA_LOG_DBG("in"); + Ecore_IMF_Context *ctx = (Ecore_IMF_Context *)client_data; + Ecore_IMF_Context_Data *imf_context_data; + imf_context_data = ecore_imf_context_data_get(ctx); + + if(call_data->direction == XIMAbsolutePosition) + { + // printf("call_data->position:%d\n", call_data->position); + imf_context_data->preedit_cursor = call_data->position; + if(imf_context_data->finalizing == EINA_FALSE) + ecore_imf_context_preedit_changed_event_add(ctx); + } +} + +static XVaNestedList +preedit_callback_set(Ecore_IMF_Context *ctx) +{ + Ecore_IMF_Context_Data *imf_context_data; + imf_context_data = ecore_imf_context_data_get(ctx); + + imf_context_data->preedit_start_cb.client_data = (XPointer)ctx; + imf_context_data->preedit_start_cb.callback = (XIMProc)preedit_start_callback; + + imf_context_data->preedit_done_cb.client_data = (XPointer)ctx; + imf_context_data->preedit_done_cb.callback = (XIMProc)preedit_done_callback; + + imf_context_data->preedit_draw_cb.client_data = (XPointer)ctx; + imf_context_data->preedit_draw_cb.callback = (XIMProc)preedit_draw_callback; + + imf_context_data->preedit_caret_cb.client_data = (XPointer)ctx; + imf_context_data->preedit_caret_cb.callback = (XIMProc)preedit_caret_callback; + + return XVaCreateNestedList(0, + XNPreeditStartCallback, + &imf_context_data->preedit_start_cb, + XNPreeditDoneCallback, + &imf_context_data->preedit_done_cb, + XNPreeditDrawCallback, + &imf_context_data->preedit_draw_cb, + XNPreeditCaretCallback, + &imf_context_data->preedit_caret_cb, + NULL); +} + +static XIC +get_ic(Ecore_IMF_Context *ctx) +{ + Ecore_IMF_Context_Data *imf_context_data; + XIC ic; + imf_context_data = ecore_imf_context_data_get(ctx); + ic = imf_context_data->ic; + if(!ic) + { + XIM_Im_Info *im_info = imf_context_data->im_info; + XVaNestedList preedit_attr = NULL; + XIMStyle im_style = 0; + XPoint spot = { 0, 0 }; + char *name = NULL; + + if (!im_info) + { + EINA_LOG_WARN("Doesn't open XIM."); + return NULL; + } + + // supported styles +#if 0 + int i; + if (im_info->xim_styles) + { + for (i = 0; i < im_info->xim_styles->count_styles; i++) + { + printf("%i: ", i); + if (im_info->xim_styles->supported_styles[i] & XIMPreeditCallbacks) + printf("XIMPreeditCallbacks | "); + if (im_info->xim_styles->supported_styles[i] & XIMPreeditPosition) + printf("XIMPreeditPosition | "); + if (im_info->xim_styles->supported_styles[i] & XIMPreeditArea) + printf("XIMPreeditArea | "); + if (im_info->xim_styles->supported_styles[i] & XIMPreeditNothing) + printf("XIMPreeditNothing | "); + if (im_info->xim_styles->supported_styles[i] & XIMPreeditNone) + printf("XIMPreeditNone | "); + if (im_info->xim_styles->supported_styles[i] & XIMStatusArea) + printf("XIMStatusArea | "); + if (im_info->xim_styles->supported_styles[i] & XIMStatusCallbacks) + printf("XIMStatusCallbacks | "); + if (im_info->xim_styles->supported_styles[i] & XIMStatusNothing) + printf("XIMStatusNothing | "); + if (im_info->xim_styles->supported_styles[i] & XIMStatusNone) + printf("XIMStatusNone | "); + printf("\n"); + } + } +#endif + // "OverTheSpot" = XIMPreeditPosition | XIMStatusNothing + // "OffTheSpot" = XIMPreeditArea | XIMStatusArea + // "Root" = XIMPreeditNothing | XIMStatusNothing + + if (imf_context_data->use_preedit == EINA_TRUE) + { + if (im_info->supports_cursor) + { + // kinput2 DOES do this... + XFontSet fs; + char **missing_charset_list; + int missing_charset_count; + char *def_string; + + im_style |= XIMPreeditPosition; + im_style |= XIMStatusNothing; + fs = XCreateFontSet(ecore_x_display_get(), + "fixed", + &missing_charset_list, + &missing_charset_count, + &def_string); + preedit_attr = XVaCreateNestedList(0, + XNSpotLocation, &spot, + XNFontSet, fs, + NULL); + } + else + { + im_style |= XIMPreeditCallbacks; + im_style |= XIMStatusNothing; + preedit_attr = preedit_callback_set(ctx); + } + name = XNPreeditAttributes; + } + else + { + im_style |= XIMPreeditNothing; + im_style |= XIMStatusNothing; + } + + if (im_info->im) + { + ic = XCreateIC(im_info->im, + XNInputStyle, im_style, + XNClientWindow, imf_context_data->win, + name, preedit_attr, NULL); + } + XFree(preedit_attr); + if(ic) + { + unsigned long mask = 0xaaaaaaaa; + XGetICValues (ic, + XNFilterEvents, &mask, + NULL); + imf_context_data->mask = mask; + ecore_x_event_mask_set(imf_context_data->win, mask); + } + + imf_context_data->ic = ic; + if(ic && imf_context_data->has_focus == EINA_TRUE) + XSetICFocus(ic); + } + + return ic; +} + +static void +reinitialize_ic(Ecore_IMF_Context *ctx) +{ + Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx); + XIC ic = imf_context_data->ic; + if(ic) + { + XDestroyIC(ic); + imf_context_data->ic = NULL; + if(imf_context_data->preedit_length) + { + imf_context_data->preedit_length = 0; + free(imf_context_data->preedit_chars); + imf_context_data->preedit_chars = NULL; + ecore_imf_context_preedit_changed_event_add(ctx); + } + } +} + +static void +reinitialize_all_ics(XIM_Im_Info *info) +{ + Eina_List *tmp_list; + Ecore_IMF_Context *ctx; + + EINA_LIST_FOREACH(info->ics, tmp_list, ctx) + reinitialize_ic(ctx); +} + +static void +set_ic_client_window(Ecore_IMF_Context *ctx, + Ecore_X_Window window) +{ + EINA_LOG_DBG("in"); + Ecore_IMF_Context_Data *imf_context_data = ecore_imf_context_data_get(ctx); + Ecore_X_Window old_win; + + /* reinitialize IC */ + reinitialize_ic(ctx); + + old_win = imf_context_data->win; + EINA_LOG_DBG("old_win:%d window:%d ", old_win, window); + if(old_win != 0 && old_win != window) /* XXX how do check window... */ + { + XIM_Im_Info *info; + info = imf_context_data->im_info; + info->ics = eina_list_remove(info->ics, imf_context_data); + imf_context_data->im_info = NULL; + } + + imf_context_data->win = window; + + if(window) /* XXX */ + { + XIM_Im_Info *info = NULL; + info = get_im(window, imf_context_data->locale); + imf_context_data->im_info = info; + imf_context_data->im_info->ics = + eina_list_prepend(imf_context_data->im_info->ics, + imf_context_data); + } +} + +static XIM_Im_Info * +get_im(Ecore_X_Window window, + char *locale) +{ + EINA_LOG_DBG("in"); + + Eina_List *l; + XIM_Im_Info *im_info = NULL; + XIM_Im_Info *info = NULL; + EINA_LIST_FOREACH(open_ims, l, im_info) { + if(strcmp(im_info->locale, locale) == 0) + { + if(im_info->im) + { + return im_info; + } + else { + info = im_info; + break; + } + } + } + + if(!info) + { + info = calloc(1, sizeof(XIM_Im_Info)); + if(!info) return NULL; + open_ims = eina_list_prepend(open_ims, info); + info->win = window; + info->locale = strdup(locale); + info->reconnecting = EINA_FALSE; + } + + xim_info_try_im(info); + return info; +} + +/* initialize info->im */ +static void +xim_info_try_im(XIM_Im_Info *info) +{ + Ecore_X_Display *dsp; + + assert(info->im == NULL); + if (info->reconnecting == EINA_TRUE) + return; + + if(XSupportsLocale()) + { + if (!XSetLocaleModifiers ("")) + EINA_LOG_WARN("Unable to set locale modifiers with XSetLocaleModifiers()"); + dsp = ecore_x_display_get(); + info->im = XOpenIM(dsp, NULL, NULL, NULL); + if(!info->im) + { + XRegisterIMInstantiateCallback(dsp, + NULL, NULL, NULL, + xim_instantiate_callback, + (XPointer)info); + info->reconnecting = EINA_TRUE; + return; + } + setup_im(info); + } +} + +static void +xim_info_display_closed(Ecore_X_Display *display __UNUSED__, + int is_error __UNUSED__, + XIM_Im_Info *info) +{ + Eina_List *ics, *tmp_list; + Ecore_IMF_Context *ctx; + + open_ims = eina_list_remove(open_ims, info); + + ics = info->ics; + info->ics = NULL; + + EINA_LIST_FOREACH(ics, tmp_list, ctx) + set_ic_client_window(ctx, 0); + + EINA_LIST_FREE(ics, ctx) { + Ecore_IMF_Context_Data *imf_context_data; + imf_context_data = ecore_imf_context_data_get(ctx); + imf_context_data_destroy(imf_context_data); + } + + free (info->locale); + + if (info->im) + XCloseIM (info->im); + + free (info); +} + +static void +xim_instantiate_callback(Display *display, + XPointer client_data, + XPointer call_data __UNUSED__) +{ + XIM_Im_Info *info = (XIM_Im_Info *)client_data; + XIM im = NULL; + + im = XOpenIM(display, NULL, NULL, NULL); + + if (!im) + { + fprintf(stderr, "Failed to connect to IM\n"); + return; + } + + info->im = im; + setup_im (info); + + XUnregisterIMInstantiateCallback (display, NULL, NULL, NULL, + xim_instantiate_callback, + (XPointer)info); + info->reconnecting = EINA_FALSE; +} + +static void +setup_im(XIM_Im_Info *info) +{ + XIMValuesList *ic_values = NULL; + XIMCallback im_destroy_callback; + + if(!info->im) + return; + + im_destroy_callback.client_data = (XPointer)info; + im_destroy_callback.callback = (XIMProc)xim_destroy_callback; + XSetIMValues(info->im, + XNDestroyCallback, &im_destroy_callback, + NULL); + + XGetIMValues(info->im, + XNQueryInputStyle, &info->xim_styles, + XNQueryICValuesList, &ic_values, + NULL); + + if (ic_values) + { + int i; + + for (i = 0; i < ic_values->count_values; i++) + { + if (!strcmp(ic_values->supported_values[i], + XNStringConversionCallback)) + info->supports_string_conversion = EINA_TRUE; + if (!strcmp(ic_values->supported_values[i], + XNCursor)) + info->supports_cursor = EINA_TRUE; + } +#if 0 + printf("values........\n"); + for (i = 0; i < ic_values->count_values; i++) + printf("%s\n", ic_values->supported_values[i]); + printf("styles........\n"); + for (i = 0; i < info->xim_styles->count_styles; i++) + printf("%lx\n", info->xim_styles->supported_styles[i]); +#endif + XFree(ic_values); + } +} + +static void +xim_destroy_callback(XIM xim __UNUSED__, + XPointer client_data, + XPointer call_data __UNUSED__) +{ + XIM_Im_Info *info = (XIM_Im_Info *)client_data; + info->im = NULL; + + reinitialize_all_ics(info); + xim_info_try_im(info); + + return; +} + +#endif /* ENABLE_XIM */ diff --git a/libraries/ecore/src/tests/Makefile.am b/libraries/ecore/src/tests/Makefile.am new file mode 100644 index 0000000..bfd20d9 --- /dev/null +++ b/libraries/ecore/src/tests/Makefile.am @@ -0,0 +1,37 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_con \ +-I$(top_srcdir)/src/lib/ecore_x \ +@EINA_CFLAGS@ \ +@CHECK_CFLAGS@ + +if EFL_ENABLE_TESTS + +noinst_PROGRAMS = ecore_suite + +check_PROGRAMS = ecore_suite + +ecore_suite_SOURCES = \ +ecore_suite.c \ +ecore_test_ecore.c \ +ecore_test_ecore_con.c \ +ecore_test_ecore_x.c \ +ecore_suite.h + +ecore_suite_LDADD = \ +@CHECK_LIBS@ \ +@EINA_LIBS@ \ +$(top_builddir)/src/lib/ecore/libecore.la \ +$(top_builddir)/src/lib/ecore_con/libecore_con.la + +if BUILD_ECORE_X +ecore_suite_LDADD += \ +$(top_builddir)/src/lib/ecore_x/libecore_x.la +endif + +endif + +clean-local: + rm -rf *.gcno *.gcda diff --git a/libraries/ecore/src/tests/Makefile.in b/libraries/ecore/src/tests/Makefile.in new file mode 100644 index 0000000..a21773c --- /dev/null +++ b/libraries/ecore/src/tests/Makefile.in @@ -0,0 +1,767 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +@EFL_ENABLE_TESTS_TRUE@noinst_PROGRAMS = ecore_suite$(EXEEXT) +@EFL_ENABLE_TESTS_TRUE@check_PROGRAMS = ecore_suite$(EXEEXT) +@BUILD_ECORE_X_TRUE@@EFL_ENABLE_TESTS_TRUE@am__append_1 = \ +@BUILD_ECORE_X_TRUE@@EFL_ENABLE_TESTS_TRUE@$(top_builddir)/src/lib/ecore_x/libecore_x.la + +subdir = src/tests +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am__ecore_suite_SOURCES_DIST = ecore_suite.c ecore_test_ecore.c \ + ecore_test_ecore_con.c ecore_test_ecore_x.c ecore_suite.h +@EFL_ENABLE_TESTS_TRUE@am_ecore_suite_OBJECTS = ecore_suite.$(OBJEXT) \ +@EFL_ENABLE_TESTS_TRUE@ ecore_test_ecore.$(OBJEXT) \ +@EFL_ENABLE_TESTS_TRUE@ ecore_test_ecore_con.$(OBJEXT) \ +@EFL_ENABLE_TESTS_TRUE@ ecore_test_ecore_x.$(OBJEXT) +ecore_suite_OBJECTS = $(am_ecore_suite_OBJECTS) +@EFL_ENABLE_TESTS_TRUE@ecore_suite_DEPENDENCIES = $(top_builddir)/src/lib/ecore/libecore.la \ +@EFL_ENABLE_TESTS_TRUE@ $(top_builddir)/src/lib/ecore_con/libecore_con.la \ +@EFL_ENABLE_TESTS_TRUE@ $(am__append_1) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(ecore_suite_SOURCES) +DIST_SOURCES = $(am__ecore_suite_SOURCES_DIST) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-I$(top_srcdir)/src/lib/ecore \ +-I$(top_srcdir)/src/lib/ecore_con \ +-I$(top_srcdir)/src/lib/ecore_x \ +@EINA_CFLAGS@ \ +@CHECK_CFLAGS@ + +@EFL_ENABLE_TESTS_TRUE@ecore_suite_SOURCES = \ +@EFL_ENABLE_TESTS_TRUE@ecore_suite.c \ +@EFL_ENABLE_TESTS_TRUE@ecore_test_ecore.c \ +@EFL_ENABLE_TESTS_TRUE@ecore_test_ecore_con.c \ +@EFL_ENABLE_TESTS_TRUE@ecore_test_ecore_x.c \ +@EFL_ENABLE_TESTS_TRUE@ecore_suite.h + +@EFL_ENABLE_TESTS_TRUE@ecore_suite_LDADD = @CHECK_LIBS@ @EINA_LIBS@ \ +@EFL_ENABLE_TESTS_TRUE@ $(top_builddir)/src/lib/ecore/libecore.la \ +@EFL_ENABLE_TESTS_TRUE@ $(top_builddir)/src/lib/ecore_con/libecore_con.la \ +@EFL_ENABLE_TESTS_TRUE@ $(am__append_1) +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/tests/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/tests/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-checkPROGRAMS: + @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +ecore_suite$(EXEEXT): $(ecore_suite_OBJECTS) $(ecore_suite_DEPENDENCIES) + @rm -f ecore_suite$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(ecore_suite_OBJECTS) $(ecore_suite_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_suite.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_test_ecore.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_test_ecore_con.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ecore_test_ecore_x.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS) +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-checkPROGRAMS clean-generic clean-libtool clean-local \ + clean-noinstPROGRAMS mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool clean-local \ + clean-noinstPROGRAMS ctags distclean distclean-compile \ + distclean-generic distclean-libtool distclean-tags distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-ps install-ps-am install-strip \ + installcheck installcheck-am installdirs maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am + + +clean-local: + rm -rf *.gcno *.gcda + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/tests/ecore_suite.c b/libraries/ecore/src/tests/ecore_suite.c new file mode 100644 index 0000000..fd51750 --- /dev/null +++ b/libraries/ecore/src/tests/ecore_suite.c @@ -0,0 +1,103 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include + +#include "ecore_suite.h" + +typedef struct _Ecore_Test_Case Ecore_Test_Case; + +struct _Ecore_Test_Case +{ + const char *test_case; + void (*build)(TCase *tc); +}; + +static const Ecore_Test_Case etc[] = { + { "Ecore", ecore_test_ecore }, + { "Ecore_Con", ecore_test_ecore_con }, + { "Ecore_X", ecore_test_ecore_x }, + { NULL, NULL } +}; + +static void +_list_tests(void) +{ + const Ecore_Test_Case *itr; + + itr = etc; + fputs("Available Test Cases:\n", stderr); + for (; itr->test_case; itr++) + fprintf(stderr, "\t%s\n", itr->test_case); +} +static Eina_Bool +_use_test(int argc, const char **argv, const char *test_case) +{ + if (argc < 1) + return 1; + + for (; argc > 0; argc--, argv++) + if (strcmp(test_case, *argv) == 0) + return 1; + return 0; +} + +static Suite * +ecore_suite_build(int argc, const char **argv) +{ + TCase *tc; + Suite *s; + int i; + + s = suite_create("Ecore"); + + for (i = 0; etc[i].test_case; ++i) + { + if (!_use_test(argc, argv, etc[i].test_case)) continue; + tc = tcase_create(etc[i].test_case); + + etc[i].build(tc); + + suite_add_tcase(s, tc); + tcase_set_timeout(tc, 0); + } + + return s; +} + +int +main(int argc, char **argv) +{ + Suite *s; + SRunner *sr; + int i, failed_count; + + for (i = 1; i < argc; i++) + if ((strcmp(argv[i], "-h") == 0) || + (strcmp(argv[i], "--help") == 0)) + { + fprintf(stderr, "Usage:\n\t%s [test_case1 .. [test_caseN]]\n", + argv[0]); + _list_tests(); + return 0; + } + else if ((strcmp(argv[i], "-l") == 0) || + (strcmp(argv[i], "--list") == 0)) + { + _list_tests(); + return 0; + } + + s = ecore_suite_build(argc - 1, (const char **)argv + 1); + sr = srunner_create(s); + + srunner_run_all(sr, CK_ENV); + failed_count = srunner_ntests_failed(sr); + srunner_free(sr); + + return (failed_count == 0) ? 0 : 255; +} diff --git a/libraries/ecore/src/tests/ecore_suite.h b/libraries/ecore/src/tests/ecore_suite.h new file mode 100644 index 0000000..0c7dfef --- /dev/null +++ b/libraries/ecore/src/tests/ecore_suite.h @@ -0,0 +1,11 @@ +#ifndef _ECORE_SUITE_H +#define _ECORE_SUITE_H + +#include + +void ecore_test_ecore(TCase *tc); +void ecore_test_ecore_con(TCase *tc); +void ecore_test_ecore_x(TCase *tc); + + +#endif /* _ECORE_SUITE_H */ diff --git a/libraries/ecore/src/tests/ecore_test_ecore.c b/libraries/ecore/src/tests/ecore_test_ecore.c new file mode 100644 index 0000000..3649196 --- /dev/null +++ b/libraries/ecore/src/tests/ecore_test_ecore.c @@ -0,0 +1,367 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include +#include + +#include +#include + +#include "ecore_suite.h" + +static int _log_dom; +#define INF(...) EINA_LOG_DOM_INFO(_log_dom, __VA_ARGS__) + +static Eina_Bool +_quit_cb(void *data) +{ + Eina_Bool *val = data; + *val = EINA_TRUE; + ecore_main_loop_quit(); + return EINA_FALSE; +} + +static Eina_Bool +_dummy_cb(void *data) +{ + return !!data; +} + +START_TEST(ecore_test_ecore_init) +{ + int ret; + + ret = ecore_init(); + fail_if(ret != 1); + + ret = ecore_shutdown(); + fail_if(ret != 0); +} +END_TEST + +START_TEST(ecore_test_ecore_main_loop) +{ + Eina_Bool did = EINA_FALSE; + Ecore_Timer *timer; + int ret; + + ret = ecore_init(); + fail_if(ret != 1); + + timer = ecore_timer_add(0.0, _quit_cb, &did); + fail_if(timer == NULL); + + ecore_main_loop_begin(); + + fail_if(did == EINA_FALSE); + + ret = ecore_shutdown(); + fail_if(ret != 0); +} +END_TEST + +START_TEST(ecore_test_ecore_main_loop_idler) +{ + Eina_Bool did = EINA_FALSE; + Ecore_Idler *idler; + int ret; + + ret = ecore_init(); + fail_if(ret != 1); + + idler = ecore_idler_add(_quit_cb, &did); + fail_if(idler == NULL); + + ecore_main_loop_begin(); + + fail_if(did == EINA_FALSE); + + ret = ecore_shutdown(); + fail_if(ret != 0); +} +END_TEST + +START_TEST(ecore_test_ecore_main_loop_idle_enterer) +{ + Eina_Bool did = EINA_FALSE; + Ecore_Idle_Enterer *idle_enterer; + int ret; + + ret = ecore_init(); + fail_if(ret != 1); + + idle_enterer = ecore_idle_enterer_add(_quit_cb, &did); + fail_if(idle_enterer == NULL); + + ecore_main_loop_begin(); + + fail_if(did == EINA_FALSE); + + ret = ecore_shutdown(); + fail_if(ret != 0); +} +END_TEST + +START_TEST(ecore_test_ecore_main_loop_idle_exiter) +{ + Eina_Bool did = EINA_FALSE; + Ecore_Timer *timer; + Ecore_Idle_Exiter *idle_exiter; + int ret; + + ret = ecore_init(); + fail_if(ret != 1); + + /* make system exit idle */ + timer = ecore_timer_add(0.0, _dummy_cb, (void *)(long)0); + fail_if(timer == NULL); + + idle_exiter = ecore_idle_exiter_add(_quit_cb, &did); + fail_if(idle_exiter == NULL); + + ecore_main_loop_begin(); + + fail_if(did == EINA_FALSE); + + ret = ecore_shutdown(); + fail_if(ret != 0); +} +END_TEST + +START_TEST(ecore_test_ecore_main_loop_timer) +{ + Eina_Bool did = EINA_FALSE; + Ecore_Timer *timer; + double start, end, elapsed; + int ret; + + ret = ecore_init(); + fail_if(ret != 1); + + timer = ecore_timer_add(2.0, _quit_cb, &did); + fail_if(timer == NULL); + + start = ecore_time_get(); + ecore_main_loop_begin(); + end = ecore_time_get(); + elapsed = end - start; + + fail_if(did == EINA_FALSE); + fail_if(elapsed < 2.0); + fail_if(elapsed > 3.0); /* 1 second "error margin" */ + + ret = ecore_shutdown(); + fail_if(ret != 0); +} +END_TEST + +static Eina_Bool _timer3(void *data) +{ + /* timer 3, do nothing */ + return EINA_FALSE; +} + +static Eina_Bool _timer2(void *data) +{ + /* timer 2, quit inner mainloop */ + ecore_main_loop_quit(); + return EINA_FALSE; +} + +static Eina_Bool _timer1(void *data) +{ + /* timer 1, begin inner mainloop */ + int *times = data; + (*times)++; + + ecore_timer_add(0.3, _timer2, NULL); + ecore_timer_add(0.1, _timer3, NULL); + ecore_main_loop_begin(); + + ecore_main_loop_quit(); + + return EINA_FALSE; +} + +START_TEST(ecore_test_ecore_main_loop_timer_inner) +{ + Ecore_Timer *timer; + int ret; + int times = 0; + + ret = ecore_init(); + fail_if(ret != 1); + + timer = ecore_timer_add(1.0, _timer1, ×); + fail_if(timer == NULL); + + /* BEGIN: outer mainloop */ + ecore_main_loop_begin(); + /*END: outer mainloop */ + + fail_if(times != 1); +} +END_TEST + +static Eina_Bool +_fd_handler_cb(void *data, Ecore_Fd_Handler *handler __UNUSED__) +{ + /* FIXME: why setting val if it is overwritten just after and what is its purpose ??? */ + Eina_Bool *val = data; + + *val = EINA_TRUE; + ecore_main_loop_quit(); + return EINA_FALSE; +} + +START_TEST(ecore_test_ecore_main_loop_fd_handler) +{ + Eina_Bool did = EINA_FALSE; + Ecore_Fd_Handler *fd_handler; + int comm[2]; + int ret; + + ret = ecore_init(); + fail_if(ret != 1); + + ret = pipe(comm); + fail_if(ret != 0); + + fd_handler = ecore_main_fd_handler_add + (comm[0], ECORE_FD_READ, _fd_handler_cb, &did, NULL, NULL); + fail_if(fd_handler == NULL); + + ret = write(comm[1], &did, 1); + fail_if(ret != 1); + + ecore_main_loop_begin(); + + close(comm[0]); + close(comm[1]); + + fail_if(did == EINA_FALSE); + + ret = ecore_shutdown(); + fail_if(ret != 0); +} +END_TEST + +static Eina_Bool +_event_handler_cb(void *data, int type __UNUSED__, void *event __UNUSED__) +{ + /* FIXME: why setting val if it is overwritten just after and what is its purpose ??? */ + Eina_Bool *val = data; + + *val = EINA_TRUE; + ecore_main_loop_quit(); + return EINA_FALSE; +} + +START_TEST(ecore_test_ecore_main_loop_event) +{ + Eina_Bool did = EINA_FALSE; + Ecore_Event_Handler *handler; + Ecore_Event *event; + int ret, type; + + ret = ecore_init(); + fail_if(ret != 1); + + type = ecore_event_type_new(); + fail_if(type < 1); + + handler = ecore_event_handler_add(type, _event_handler_cb, &did); + fail_if(handler == NULL); + + event = ecore_event_add(type, NULL, NULL, NULL); + fail_if(event == NULL); + + ecore_main_loop_begin(); + + fail_if(did == EINA_FALSE); + + ret = ecore_shutdown(); + fail_if(ret != 0); +} +END_TEST + +static Eina_Bool +_timer_quit_recursive(void *data) +{ + INF(" _timer_quit_recursive: begin"); + ecore_main_loop_quit(); /* quits inner main loop */ + INF(" _timer_quit_recursive: end"); + return EINA_FALSE; +} + +static Eina_Bool +_event_recursive_cb(void *data, int type, void *event) +{ + Ecore_Event *e; + static int guard = 0; + + /* If we enter this callback more than once, it's wrong! */ + fail_if(guard != 0); + guard++; + + INF(" event_recursive_cb: begin"); + + ecore_timer_add(1.0, _timer_quit_recursive, NULL); + INF(" add 1.0s timer (once) to trigger _timer_quit_recursive"); + + INF(" inner main loop begin (recurse)"); + ecore_main_loop_begin(); + INF(" inner main loop end (recurse)"); + + ecore_main_loop_quit(); /* quits outer main loop */ + + INF(" guard = %d", guard); + INF(" event_recursive_cb: end"); + return EINA_FALSE; +} + + +START_TEST(ecore_test_ecore_main_loop_event_recursive) +{ + /* This test tests if the event handlers are really called only once when + * recursive main loops are used and any number of events may have occurred + * between the beginning and the end of recursive main loop. + */ + Ecore_Event *e; + int type; + int ret; + + _log_dom = eina_log_domain_register("test", EINA_COLOR_CYAN); + + INF("main: begin"); + ret = ecore_init(); + fail_if(ret != 1); + + + type = ecore_event_type_new(); + ecore_event_handler_add(type, _event_recursive_cb, NULL); + e = ecore_event_add(type, NULL, NULL, NULL); + INF(" add event to trigger cb1: event=%p", e); + INF(" main loop begin"); + ecore_main_loop_begin(); + INF(" main loop end"); + + INF("main: end"); + ecore_shutdown(); +} +END_TEST + +void ecore_test_ecore(TCase *tc) +{ + tcase_add_test(tc, ecore_test_ecore_init); + tcase_add_test(tc, ecore_test_ecore_main_loop); + tcase_add_test(tc, ecore_test_ecore_main_loop_idler); + tcase_add_test(tc, ecore_test_ecore_main_loop_idle_enterer); + tcase_add_test(tc, ecore_test_ecore_main_loop_idle_exiter); + tcase_add_test(tc, ecore_test_ecore_main_loop_timer); + tcase_add_test(tc, ecore_test_ecore_main_loop_fd_handler); + tcase_add_test(tc, ecore_test_ecore_main_loop_event); + tcase_add_test(tc, ecore_test_ecore_main_loop_timer_inner); + tcase_add_test(tc, ecore_test_ecore_main_loop_event_recursive); +} diff --git a/libraries/ecore/src/tests/ecore_test_ecore_con.c b/libraries/ecore/src/tests/ecore_test_ecore_con.c new file mode 100644 index 0000000..45c1f69 --- /dev/null +++ b/libraries/ecore/src/tests/ecore_test_ecore_con.c @@ -0,0 +1,258 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "ecore_suite.h" + +#include +#include +#include + +Eina_Bool +_add(void *data, int type __UNUSED__, void *ev) +{ + fail_if (type != ECORE_CON_EVENT_CLIENT_ADD && + type != ECORE_CON_EVENT_SERVER_ADD); + + /* Server */ + if (type == ECORE_CON_EVENT_CLIENT_ADD) + { + Ecore_Con_Event_Client_Add *event = ev; + + fail_if (data != (void *) 1); + fail_if (!event->client); + + printf("Client with ip %s, port %d, connected = %d!\n", + ecore_con_client_ip_get(event->client), + ecore_con_client_port_get(event->client), + ecore_con_client_connected_get(event->client)); + + ecore_con_client_timeout_set(event->client, 10); + + } + else if (type == ECORE_CON_EVENT_SERVER_ADD) + { + Ecore_Con_Event_Server_Add *event = ev; + const char ping[] = "PING"; + int ret; + + fail_if (data != (void *) 2); + fail_if (!event->server); + printf("Server with ip %s, name %s, port %d, connected = %d!\n", + ecore_con_server_ip_get(event->server), + ecore_con_server_name_get(event->server), + ecore_con_server_port_get(event->server), + ecore_con_server_connected_get(event->server)); + ret = ecore_con_server_send(event->server, ping, sizeof(ping)); + fail_if (ret != sizeof(ping)); + ecore_con_server_flush(event->server); + } + + return ECORE_CALLBACK_RENEW; +} + +Eina_Bool +_del(void *data , int type __UNUSED__, void *ev) +{ + fail_if (type != ECORE_CON_EVENT_CLIENT_DEL && + type != ECORE_CON_EVENT_SERVER_DEL); + + /* Server */ + if (type == ECORE_CON_EVENT_CLIENT_DEL) + { + Ecore_Con_Event_Client_Del *event = ev; + + fail_if (data != (void *) 1); + fail_if (!event->client); + + printf("Lost client with ip %s!\n", ecore_con_client_ip_get(event->client)); + printf("Client was connected for %0.3f seconds.\n", + ecore_con_client_uptime_get(event->client)); + + ecore_con_client_del(event->client); + } + else if (type == ECORE_CON_EVENT_SERVER_DEL) + { + Ecore_Con_Event_Server_Del *event = ev; + + fail_if (!event->server); + + fail_if (data != (void *) 2); + + printf("Lost server with ip %s!\n", ecore_con_server_ip_get(event->server)); + + ecore_con_server_del(event->server); + } + fail (); + + return ECORE_CALLBACK_RENEW; +} + +Eina_Bool +_data(void *data, int type __UNUSED__, void *ev) +{ + + fail_if (type != ECORE_CON_EVENT_CLIENT_DATA && + type != ECORE_CON_EVENT_SERVER_DATA); + + /* Server */ + if (type == ECORE_CON_EVENT_CLIENT_DATA) + { + Ecore_Con_Event_Client_Data *event = ev; + const char pong[] = "PONG"; + int ret; + + char fmt[128]; + fail_if (data != (void *) 1); + + snprintf(fmt, sizeof(fmt), + "Received %i bytes from client %s port %d:\n" + ">>>>>\n" + "%%.%is\n" + ">>>>>\n", + event->size, ecore_con_client_ip_get(event->client), + ecore_con_client_port_get(event->client), event->size); + + printf(fmt, event->data); + fail_if (event->size != sizeof("PING")); + fail_if (memcmp (event->data, "PING", sizeof("PING")) != 0); + + ret = ecore_con_client_send(event->client, pong, sizeof(pong)); + fail_if (ret != sizeof(pong)); + ecore_con_client_flush(event->client); + } + else if (type == ECORE_CON_EVENT_SERVER_DATA) + { + Ecore_Con_Event_Server_Data *event = ev; + char fmt[128]; + + fail_if (data != (void *) 2); + + snprintf(fmt, sizeof(fmt), + "Received %i bytes from server:\n" + ">>>>>\n" + "%%.%is\n" + ">>>>>\n", + event->size, event->size); + + printf(fmt, event->data); + fail_if (event->size != sizeof("PONG")); + fail_if (memcmp (event->data, "PONG", sizeof("PONG")) != 0); + ecore_main_loop_quit(); + } + + return ECORE_CALLBACK_RENEW; +} + +START_TEST(ecore_test_ecore_con_server) +{ + Ecore_Con_Server *server; + Ecore_Con_Server *client; + Ecore_Con_Client *cl; + const Eina_List *clients, *l; + Ecore_Event_Handler *handlers[6]; + void *server_data = malloc (1); + void *client_data = malloc (1); + int ret; + void *del_ret; + + ret = eina_init(); + fail_if(ret != 1); + ret = ecore_init(); + fail_if(ret != 1); + ret = ecore_con_init(); + fail_if(ret != 1); + + handlers[0] = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, + _add, (void *) 1); + fail_if(handlers[0] == NULL); + handlers[1] = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, + _del, (void *) 1); + fail_if(handlers[1] == NULL); + handlers[2] = ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, + _data, (void *) 1); + fail_if(handlers[2] == NULL); + + handlers[3] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_ADD, + _add, (void *) 2); + fail_if(handlers[3] == NULL); + handlers[4] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DEL, + _del, (void *) 2); + fail_if(handlers[4] == NULL); + handlers[5] = ecore_event_handler_add(ECORE_CON_EVENT_SERVER_DATA, + _data, (void *) 2); + fail_if(handlers[5] == NULL); + + server = ecore_con_server_add(ECORE_CON_REMOTE_TCP, "::1", 8080, + server_data); + fail_if (server == NULL); + + ecore_con_server_timeout_set(server, 10); + ecore_con_server_client_limit_set(server, 1, 0); + + client = ecore_con_server_connect(ECORE_CON_REMOTE_TCP, "::1", 8080, + client_data); + fail_if (client == NULL); + + ecore_main_loop_begin(); + + clients = ecore_con_server_clients_get(server); + printf("Clients connected to this server when exiting: %d\n", + eina_list_count(clients)); + EINA_LIST_FOREACH(clients, l, cl) + { + printf("%s\n", ecore_con_client_ip_get(cl)); + } + + printf("Server was up for %0.3f seconds\n", + ecore_con_server_uptime_get(server)); + + del_ret = ecore_con_server_del(server); + fail_if (del_ret != server_data); + free (server_data); + del_ret = ecore_con_server_del(client); + fail_if (del_ret != client_data); + free (client_data); + + del_ret = ecore_event_handler_del (handlers[0]); + fail_if (del_ret != (void *) 1); + del_ret = ecore_event_handler_del (handlers[1]); + fail_if (del_ret != (void *) 1); + del_ret = ecore_event_handler_del (handlers[2]); + fail_if (del_ret != (void *) 1); + + del_ret = ecore_event_handler_del (handlers[3]); + fail_if (del_ret != (void *) 2); + del_ret = ecore_event_handler_del (handlers[4]); + fail_if (del_ret != (void *) 2); + del_ret = ecore_event_handler_del (handlers[5]); + fail_if (del_ret != (void *) 2); + + ret = ecore_con_shutdown(); + fail_if(ret != 0); + ret = ecore_shutdown(); + fail_if(ret != 0); + ret = eina_shutdown(); + fail_if(ret != 0); +} +END_TEST + +START_TEST(ecore_test_ecore_con_init) +{ + int ret; + + ret = ecore_con_init(); + fail_if(ret != 1); + + ret = ecore_con_shutdown(); + fail_if(ret != 0); +} +END_TEST + +void ecore_test_ecore_con(TCase *tc) +{ + tcase_add_test(tc, ecore_test_ecore_con_init); + tcase_add_test(tc, ecore_test_ecore_con_server); +} diff --git a/libraries/ecore/src/tests/ecore_test_ecore_x.c b/libraries/ecore/src/tests/ecore_test_ecore_x.c new file mode 100644 index 0000000..4b9e126 --- /dev/null +++ b/libraries/ecore/src/tests/ecore_test_ecore_x.c @@ -0,0 +1,56 @@ +#ifdef HAVE_CONFIG_H +# include +#endif + +#include + +#include "ecore_suite.h" + + +/* TODO: change to HAVE_ECORE_X when xcb implementation is done */ +#ifdef HAVE_ECORE_X_XLIB + +START_TEST(ecore_test_ecore_x_init) +{ + int ret; + + ret = ecore_x_init(NULL); + fail_if(ret != 1); + + ret = ecore_x_shutdown(); + fail_if(ret != 0); +} +END_TEST + +START_TEST(ecore_test_ecore_x_bell) +{ + int i; + int ret; + + ret = ecore_x_init(NULL); + fail_if(ret != 1); + + printf("You should hear 3 beeps now.\n"); + for (i = 0; i < 3; i++) + { + ret = ecore_x_bell(0); + fail_if(ret != EINA_TRUE); + ecore_x_sync(); + sleep(1); + } + + ecore_x_shutdown(); +} +END_TEST + +#endif + +void ecore_test_ecore_x(TCase *tc) +{ + +/* TODO: change to HAVE_ECORE_X when xcb implementation is done */ +#ifdef HAVE_ECORE_X_XLIB + tcase_add_test(tc, ecore_test_ecore_x_init); + tcase_add_test(tc, ecore_test_ecore_x_bell); +#endif +} diff --git a/libraries/ecore/src/util/Makefile.am b/libraries/ecore/src/util/Makefile.am new file mode 100644 index 0000000..38ebc12 --- /dev/null +++ b/libraries/ecore/src/util/Makefile.am @@ -0,0 +1,17 @@ +MAINTAINERCLEANFILES = Makefile.in + +AM_CPPFLAGS = \ +-DPACKAGE_BIN_DIR=\"$(bindir)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@EINA_CFLAGS@ + +noinst_PROGRAMS=makekeys + +makekeys_SOURCES = \ + makekeys.c + +makekeys_LDADD = \ + @EINA_LIBS@ + +EXTRA_DIST = mkks.sh diff --git a/libraries/ecore/src/util/Makefile.in b/libraries/ecore/src/util/Makefile.in new file mode 100644 index 0000000..0e1e6e7 --- /dev/null +++ b/libraries/ecore/src/util/Makefile.in @@ -0,0 +1,734 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = makekeys$(EXEEXT) +subdir = src/util +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ac_attribute.m4 \ + $(top_srcdir)/m4/ac_path_generic.m4 \ + $(top_srcdir)/m4/check_x_extension.m4 \ + $(top_srcdir)/m4/ecore_check_module.m4 \ + $(top_srcdir)/m4/ecore_check_options.m4 \ + $(top_srcdir)/m4/efl_compiler_flag.m4 \ + $(top_srcdir)/m4/efl_doxygen.m4 \ + $(top_srcdir)/m4/efl_examples.m4 \ + $(top_srcdir)/m4/efl_path_max.m4 $(top_srcdir)/m4/efl_tests.m4 \ + $(top_srcdir)/m4/efl_threads.m4 $(top_srcdir)/m4/gettext.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intlmacosx.m4 \ + $(top_srcdir)/m4/isc-posix.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/po.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_makekeys_OBJECTS = makekeys.$(OBJEXT) +makekeys_OBJECTS = $(am_makekeys_OBJECTS) +makekeys_DEPENDENCIES = +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(makekeys_SOURCES) +DIST_SOURCES = $(makekeys_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CARES_CFLAGS = @CARES_CFLAGS@ +CARES_LIBS = @CARES_LIBS@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CHECK_CFLAGS = @CHECK_CFLAGS@ +CHECK_LIBS = @CHECK_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_CFLAGS = @CURL_CFLAGS@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DIRECTFB_CFLAGS = @DIRECTFB_CFLAGS@ +DIRECTFB_LIBS = @DIRECTFB_LIBS@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +ECORE_XCB_CFLAGS = @ECORE_XCB_CFLAGS@ +ECORE_XCB_LIBS = @ECORE_XCB_LIBS@ +EFL_ECORE_BUILD = @EFL_ECORE_BUILD@ +EFL_ECORE_CON_BUILD = @EFL_ECORE_CON_BUILD@ +EFL_ECORE_EVAS_BUILD = @EFL_ECORE_EVAS_BUILD@ +EFL_ECORE_FILE_BUILD = @EFL_ECORE_FILE_BUILD@ +EFL_ECORE_IMF_BUILD = @EFL_ECORE_IMF_BUILD@ +EFL_ECORE_IMF_EVAS_BUILD = @EFL_ECORE_IMF_EVAS_BUILD@ +EFL_ECORE_INPUT_BUILD = @EFL_ECORE_INPUT_BUILD@ +EFL_ECORE_INPUT_EVAS_BUILD = @EFL_ECORE_INPUT_EVAS_BUILD@ +EFL_ECORE_IPC_BUILD = @EFL_ECORE_IPC_BUILD@ +EFL_ECORE_PSL1GHT_BUILD = @EFL_ECORE_PSL1GHT_BUILD@ +EFL_ECORE_SDL_BUILD = @EFL_ECORE_SDL_BUILD@ +EFL_ECORE_WIN32_BUILD = @EFL_ECORE_WIN32_BUILD@ +EFL_ECORE_WINCE_BUILD = @EFL_ECORE_WINCE_BUILD@ +EFL_PTHREAD_CFLAGS = @EFL_PTHREAD_CFLAGS@ +EFL_PTHREAD_LIBS = @EFL_PTHREAD_LIBS@ +EGREP = @EGREP@ +EINA_CFLAGS = @EINA_CFLAGS@ +EINA_LIBS = @EINA_LIBS@ +ESCAPE_CFLAGS = @ESCAPE_CFLAGS@ +ESCAPE_LIBS = @ESCAPE_LIBS@ +EVAS_CFLAGS = @EVAS_CFLAGS@ +EVAS_LIBS = @EVAS_LIBS@ +EVIL_CFLAGS = @EVIL_CFLAGS@ +EVIL_LIBS = @EVIL_LIBS@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ +GLIB_CFLAGS = @GLIB_CFLAGS@ +GLIB_LIBS = @GLIB_LIBS@ +GMSGFMT = @GMSGFMT@ +GMSGFMT_015 = @GMSGFMT_015@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INTLLIBS = @INTLLIBS@ +INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ +KEYSYMDEFS = @KEYSYMDEFS@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@ +LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@ +LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@ +LIBICONV = @LIBICONV@ +LIBINTL = @LIBINTL@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBICONV = @LTLIBICONV@ +LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MSGFMT = @MSGFMT@ +MSGFMT_015 = @MSGFMT_015@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJC = @OBJC@ +OBJCDEPMODE = @OBJCDEPMODE@ +OBJCFLAGS = @OBJCFLAGS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PIXMAN_CFLAGS = @PIXMAN_CFLAGS@ +PIXMAN_LIBS = @PIXMAN_LIBS@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SDL_CFLAGS = @SDL_CFLAGS@ +SDL_CONFIG = @SDL_CONFIG@ +SDL_LIBS = @SDL_LIBS@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +SSL_CFLAGS = @SSL_CFLAGS@ +SSL_LIBS = @SSL_LIBS@ +STRIP = @STRIP@ +TLS2_CFLAGS = @TLS2_CFLAGS@ +TLS2_LIBS = @TLS2_LIBS@ +TLS_CFLAGS = @TLS_CFLAGS@ +TLS_LIBS = @TLS_LIBS@ +TSLIB_CFLAGS = @TSLIB_CFLAGS@ +TSLIB_LIBS = @TSLIB_LIBS@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +VMAJ = @VMAJ@ +WIN32_CFLAGS = @WIN32_CFLAGS@ +WIN32_CPPFLAGS = @WIN32_CPPFLAGS@ +WIN32_LIBS = @WIN32_LIBS@ +XCB_COMPOSITE_CFLAGS = @XCB_COMPOSITE_CFLAGS@ +XCB_COMPOSITE_LIBS = @XCB_COMPOSITE_LIBS@ +XCB_CURSOR_CFLAGS = @XCB_CURSOR_CFLAGS@ +XCB_CURSOR_LIBS = @XCB_CURSOR_LIBS@ +XCB_DAMAGE_CFLAGS = @XCB_DAMAGE_CFLAGS@ +XCB_DAMAGE_LIBS = @XCB_DAMAGE_LIBS@ +XCB_DPMS_CFLAGS = @XCB_DPMS_CFLAGS@ +XCB_DPMS_LIBS = @XCB_DPMS_LIBS@ +XCB_RANDR_CFLAGS = @XCB_RANDR_CFLAGS@ +XCB_RANDR_LIBS = @XCB_RANDR_LIBS@ +XCB_RENDER_CFLAGS = @XCB_RENDER_CFLAGS@ +XCB_RENDER_LIBS = @XCB_RENDER_LIBS@ +XCB_SCREENSAVER_CFLAGS = @XCB_SCREENSAVER_CFLAGS@ +XCB_SCREENSAVER_LIBS = @XCB_SCREENSAVER_LIBS@ +XCB_SHAPE_CFLAGS = @XCB_SHAPE_CFLAGS@ +XCB_SHAPE_LIBS = @XCB_SHAPE_LIBS@ +XCB_SYNC_CFLAGS = @XCB_SYNC_CFLAGS@ +XCB_SYNC_LIBS = @XCB_SYNC_LIBS@ +XCB_X11_CFLAGS = @XCB_X11_CFLAGS@ +XCB_X11_LIBS = @XCB_X11_LIBS@ +XCB_XFIXES_CFLAGS = @XCB_XFIXES_CFLAGS@ +XCB_XFIXES_LIBS = @XCB_XFIXES_LIBS@ +XCB_XGESTURE_CFLAGS = @XCB_XGESTURE_CFLAGS@ +XCB_XGESTURE_LIBS = @XCB_XGESTURE_LIBS@ +XCB_XINERAMA_CFLAGS = @XCB_XINERAMA_CFLAGS@ +XCB_XINERAMA_LIBS = @XCB_XINERAMA_LIBS@ +XCB_XINPUT_CFLAGS = @XCB_XINPUT_CFLAGS@ +XCB_XINPUT_LIBS = @XCB_XINPUT_LIBS@ +XCB_XPRINT_CFLAGS = @XCB_XPRINT_CFLAGS@ +XCB_XPRINT_LIBS = @XCB_XPRINT_LIBS@ +XCB_XTEST_CFLAGS = @XCB_XTEST_CFLAGS@ +XCB_XTEST_LIBS = @XCB_XTEST_LIBS@ +XCOMPOSITE_CFLAGS = @XCOMPOSITE_CFLAGS@ +XCOMPOSITE_LIBS = @XCOMPOSITE_LIBS@ +XDAMAGE_CFLAGS = @XDAMAGE_CFLAGS@ +XDAMAGE_LIBS = @XDAMAGE_LIBS@ +XDPMS_CFLAGS = @XDPMS_CFLAGS@ +XDPMS_LIBS = @XDPMS_LIBS@ +XFIXES_CFLAGS = @XFIXES_CFLAGS@ +XFIXES_LIBS = @XFIXES_LIBS@ +XGESTURE_CFLAGS = @XGESTURE_CFLAGS@ +XGESTURE_LIBS = @XGESTURE_LIBS@ +XGETTEXT = @XGETTEXT@ +XGETTEXT_015 = @XGETTEXT_015@ +XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ +XI2_CFLAGS = @XI2_CFLAGS@ +XI2_LIBS = @XI2_LIBS@ +XINERAMA_CFLAGS = @XINERAMA_CFLAGS@ +XINERAMA_LIBS = @XINERAMA_LIBS@ +XKB_CFLAGS = @XKB_CFLAGS@ +XKB_LIBS = @XKB_LIBS@ +XMKMF = @XMKMF@ +XPRINT_CFLAGS = @XPRINT_CFLAGS@ +XPRINT_LIBS = @XPRINT_LIBS@ +XRANDR_CFLAGS = @XRANDR_CFLAGS@ +XRANDR_LIBS = @XRANDR_LIBS@ +XRENDER_CFLAGS = @XRENDER_CFLAGS@ +XRENDER_LIBS = @XRENDER_LIBS@ +XSS_CFLAGS = @XSS_CFLAGS@ +XSS_LIBS = @XSS_LIBS@ +XTEST_CFLAGS = @XTEST_CFLAGS@ +XTEST_LIBS = @XTEST_LIBS@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +Xcursor_cflags = @Xcursor_cflags@ +Xcursor_libs = @Xcursor_libs@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +ac_ct_OBJC = @ac_ct_OBJC@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +cocoa_ldflags = @cocoa_ldflags@ +datadir = @datadir@ +datarootdir = @datarootdir@ +dlopen_libs = @dlopen_libs@ +docdir = @docdir@ +dvidir = @dvidir@ +ecore_cocoa_cflags = @ecore_cocoa_cflags@ +ecore_cocoa_libs = @ecore_cocoa_libs@ +ecore_con_cflags = @ecore_con_cflags@ +ecore_con_libs = @ecore_con_libs@ +ecore_directfb_cflags = @ecore_directfb_cflags@ +ecore_directfb_libs = @ecore_directfb_libs@ +ecore_evas_cflags = @ecore_evas_cflags@ +ecore_evas_libs = @ecore_evas_libs@ +ecore_fb_cflags = @ecore_fb_cflags@ +ecore_fb_libs = @ecore_fb_libs@ +ecore_file_cflags = @ecore_file_cflags@ +ecore_file_libs = @ecore_file_libs@ +ecore_imf_cflags = @ecore_imf_cflags@ +ecore_imf_evas_cflags = @ecore_imf_evas_cflags@ +ecore_imf_evas_libs = @ecore_imf_evas_libs@ +ecore_imf_libs = @ecore_imf_libs@ +ecore_imf_xim_cflags = @ecore_imf_xim_cflags@ +ecore_imf_xim_libs = @ecore_imf_xim_libs@ +ecore_input_cflags = @ecore_input_cflags@ +ecore_input_evas_cflags = @ecore_input_evas_cflags@ +ecore_input_evas_libs = @ecore_input_evas_libs@ +ecore_input_libs = @ecore_input_libs@ +ecore_ipc_cflags = @ecore_ipc_cflags@ +ecore_ipc_libs = @ecore_ipc_libs@ +ecore_psl1ght_cflags = @ecore_psl1ght_cflags@ +ecore_psl1ght_libs = @ecore_psl1ght_libs@ +ecore_sdl_cflags = @ecore_sdl_cflags@ +ecore_sdl_libs = @ecore_sdl_libs@ +ecore_win32_cflags = @ecore_win32_cflags@ +ecore_win32_libs = @ecore_win32_libs@ +ecore_wince_cflags = @ecore_wince_cflags@ +ecore_wince_libs = @ecore_wince_libs@ +ecore_x_cflags = @ecore_x_cflags@ +ecore_x_libs = @ecore_x_libs@ +ecore_x_libs_private = @ecore_x_libs_private@ +efl_doxygen = @efl_doxygen@ +efl_have_doxygen = @efl_have_doxygen@ +exec_prefix = @exec_prefix@ +have_ecore_x_xcb_define = @have_ecore_x_xcb_define@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lt_ECHO = @lt_ECHO@ +lt_enable_auto_import = @lt_enable_auto_import@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfig_requires_private = @pkgconfig_requires_private@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +release_info = @release_info@ +requirements_ecore = @requirements_ecore@ +requirements_ecore_cocoa = @requirements_ecore_cocoa@ +requirements_ecore_con = @requirements_ecore_con@ +requirements_ecore_directfb = @requirements_ecore_directfb@ +requirements_ecore_evas = @requirements_ecore_evas@ +requirements_ecore_fb = @requirements_ecore_fb@ +requirements_ecore_file = @requirements_ecore_file@ +requirements_ecore_imf = @requirements_ecore_imf@ +requirements_ecore_imf_evas = @requirements_ecore_imf_evas@ +requirements_ecore_imf_xim = @requirements_ecore_imf_xim@ +requirements_ecore_input = @requirements_ecore_input@ +requirements_ecore_input_evas = @requirements_ecore_input_evas@ +requirements_ecore_ipc = @requirements_ecore_ipc@ +requirements_ecore_psl1ght = @requirements_ecore_psl1ght@ +requirements_ecore_sdl = @requirements_ecore_sdl@ +requirements_ecore_win32 = @requirements_ecore_win32@ +requirements_ecore_wince = @requirements_ecore_wince@ +requirements_ecore_x = @requirements_ecore_x@ +rt_libs = @rt_libs@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +version_info = @version_info@ +x_cflags = @x_cflags@ +x_includes = @x_includes@ +x_libs = @x_libs@ +MAINTAINERCLEANFILES = Makefile.in +AM_CPPFLAGS = \ +-DPACKAGE_BIN_DIR=\"$(bindir)\" \ +-DPACKAGE_LIB_DIR=\"$(libdir)\" \ +-DPACKAGE_DATA_DIR=\"$(datadir)/$(PACKAGE)\" \ +@EINA_CFLAGS@ + +makekeys_SOURCES = \ + makekeys.c + +makekeys_LDADD = \ + @EINA_LIBS@ + +EXTRA_DIST = mkks.sh +all: all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/util/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/util/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +makekeys$(EXEEXT): $(makekeys_OBJECTS) $(makekeys_DEPENDENCIES) + @rm -f makekeys$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(makekeys_OBJECTS) $(makekeys_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/makekeys.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/libraries/ecore/src/util/makekeys.c b/libraries/ecore/src/util/makekeys.c new file mode 100644 index 0000000..a057fa2 --- /dev/null +++ b/libraries/ecore/src/util/makekeys.c @@ -0,0 +1,326 @@ +/* Portions of this code are Copyright 1990, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#include +#include +#include +#include + +#define TBLNUM 4000 +#define MIN_REHASH 15 +#define MATCHES 10 + +typedef struct _Info Info; +static struct _Info +{ + char *name; + long unsigned int val; +} info[TBLNUM]; + +/* local function prototypes */ +static int _parseline(const char *buf, char *key, long unsigned int *val, char *prefix); + +/* local variables */ +static char tab[TBLNUM]; +static unsigned short offsets[TBLNUM]; +static unsigned short indexes[TBLNUM]; +static long unsigned int values[TBLNUM]; +static char buf[1024]; +static int ksnum = 0; + +int +main(int argc, char **argv) +{ + int max_rehash = 0; + unsigned long sig; + int i = 0, j = 0, k = 0, l = 0, z = 0; + FILE *fptr; + char *name = NULL, c; + int first = 0, num_found = 0; + int best_max_rehash = 0, best_z = 0; + long unsigned int val; + char key[128], prefix[128]; + + for (l = 1; l < argc; l++) + { + if (!(fptr = fopen(argv[l], "r"))) + { + fprintf(stderr, "Could not open %s\n", argv[l]); + continue; + } + + while (fgets(buf, sizeof(buf), fptr)) + { + if (!_parseline(buf, key, &val, prefix)) + continue; + + if (val == XK_VoidSymbol) val = 0; + if (val > 0x1fffffff) + { + fprintf(stderr, "Ignoring illegal keysym (%s %lx)\n", + key, val); + continue; + } + + if (!(name = malloc(strlen(prefix) + strlen(key) + 1))) + { + fprintf(stderr, "Makekeys: Out Of Memory !!\n"); + exit(EXIT_FAILURE); + } + + sprintf(name, "%s%s", prefix, key); + info[ksnum].name = name; + info[ksnum].val = val; + ksnum++; + if (ksnum == TBLNUM) + { + fprintf(stderr, "Makekeys: Too Many Keysyms!!\n"); + exit(EXIT_FAILURE); + } + } + + fclose(fptr); + } + + printf("/* This file is generated from keysymdef.h. */\n"); + printf("/* Do Not Edit !! */\n\n"); + + best_max_rehash = ksnum; + num_found = 0; + for (z = ksnum; z < TBLNUM; z++) + { + max_rehash = 0; + for (name = tab, i = z; --i >= 0;) + *name++ = 0; + for (i = 0; i < ksnum; i++) + { + name = info[i].name; + sig = 0; + while ((c = *name++)) + sig = (sig << 1) + c; + first = j = sig % z; + for (k = 0; tab[j]; k++) + { + j += (first + 1); + if (j >= z) j -= z; + if (j == first) goto next1; + } + tab[j] = 1; + if (k > max_rehash) max_rehash = k; + } + if (max_rehash < MIN_REHASH) + { + if (max_rehash < best_max_rehash) + { + best_max_rehash = max_rehash; + best_z = z; + } + num_found++; + if (num_found >= MATCHES) + break; + } +next1: ; + } + + z = best_z; + if (z == 0) + { + fprintf(stderr, "Makekeys: Failed to find small enough hash !!\n" + "Try increasing TBLNUM in makekeys.c\n"); + exit(EXIT_FAILURE); + } + + printf("#ifdef NEED_KEYSYM_TABLE\n"); + printf("const unsigned char _ecore_xcb_keytable[] = {\n"); + printf("0,\n"); + k = 1; + for (i = 0; i < ksnum; i++) + { + name = info[i].name; + sig = 0; + while ((c = *name++)) + sig = (sig << 1) + c; + first = j = sig % z; + while (offsets[j]) + { + j += (first + 1); + if (j >= z) j -= z; + } + offsets[j] = k; + indexes[i] = k; + val = info[i].val; + printf("0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, ", + (sig >> 8) & 0xff, sig & 0xff, + (val >> 24) & 0xff, (val >> 16) & 0xff, + (val >> 8) & 0xff, val & 0xff); + for (name = info[i].name, k += 7; (c = *name++); k++) + printf("'%c',", c); + printf((i == (ksnum - 1)) ? "0\n" : "0,\n"); + } + + printf("};\n\n"); + printf("#define KTABLESIZE %d\n", z); + printf("#define KMAXHASH %d\n", (best_max_rehash + 1)); + printf("\n"); + printf("static const unsigned short hashString[KTABLESIZE] = {\n"); + + for (i = 0; i < z;) + { + printf("0x%.4x", offsets[i]); + i++; + if (i == z) break; + printf((i & 7) ? ", " : ",\n"); + } + + printf("\n"); + printf("};\n"); + printf("#endif\n"); + + best_max_rehash = ksnum; + num_found = 0; + for (z = ksnum; z < TBLNUM; z++) + { + max_rehash = 0; + for (name = tab, i = z; --i >= 0;) + *name++ = 0; + for (i = 0; i < ksnum; i++) + { + val = info[i].val; + first = j = val % z; + for (k = 0; tab[j]; k++) + { + if (values[j] == val) goto skip1; + j += (first + 1); + if (j >= z) j -= z; + if (j == first) goto next2; + } + tab[j] = 1; + values[j] = val; + if (k > max_rehash) max_rehash = k; +skip1: ; + } + if (max_rehash < MIN_REHASH) + { + if (max_rehash < best_max_rehash) + { + best_max_rehash = max_rehash; + best_z = z; + } + num_found++; + if (num_found >= MATCHES) break; + } +next2: ; + } + + z = best_z; + if (z == 0) + { + fprintf(stderr, "Makekeys: Failed to find small enough hash !!\n" + "Try increasing TBLNUM in makekeys.c\n"); + exit(EXIT_FAILURE); + } + for (i = z; --i >= 0;) + offsets[i] = 0; + + for (i = 0; i < ksnum; i++) + { + val = info[i].val; + first = j = val % z; + while (offsets[j]) + { + if (values[j] == val) goto skip2; + j += (first + 1); + if (j >= z) j -= z; + } + offsets[j] = indexes[i] + 2; + values[j] = val; +skip2: ; + } + + printf("\n"); + printf("#ifdef NEED_VTABLE\n"); + printf("#define VTABLESIZE %d\n", z); + printf("#define VMAXHASH %d\n", best_max_rehash + 1); + printf("\n"); + printf("static const unsigned short hashKeysym[VTABLESIZE] = {\n"); + for (i = 0; i < z;) + { + printf("0x%.4x", offsets[i]); + i++; + if (i == z) break; + printf((i & 7) ? ", " : ",\n"); + } + printf("\n"); + printf("};\n"); + printf("#endif\n"); + + return 0; +} + +/* local functions */ +static int +_parseline(const char *buf, char *key, long unsigned int *val, char *prefix) +{ + int i = 0; + char alias[128]; + char *tmp = NULL, *tmpa = NULL; + + /* try to match XK_foo first */ + i = sscanf(buf, "#define %127s 0x%lx", key, val); + if ((i == 2) && (tmp = strstr(key, "XK_"))) + { + memcpy(prefix, key, (tmp - key)); + prefix[tmp - key] = '\0'; + tmp += 3; + memmove(key, tmp, strlen(tmp) + 1); + return 1; + } + + /* try to match an alias */ + i = sscanf(buf, "#define %127s %127s", key, alias); + if (((i == 2) && (tmp = strstr(key, "XK_"))) && + (tmpa = strstr(alias, "XK_"))) + { + memcpy(prefix, key, (tmp - key)); + prefix[tmp - key] = '\0'; + tmp += 3; + memmove(key, tmp, strlen(tmp) + 1); + memmove(tmpa, tmpa + 3, strlen(tmpa + 3) + 1); + + for (i = ksnum - 1; i >= 0; i--) + { + if (!strcmp(info[i].name, alias)) + { + *val = info[i].val; + return 1; + } + } + fprintf(stderr, "Cannot find matching definition %s for keysym %s%s\n", + alias, prefix, key); + } + + return 0; +} diff --git a/libraries/ecore/src/util/mkks.sh b/libraries/ecore/src/util/mkks.sh new file mode 100755 index 0000000..6669242 --- /dev/null +++ b/libraries/ecore/src/util/mkks.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +cat $* | awk 'BEGIN { \ + printf "/*\n * This file is generated from %s. Do not edit.\n */\n", \ + "$(INCLUDESRC)/keysymdef.h";\ +} \ +/^#define/ { \ + len = length($2)-3; \ + printf("{ \"%s\", %s },\n", substr($2,4,len), $3); \ +}' -- cgit v1.1